Anthony's Blog

Week 8: My Technical Blog

What is Rails?

Established Feb 6th, 2015

What is Rails? Probably most Ruby beginner will have this question when they first learned Ruby. What is the relationship between Ruby and Rails? Let me give you a very brief introduction about Rails.

Ruby on Rails, or simply Rails, is an open source web application framework written in Ruby. Rails is a full-stack framework that emphasizes the use of well-known software engineering patterns and paradigms, including convention over configuration (CoC), don't repeat yourself (DRY), the active record pattern, and model–view–controller (MVC).

Technical overview

Like many web frameworks, Ruby on Rails uses the model–view–controller (MVC) pattern to organize application programming.

In a default configuration, a model in the Ruby on Rails framework maps to a table in a database, and a Ruby file. For example, a model class User will usually be defined in the file user.rb in the app/models directory, and is linked to the table users in the database. Developers can choose any model name, file name or database table name. But this is not common practice and usually discouraged according to the "convention over configuration" philosophy.

A controller is a component of Rails that responds to external requests from the web server to the application by determining which view file to render. The controller may also have to query one or more models directly for information and pass these on to the view. A controller may provide one or more actions. In Ruby on Rails, an action is typically a basic unit that describes how to respond to a specific external web-browser request. Also note that the controller/action will be accessible for external web requests only if a corresponding route is mapped to it. Rails encourages developers to use RESTful routes, which include actions such as: create, new, edit, update, destroy, show, and index. These mappings of incoming requests/routes to controller actions can be easily set up in the routes configuration file.

Reception

Rails running on Matz's Ruby Interpreter (the de facto reference interpreter for Ruby) had been criticized for issues with scalability.These critics often mentioned various Twitter outages in 2007 and 2008, which spurred Twitter's partial transition to Scala (which runs on the Java Virtual Machine) for their queueing system and other middleware.[42][43] The user interface aspects of the site continued to run Ruby on Rails until 2011 when it was replaced due to concerns over performance

So, I hope now you have some basic understand about what Rails is, and how is it interact with Ruby. I hope you will learn Rails soon!

Week 8: My 8th Cultural Blog

Conflict? How to deal with?

Established Feb 5th, 2015

Have you ever seen the compass of shame? When people face a conflict, they will often use one of four strategies for dealing with shame including 1)Withdrawal 2)Attack Self 3)Avoidance and 4)Attack Others

This is indeed a very interesting point, and I just have to agree that. To me, when I have conflict, I will probably try to "attack myself", because sometimes I will think of maybe its a good idea to diminish ourselves in the presence of others instead of "Withdrawal" where we can still stay connectect with others. I admit that there is a danger when I tried to attack myself, because the conflict can still build up inside and can lead to explisions or extremem voilence to others somethings. Thus, I've already tried to change, and improve my way to dael with conflict.

Discuss a time you had an emotional conflict with someone. What was it about? What happened?

I can still recall that there is a time when I had to decide whether or not I should attend Dev Bootcamp since its a huge commitment in terms of time and money. I actually argued with my family for a while about it. We had different opionions, and we need to make the finally decision in a very short time period.

What was the source of the conflict?

The source of the conflict might probably came from me mentioning this program to my family. Given it is a program that gonna spend a huge amount of my time and money, my family members initially disagree to let me join this program. They doubted that the program is really worth the time and the money.

How did you handle that conflict?

Initially, I tried to go with 1 of those 4 ways mentioned on "Compass of shame" - to "attack myself". I tried to start believing what they said because I didn't want to make my relationship with my family worse. However, I then decided to convince them that their point might not be correct by giving examples I found online showing that a coding bootcamp is indeed a good investment over time.

Did your actions make the conflict better or worse?

My action actually make the conflict better. Fortunately my family members are all very open mind, and they are willing to listen to my voice. We gathered together and started analzing all the opinions again. Eventually, they are convinced by me, and let me to jon the program.

If you could go back, what would you do differently, if anything?

