Skip to content

Commit

Permalink
Adding ruby vs. java post and values post
Browse files Browse the repository at this point in the history
  • Loading branch information
utsab committed Aug 9, 2015
1 parent 8beda48 commit f74acc9
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 3 deletions.
34 changes: 34 additions & 0 deletions blog/c7-ruby-vs-java.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<head>
<title>Ruby Classes vs. Javascript Objects</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="your-stylesheet-link-here.css">
</head>

<main>
<h1>Ruby Classes vs. Javascript Objects</h1>
<h4>August 8, 2015</h4>

<section>
<p>
Ruby and Javascript both have the concept of "objects". Their goals are similar: to encapsulate a group of related variables and methods. Ruby, on the one hand, is a class-based language and has much baked in support for class objects. Javascrip, on the other hand, is not a class-based language, but with some effort it can approximate class functionality.
</p>
<p>
One way this difference manifests is that Ruby has many convenient encapsulating features. It offers a layer of protection against outsiders from acessing its internal class variables. It offers the attr_reader, attr_writer methods to regulate access. In Javascript, there all properties of an object are public.
</p>

<p>
Now let's look at object creation. In Ruby you use the <ClassName>.new syntaxt to create a new instance of a class. In javascript, there are two ways of declaring a class. You can either use the object literal notation, or you can use the class constructor notation. Although they both use the word "new", they mean different things in each language. In Ruby, "new" is a method of the class object, whereas in javscript, "new" is a keyword of the language itself. In Ruby, calling "new" executes the code in the "initialize" method, whereas in javascript, everything inside the function constructor gets executed. Additionally, in javascript, calling "new" does some fancy things with binding the scope of "this" to the object itself. Ruby does have a "self" variable which also gets binded to the class object. However, the scoping rules in javascript are a bit more complex than in Ruby.
</p>
<p>

</p>
<p>
Adding methods to objects is a bit more cumbersome in javascript. One has to make use of the "prototype" property of objects. In Ruby, one can simply declare the methods inside the class.
</p>
</section>
</main>

</body>

</html>
64 changes: 64 additions & 0 deletions blog/c7-values.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<head>
<title>Ruby Classes vs. Javascript Objects</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="your-stylesheet-link-here.css">
</head>

<main>
<h1>Values</h1>
<h4>Aug 8, 2015</h4>

<section>
<p>
<b>What are my values?</b>
</p>
<p>
<ul>
<li>Growth</li>
<li>Contribution</li>
<li>Focus</li>
<li>Health</li>
</ul>
</p>
<p>
<b>Do I try to live by these values?</b>
</p>
<p>
For each of these, on a scale of 1 to 5, how much effort do I put in to live by these values?
</p>
<p>
<ul>
<li>Growth ===> 5</li>
<li>Contribution ===> 4</li>
<li>Focus ===> 4</li>
<li>Health ===> 4</li>
</ul>
</p>
<p>
<b>A deeper look at focus</b>
</p>
<p>
Being focused and clear-headed are very important to me. In my experience, you can always keep improving as long as your are able to hold your mind to a thought for a long period of time. For example, suppose I'm working on a task, and I run into a challenge. A focused mind would bring my mind back again and again to the task at hand. A distracted mind may get lost in self-doubt and then give up.
</p>
<p>
<b>Advice</b>
</p>
<p>
A friend of mine was having some issues with his dating life and parents. His parents did not approve of the girl he was dating due to their own stereotype biases. Now my friend comes to me and is upset because his parents won't "allow" him to date this girl. I felt he was not being clear-headed, and I asked him whether it was possible that it was his parents' biases that were the obstacle, or his own? Did he himself buy in to his parents' criticisms? After some reflection, he realized that yes it was his own internal doubt that was the real obstacle.
</p>
<p>
<b>
Values and Stereotype Threat
</b>
</p>
<p>
Yes being clear-headed and focused can help me when I'm at DBC. One exercise that has been helpful for me in this regard is journaling. Whenver I'm feeling stress, I'll journal about it and try to get to the bottom of it.
</p>
</section>
</main>


</body>

</html>
12 changes: 9 additions & 3 deletions blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,22 @@
<a href="http://utsab.github.io/blog/c4-diversity.html">Diversity</a>
</li>
<li>
<a href="http://utsab.github.io/blog/t5-classes.html">Diversity</a>
<a href="http://utsab.github.io/blog/t5-classes.html">Classes</a>
</li>
<li>
<a href="http://utsab.github.io/blog/c5-vulnerability.html">Diversity</a>
<a href="http://utsab.github.io/blog/c5-vulnerability.html">Vulnerability</a>
</li>
<li>
<a href="http://utsab.github.io/blog/t6-functional-vs-oop.html ">Functional vs. OOP</a>
</li>
<li>
<a href="http://utsab.github.io/blog/stereotype-threat.html">Diversity</a>
<a href="http://utsab.github.io/blog/stereotype-threat.html">Stereotype Threat</a>
</li>
<li>
<a href="http://utsab.github.io/blog/c7-ruby-vs-java.html">Ruby vs. Java</a>
</li>
<li>
<a href="http://utsab.github.io/blog/c7-values.html">Values</a>
</li>
</ul>
</div>
Expand Down

0 comments on commit f74acc9

Please sign in to comment.