I would probably do the same thing. It is because I feel like I were actually able to solve this conflict effectively.

What did you learn from this experience?

Always listen to others. And try to be open mind. Even if you have a strong point of view, you might still want to think from others point of view. Sometimes you might just realized something new.

Week 7: My 7th Technical Blog

JavaScript VS Ruby

Established Jan 30th, 2015

When people mention JavaScript, they always think of it is the language of web. However, Ruby also plays a very important role in web application nowadays. So what is the real difference between JavaScript and Ruby?

typeof vs class

To determine what type of value something is (a number, a fixnum, a string, an Object, an array, etc), in JavaScript you write typeof and then then the object; in Ruby, you append .class to the end of the object.

=== vs ==

In JavaScript, the triple equals sign helps determine if two objects are the same exact object (having the same typeof and the same value). For example: 3 === 3 returns true In Ruby, that is accomplished through the double equals. (3 == 3 returns true)

JavaScript has its own double equals, which shouldn’t be confused with Ruby’s: double equals in JavaScript only determines if the values match. For example: "3" == 3 returns true

Objects

Objects (similar to Ruby’s hash), declared as variables, are a way of organizing key/value pairs. For example, var cat = {color: "grey", name: "Spot", age: "12"}; To access the value of an associated key, you can call that on the variable name: cat.name returns "Spot". You can also easily delete a key/value pair by writing delete cat.name. To declare a new key/value pair, write: cat.gender = "male";. This appends this new data point to the end of the Object.

Arrays

Both Ruby and JavaScript have Arrays, which are more of less logically the same; however, the Object Array functions (JavaScript) and the Class Array methods (Ruby) have different syntax. For example, to find the index of an element in an array, in JavaScript you write arrayName.indexOf("element");. In Ruby, this is accomplished by array_name.index("element")

And of course, there are still a lot of difference between JavaScript and Ruby. Can you identify some?

Week 7: My 7th Cultural Blog

Affirmation and Stereotype Threat

Established Jan 29th, 2015

When I think of the last time in my life where I've been the happiest, the proudest. and the most satisfied, the following values come to my mind:

Accomplishment

I like having the feeling of accomplishment. It always makes you fell happy, proud, and satistied. It is because when you set some goal for yourself, you are expecting yourself to accomplish it no matter what obstacles you have out there. Therefore, when you were able to accomplish something, it shows that you have the ability to promise yourself. It tells yourself that you are capable of doing something difficult.

Confidence

Having confidence is very important to me. It is because I always believe that when you are happy, you are always confident during that moment. Being confident about something means you have faith about it, you are good at it, and you are willing to accomplish it no matter what. Thus, being confident in your life is very important, especially during some important moment in your life: Taking an exam, Meeting someone important, Doing something impactful, etc. Sometimes, I believe that the more confident you are, the more happier you are.

Reputation

People wants reputation. I can think of reputation is the value of your personal brand. The more reputation you have, the better your personal brand is. So that also means if you have a very high reputation, people will believe that you are credible, reliable, trustable and powerful. Therefore, when I felt like I was proudest person in the world, I actually believe I have a very high value of reputation among all others.

In summary, I strongly agree those values I mentioned above. If I have to rate, it would be 5 on a scale of 1 to 5

The last topic that someone asked my advice on was my friend who needed to decide whether he should go back to his hometown while giving up the legal status in the United States. Since that is a very serious topic, I tried to analyze the pros and cons of both optiopns with him. I believe I successfully express the values I mentioned above: Confidence and Reputation because thats probably why my friend had decided to come to me and ask for advice. Eventually, we were able to come up witha a conclusion where he could make the finally decision.

So this is what I think of values. What value do you agree?

Week 6: My Technical Blog

Object-Oriented vs. Functional Programming

Established jan 23rd, 2015

Since I've learned a bit about object-oriented programming this week, I would like to share something I learned.

Let's talk about Object-Oriented vs. Functional Programming. When people discuss this topic, they always argue one is better than the other one. But is it really the case? Let's find out!

The central tenet of OOP is that data and the operations upon it are tightly coupled: An object owns its data and it owns the implementation of the operations on the data. It hides those from other objects via its interface, a collection of methods or messages it responds to. Thus, the central model for abstraction is the data itself, hidden as it is behind a small API in the form of its interface.

The central tenet of FP is that data is only loosely coupled to functions. You can write different operations on the same data structure, and the central model for abstraction is the function, not the data structure. Functions hide their implementation, and the language’s abstractions speak to functions and they way they are combined or expressed, such as generic functions or combinators.

Now, A well-crafted OO architecture makes changing the way things are put together easy. All that hiding and decoupling allows you to change the relationships between things easily. OO does not make adding new operations particularly easy, you see this whenever you find yourself muttering about “double dispatch and visitors.”

But if you have a business process for placing an order that is being refactored to handle new business rules, this is where OO shines. Those things that don’t need to know about the change are insulated from those that do.

Right? So you can see that the answer to the question I doubted at the beginning is really up to you. Someone might prefer OO more, while someone might like Functional programming more.

What do you think? Lets share your opinion too!

Week 6: my Cultural Blog

Stereotype Threat

Established Jan 22nd, 2015

Accorfing to "Steele & Aronson, 1995", Stereotype threat refers to being at risk of confirming, as self-characteristic, a negative stereotype about one's group. This term was first used by Steele and Aronson (1995) who showed in several experiments that Black college freshmen and sophomores performed more poorly on standardized tests than White students when their race was emphasized. When race was not emphasized, however, Black students performed better and equivalently with White students. The results showed that performance in academic contexts can be harmed by the awareness that one's behavior might be viewed through the lens of racial stereotypes.

To me, stereotype just happens all the time. As an international student and also an Asian, it has been affecting me since I first came to the United States 6 years ago for college.

I can still recall that when I first came to college, there wasa a stereotype that local americans believe Asian don't speak English. Thus, at that time, there were actually quite a few other local students refused to talk to me, or try to mock at me given my English ability. This is definitely not true and appropriate. Although I do agree that this steretype were created given the history that US immigrants were poor and poor-educated, however, there are also many international students who received decent education in their hometown but still decided to study abroad in order to widen their horizon. Personally, I could speak decent English at the time when I entered college. But I can still definitely expericen that stereotype even when I am graduated from college last year. I guess it is not something you can change easily. Perhaps it takes years or decades? But that is also what make America special.

Week 5: My Technical Blog

Ruby Classes

Established Jan 16th, 2015

This week, we will be talking about Class in Ruby.

Classes in Ruby are first-class objects---each is an instance of class Class.

Typically, you create a new class by using:

class Name
some class describing the class behavior
end

When a new class is created, an object of type Class is initialized and assigned to a global constant (Name in this case).
When Name.new is called to create a new object, the new method in Class is run by default.

Classes, modules, and objects are interrelated. In the diagram that follows, the vertical arrows represent inheritance, and the parentheses meta-classes. All metaclasses are instances of the class `Class'.

Below is another very simple example of class:

class Class
alias oldNew new
def new(*args)
print "Creating a new ", self.name, "\n"
oldNew(*args)
end
end
class Name
end
n = Name.new

What do you think? Not too hard to learn, right?

Week 5: My Culturabl Blog

Feedbacks

Established Jan 15th, 2015

Let's talk about feedbacks!

Feedback is very important. Having feedback from others will allow you to able to reflect yourself in the view of others. When I read my feedback from others, I will also try to recall the pairing session me and the partners were having. I tried to connect to the whole scene, so that I will be able to truly reflect my behaviors. I mean, I like feedback. It is because I feel like everytime when I read some feedback, I will be able to improve the way I talk, the way I code, and the way I interact with others. Thus, feedback is definitely helpful to my learning.

I also write feedbacks. When I write feedbacks, I try not to be too critical, but instead make it like an open discussion, and extend my opinions to others so that when the reader reads the feedback I wrote, they will be able to elaborate the idea I wanted to bring out.

What about you? Do you like feedback? If so, why?

Week 4: My Technical Blog

Enumerable Methods

Established Jan 9th, 2015

Today, we eill be discussing about Enumerable Methods in Ruby. Sometimes, Enumerables methods are very useful which it can indeed help your code to be short and clear. However, it is also somehow difficult to understand.

Let's talk about .map method

So, map method is a method that will iterate through every single element in the array in your Ruby code. Let's take a look at the below example:

[1,2,3,4].map {|i| i + 1}

# print: [2, 3, 4, 5]

As you can see, if we use the map method, it will loop through all 4 elements in the array, and do whatever we want it to do. In this case: we want to return every number with +1.

So it isn't that hard, huh? In fact, map method is very powerful when it comes to a situation that you need to use it in conjunction with many other arrays and enumerable methods. Such like:

[1,2,3,4].map.to_s

# print: ["1", "2", "3", "4"]

Alright, I hope you learned something. Lets talk about Ruby again next week!

Week 4: My Cultural Blog

Patent legislation

Established Jan 8th, 2015

Today I want to talk about some issues that is happening in the tech industry. To me, the whole tech world is kinda new. However, I do believe it is time to learn more about what's really happening out there, especially when I really start working in the tech industry.

Congress passed major patent reform legislation just a few years ago, and most observers predicted it would be a generation before Congress returned to the issue.

But the problem of "patent trolls" — firms that use bogus patent suits to extort settlements out of businesses — has escalated so quickly that Congress is now poised to pass new legislation to curb abuse.

Silicon Valley, retail groups and other business interests are lobbying hard for legislation to crack down on patent trolls. But one major fissure has emerged —Google wants companies to be empowered to challenge the validity of software patents, while Microsoft strongly opposes the proposal.

Some judges and trial lawyers have also expressed concern about a provision that would force courts to award legal fees to winning parties in certain cases.

The House approved patent legislation from Judiciary Committee Chairman Bob Goodlatte (R-Va.) in December, and the Senate Judiciary Committee is expected to move its own bill in the New Year.

So this is only one of many issues that is happening nowadays in the tech industry. Do you have more to share?

Week 3: My 3rd Technical Blog

Ruby: Array vs. Hash

Established Jan 2nd, 2015

Oftern time, rubyist will get confused about array and hash. It is because these 2 young brothers look very simialr. So how should we handle them? Good quesion.

So I guess most of us already know what array is. Let's talk about hashes! Hashes are a lot like arrays: they have a bunch of slots that can point to various onjects. However, in an array, the slots are lined up in a row, and each one is numbered (starting from zero). In a hash, the slots aren't in a row (they are just sort of jumbled together)! Therefore, you can use any object to refer to a slot, not just a number.

I see....Then why do we use Hash over Array? Well, it is good to use hashes when you havae a bunch of things you want to keep track of but they don't really fit into an ordered list.

A simple example:
In Array, things are ordered by a list such as 'a, b, c, d, etc...'
In Hash, its more like a collection of key/value pairs: 'Ada has c, Bob has d, Chris has a, and Daniel has b, etc...'

I hope it helps!

Week 3: My 3rd Cultural Blog

Thinking Style and Programmer Mindsets

Established Jan 1st, 2015

When talking about thinking style, everyone is different. It is because we all have our preferred way to think. You can be a Concrete Random guys, or you can be a ABSTRACT SEQUENTIAL guys. So it really depends.

Then what about me? Wells, I am actually more like an ABSTRACT RANDOM guys in terms of thinking style.

So what is it like being an Abstract Random person? Good question!

Abstract random thinkers organize information throught reflection, and thrive in unstructured, people-oriented invironments. Says DePorter: "The 'real' world for abstract random learners is the world of feelings and emotions. The AR's mind absorbs ideas, information and impressions and organizes them through reflection. They remember best if information is personalised. They feel constricted when they're subjected to a very structured environment."

Isn't it interesting? As an AR thinker, I agree that I usually use my natural ability to work with others. And I cannot deny that emotions and feelings stronly influence your concentration. I just feel like doing that!

What is your thinking style? Feel free to share with me! :-)

Week 2: My 2nd Technical Blog

CSS Concept:
What are the differences between relative, absolute, and fixed positioning

Established Dec 12th, 2014

Web developer use CSS for styling their websites, making them look fancy and beautiful. And one of the most important factor here is positioning. So what exactly do developer position thing in a website? Read on...

Controlling the position of HTML elements allows you incredibly fine control over how your pages look. In CSS, there are 3 types of positioning: relative, absolute, and fixed. And the difference is quite obvious. Let's talk about relative first.

Relative positioning is very straight-forward: it tells the element to move relative to where it would have landed if it just had the default static positioning.
If you give an element relative positioning and tell it to have a margin-top of 10px, it doesn't move down ten pixels from any particular thing - instead, it moves down ten pixels from where it otherwise would have been.

What about absolute? When an element is set to absolute position, it's then positioned in relation to the first parent element it has that doesn't have position:static.
If there is no such element, the element with position: absolute gets positioned relative to <html>.

Finally, fixed positioning.
Fiexed positioning anchors an element to the brower window - you can think of it as gluing the element to the screen. If you scroll up and down, the fixed element stays put even as other elements scroll past! Funny!

As a result, all three positioning has different purposes, and it really comes down the actual requirement when a developer decide which positioning he or she needs. I hope this simple technical blog helps!

DBC Week 1: My 1st Technical Blog

Version Control, git, and GitHub?

Established Nov 29th, 2014

Version control? What is that? As someone who has never landed into the programming's world, you will probably never hear this technical term before. However, after 10 hours of my 1st week at Dev Bootcamp, everything I learned just make so much sense, including version control, git, and developer's favorite - GitHub.

So when you have some new programming project, you are planning to store all the fils for that project in some new directory. You know that as time goes on, those files will change by a lot. Thus, every time you make some little changes, you record the change for future reference, like a snapshot - that's about it for version control.

And now we have Git. Git is a version control software, installed from your command line. It allows you to dave different "versions" of your work as you go - via adds and commits. As long as you've installed Git on your computer, you can start saving versions of your work. Isn't it pretty awesome!?

What about GitHub? Is it just Git? Not really. As GitHub is more like an "online" version of Git, you can access all the different versions of your project remotely - like Dropbox to a USB drive! it will store your identical working directories - aka repositories, from/to your collaborator, update each other's progress - just like a hub for Git repositories. So why is it good stuff? Because not only you can have your colleague review your code anytime and anywhere, but you can also sync with your colleague no matter what updates and merges occur. AWESOME!

DBC Week 1: My 1st Cultural Blog

Chefs in the Kitchen

Established Nov 28th, 2014

Based on the video, what's your take on the DBC experience? What is your impression of DBC? How do you see yourself engaging with this type of culture? Have your expectations of DBC changed? If so, how? Are you excited to participate in this kind of learning environment? Does it make you nervous?

1st week at DBC officially ends after I finished writing this blog. I have to admit, I did learnt a lot about programming from a complete n00b to "beginner" now. Version control, command line, Git, GitHub, basic Ruby, etc. I just couldn't belive it!

So far, I have a good experience at DBC. I feel like this place is not just a bootcamp who teach you how to code for tuition, but there are actually a lot more than that. To me, DBC is more like a school to teach you how to become a well-round good software develper by emphasizing on its culture, value, EQ training, and Yoga! This is definitely something new to me, since I haven't been in school for a long time.

However, I do see this is a good thing. And I believe this is what I was expecting from the beginning when I first decided to apply for DBC. To learn coding, there are already thousands of resources online. But it is always hard for an outsider to have the training to become a good porgrammer who works in fast paced team environment. So I think I found my reason to stay at DBC, and I believe I am just feeling good.

Back to Homepage