<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 <title>Rodrigo Alves Vieira</title>
 <link href="http://www.rodrigoalvesvieira.com/atom.xml" rel="self"/>
 <link href="http://www.rodrigoalvesvieira.com/"/>
 <updated>2013-05-20T19:03:04-07:00</updated>
 <id>http://www.rodrigoalvesvieira.com/</id>
 <author>
   <name>Rodrigo Alves Vieira</name>
   <email>rodrigovieira1994@gmail.com</email>
 </author>
 
 <entry>
   <title>Startup idea&#58; inward bicycle transportation service</title>
   <link href="http://www.rodrigoalvesvieira.com/bikestartup"/>
   <updated>2013-04-20T00:00:00-07:00</updated>
   <id>http://www.rodrigoalvesvieira.com/bikestartup</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/public/images/bikes.jpg&quot; title=&quot;Bikes&quot; alt=&quot;Bikes&quot; height=&quot;200&quot;&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;drops&quot;&gt;A&lt;/span&gt;ll over the world we have these huge spaces like factories, construction sites, clubs, tech campuses and universities where people constantly need to move from a building to another and stuff like that.&lt;/p&gt;

&lt;p&gt;I think there&amp;rsquo;s a good opportunity there for the emergence of a company offering an inward (restricted area), private bicycle transportation service to solve transportation issues in these places.&lt;/p&gt;

&lt;h2&gt;How would it work?&lt;/h2&gt;

&lt;p&gt;Imagine yourself as the administer of some university. Let&amp;rsquo;s say  there are 10 thousand people everyday in campus, on average. Now you could ask for 2% the number of people in bicycle, just to begin with (later you could upgrade the number of bicycle, if needed).&lt;/p&gt;

&lt;p&gt;There you have 200 bicycle, ready to be used and shared. Awesome, non-polluting, safe, healthy fuel-free transportation for everyone inside the university perimeter.&lt;/p&gt;

&lt;p&gt;All bicycle and other equipment would not be purchased by the customer and would be owned by the startup. All things rented, and payment done in the good pay-as-you-go fashion.&lt;/p&gt;

&lt;p&gt;How security would work for this idea I haven&amp;rsquo;t thought much. But one way could be not only restricting the use within the perimeter of the place but also restricting to &amp;ldquo;verified&amp;rdquo; people.&lt;/p&gt;

&lt;p&gt;Maybe the bicycles could be slightly customized with the subscribing company logo and color.&lt;/p&gt;

&lt;p&gt;The monthly subscription would be calculated for every customer. Based on the number of bicycles, parking stations and other equipment requested. Of course any damage done to any of the equipment would mean additional cost for the customer.&lt;/p&gt;

&lt;p&gt;Bicycle transportation is becoming more and more popular (not to mention cool) &amp;ndash; and represent the best alternative to transport in many situations &amp;ndash; these days and this idea would make it way more practical for the possibly interested institutions to implement it.&lt;/p&gt;

&lt;p&gt;You can &lt;a href=&quot;https://news.ycombinator.com/item?id=5582215&quot;&gt;join the discussion&lt;/a&gt; on Hacker News.&lt;/p&gt;

&lt;p&gt;UPDATE: &lt;a href=&quot;http://www.viacycle.com/&quot;&gt;viacycle&lt;/a&gt; seems to be doing just that. However, we need this in Brazil too!&lt;/p&gt;
</content>
   <author>
     <name>Rodrigo Alves Vieira</name>
     <uri>http://www.rodrigoalvesvieira.com/about</uri>
   </author>
 </entry>
 
 <entry>
   <title>Why to support programming user groups</title>
   <link href="http://www.rodrigoalvesvieira.com/support-pugs"/>
   <updated>2013-04-19T00:00:00-07:00</updated>
   <id>http://www.rodrigoalvesvieira.com/support-pugs</id>
   <content type="html">&lt;p&gt;&lt;span class=&quot;drops&quot;&gt;I&lt;/span&gt;f you have a tech company or some other kind of company that depends much on hackers, then you certainly can benefit from supporting programming/development user groups.&lt;/p&gt;

&lt;p&gt;There are a lot of reasons for it. You may be looking to hire people (and if you&amp;rsquo;re really a tech company then you&amp;rsquo;ll probably be doing it all the time), you may be selling products/services for hackers, like web hosting or some proprietary technology or even consulting, etc.&lt;/p&gt;

&lt;p&gt;By supporting these user groups, your company may certainly grow its reputation among hackers, and it can only be a good thing.&lt;/p&gt;

&lt;p&gt;So I even suggest, don&amp;rsquo;t spend money with some non-technical recruiter and instead sponsor these groups and use this as your recruiting mechanism.&lt;/p&gt;

&lt;p&gt;Also, doing this may be way less expensive than you may be thinking. Of course sponsoring huge events will be costly and may not be the best for your company, but there are always smaller, local user groups to with you can contribute and benefit from.&lt;/p&gt;

&lt;p&gt;P.S: now this article could be extended from technical user groups to entrepreneurship meetings too. You can find good opportunities in those.&lt;/p&gt;
</content>
   <author>
     <name>Rodrigo Alves Vieira</name>
     <uri>http://www.rodrigoalvesvieira.com/about</uri>
   </author>
 </entry>
 
 <entry>
   <title>Why I'm enjoying so much learning Java</title>
   <link href="http://www.rodrigoalvesvieira.com/likejava"/>
   <updated>2013-04-18T00:00:00-07:00</updated>
   <id>http://www.rodrigoalvesvieira.com/likejava</id>
   <content type="html">&lt;p&gt;&lt;span class=&quot;drops&quot;&gt;I&lt;/span&gt; started programming in mid 2009 in Python. I wanted to be a hacker, yes. So when I got a PC I started crawling into the web to find out how could I become one.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;m glad to me it all started with Python, with which you can get started pretty fast and do something interesting right away. This is something very important for diminishing frustration.&lt;/p&gt;

&lt;p&gt;Then I started my graduation in Computer Science in a school where Java is used to teach programming and object orientation to students. I was a little worried it&amp;rsquo;d bore me to death, have to deal with a language so less &amp;ldquo;dynamic&amp;rdquo; than Ruby, Python or JavaScript.&lt;/p&gt;

&lt;p&gt;But hey, turns out my worries were nonsense. Learning Java is great for grasping more elementary insights about program structure and working. You kinda get to think more about the way everything is supposed to happen in the code.&lt;/p&gt;

&lt;p&gt;You start thinking more about memory consumption and management, although we all know that JVM runs a Garbage Collector just like Ruby, for example. But IMO, just the static typing characteristic already has the effect of making you more aware of how you allocated memory resources in a program, which is great.&lt;/p&gt;

&lt;p&gt;I plan to really dig into the language with time. I wanna learn everything that is necessary to be a good Java hacker.&lt;/p&gt;

&lt;h2&gt;What leaves me excited about the future&lt;/h2&gt;

&lt;p&gt;I&amp;rsquo;ve head people saying that Java is becoming obsolete and I don&amp;rsquo;t think that is happening. What I think is happening (and happening for quite a long time already) is that other languages have evolved to solve problems that people thought they could only solve with Java before (or they thought Java was more suited for when it wasn&amp;rsquo;t), like small/medium web applications and web sites.&lt;/p&gt;

&lt;p&gt;Also, the Java community is big. You can find a ready, open source library for &lt;strong&gt;a lot&lt;/strong&gt; of things.&lt;/p&gt;

&lt;p&gt;But what leaves me more excited, is how the JVM is becoming more and more popular and evolving in such a creative way, specially through Scala and Clojure. Knowing Java will help you a lot if you decide to become a Scala or Clojure hacker.&lt;/p&gt;
</content>
   <author>
     <name>Rodrigo Alves Vieira</name>
     <uri>http://www.rodrigoalvesvieira.com/about</uri>
   </author>
 </entry>
 
 <entry>
   <title>Failing in College and what to do about it</title>
   <link href="http://www.rodrigoalvesvieira.com/failing-college"/>
   <updated>2013-04-05T00:00:00-07:00</updated>
   <id>http://www.rodrigoalvesvieira.com/failing-college</id>
   <content type="html">&lt;p&gt;&lt;span class=&quot;drops&quot;&gt;L&lt;/span&gt;ast year I started college and even having some pretty good experiencing in programming, I have failed a lot.&lt;/p&gt;

&lt;p&gt;The fact is, in college it is always more about Mathematics than programming itself and I did not know about that before and I took too much time to acknowledge this. So I successfully went thru Programming, Computing and Discrete Math. But failed both Calculus and Linear Algebra.&lt;/p&gt;

&lt;h2&gt;The Problem with Failing and UFPE&lt;/h2&gt;

&lt;p&gt;There are actually many problems related to failing disciplines in a Computer Science education. First, it will weaken your self-esteem, or at least that was true for me. Real destroyer. It will delay your graduation, weaken your morale among fellow students and your professors. It will make it impossible to achieve a American/British/German university. Make it harder for you to be accepted in the departments study groups (A.I groups, Security groups, Software Engineering, Aug. reality) or be accepted in Research Projects.&lt;/p&gt;

&lt;p&gt;Once you&amp;rsquo;ve failed, you&amp;rsquo;ve failed. Even when you get up to your feet again and pass those badass disciplines, you&amp;rsquo;ll still be marked as a someone who failed. This quite frustrating and depressing.&lt;/p&gt;

&lt;h2&gt;The problem with me&lt;/h2&gt;

&lt;p&gt;I&amp;rsquo;ve never studied really hard in high-school. In fact, thru all the years, I was just a mediocre student and I thought &amp;ndash; and man, I wish I hadn&amp;rsquo;t &amp;ndash; that I could just get by without really studying.&lt;/p&gt;

&lt;p&gt;Today I think: how could I behave like that and still want to be a Computer Scientist? Guess I was just really dumb!&lt;/p&gt;

&lt;p&gt;Then I did the exam, and got admitted at the University.&lt;/p&gt;

&lt;h2&gt;The overcome&lt;/h2&gt;

&lt;p&gt;As you might have guessed, I got really frustrated for having failed what I absolutely should not, and could not. Damn it man, it is my dream.&lt;/p&gt;

&lt;p&gt;The only way to solve my problem is to really be a good student and do the exam again, get out of college and get in back again.  Start over and work really hard. I&amp;rsquo;ve decided I will do that.&lt;/p&gt;

&lt;h2&gt;New to Computer Science? Here is my advice&lt;/h2&gt;

&lt;p&gt;If you are considering starting a CS graduation. Be careful. Try focusing much more on Math than in programming itself. Specially, study fields like Calculus, Analytic Geometry, Linear Algebra, Discrete Math, Statistics and Algorithms. It will help you a lot.&lt;/p&gt;

&lt;p&gt;You can &lt;a href=&quot;https://news.ycombinator.com/item?id=5502325&quot;&gt;join the discussion&lt;/a&gt; on Hacker News.&lt;/p&gt;
</content>
   <author>
     <name>Rodrigo Alves Vieira</name>
     <uri>http://www.rodrigoalvesvieira.com/about</uri>
   </author>
 </entry>
 
 <entry>
   <title>How Computer Programming is taught at CIn/UFPE</title>
   <link href="http://www.rodrigoalvesvieira.com/programming-cin"/>
   <updated>2013-02-28T00:00:00-08:00</updated>
   <id>http://www.rodrigoalvesvieira.com/programming-cin</id>
   <content type="html">&lt;p&gt;&lt;figure&gt;
  &lt;img src=&quot;/public/images/cin-ufpe.jpg&quot; title=&quot;CIn/UFPE, The Informatics Center of the Federal University of Pernambuco&quot; alt=&quot;CIn/UFPE, The Informatics Center of the Federal University of Pernambuco&quot; /&gt;
&lt;/figure&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image_caption&quot;&gt;CIn/UFPE, The Informatics Center of the Federal University of Pernambuco&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;drops&quot;&gt;I&lt;/span&gt;&amp;rsquo;m a freshman Computer Science student at &lt;a href=&quot;http://www2.cin.ufpe.br/site/index.php&quot;&gt;CIn/UFPE&lt;/a&gt;, one of the main technological centers in Brazil and in this post I&amp;rsquo;ll explain how Computer Programming is taught there and what are the benefits and drawbacks of their approach.&lt;/p&gt;

&lt;p&gt;First, the program is composed by exams, exercise lists and finally, a project.&lt;/p&gt;

&lt;p&gt;The program is pretty intensive for they assume the alumni have no previous experience in programming (which is a great assumption to make, of course).&lt;/p&gt;

&lt;p&gt;They give preference to the Object Oriented paradigm and use Java. For me, there is no inherent problem here. I think it&amp;rsquo;s preferable to teach programming with OO first (if you have to choose the paradigm) and I don&amp;rsquo;t think Java is a bad choice (well, not anymore).&lt;/p&gt;

&lt;p&gt; And although Java is pretty syntactically fat (thus making it harder for remembering language instructions), I think this verbosity helps too when you need to visualize how things are supposed to behave and what data is supposed to be represented, and where.&lt;/p&gt;

&lt;p&gt;Some concepts are really well explained in the course: polymorphism, encapsulation, DRY principles, inheritance, modularity, project patterns and some basic principles for facilitating code maintenance and understanding between developers.&lt;/p&gt;

&lt;h2&gt;The Exams&lt;/h2&gt;

&lt;p&gt;The exams require up to the latest subject given, so they only require what has been covered until the day of the exam. Everything ok…but, here is the weird part: the exams are done with &lt;strong&gt;pencil and paper&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;I still find this bizarre even after tons of explanations heard. The main rationale around this (from the professors) is that they need to make sure that the alumni are learning Java properly and that the user&amp;rsquo;s code development is not facilitated by some tool/IDE like Eclipse, which apparently makes it really hard for someone to miss the language keywords.&lt;/p&gt;

&lt;p&gt;Also, the exams are not hard. At all. That&amp;rsquo;s what is wrong with this approach in my opinion. Programming is much more about learning how to solve problems with elegant and fast solutions than having all keywords from a language recorded in your mind.&lt;/p&gt;

&lt;h2&gt;The Exercise Lists&lt;/h2&gt;

&lt;p&gt;During the first part of the program, three exercise lists are assigned, for helping us practice our programming skills. These lists are intentionally more advanced that the topics given, this is done in order to make students really search for solutions and interact to each other to figure out how to make things work.&lt;/p&gt;

&lt;h2&gt;The Project&lt;/h2&gt;

&lt;p&gt;Now this is where the course really gets interesting. In the middle of discipline, they shift focus the the discipline project, which is to be developed by teams of two students.&lt;/p&gt;

&lt;p&gt;They present us with a project (the class has around 50 members) and each team has to develop and deliver that project within a month, trying to make everything as smart and easy-to-understand-and-maintain as possible.&lt;/p&gt;

&lt;p&gt;The project not only helps students really grasp the workings of Software Development but they also help us develop collaboration skills, which is great for any programmer.&lt;/p&gt;

&lt;h2&gt;Wrapping up&lt;/h2&gt;

&lt;p&gt;I think the approach at CIn is fairly reasonable except for the written exams. And everything else is very realistic, stimulating and engaging.&lt;/p&gt;

&lt;p&gt;So, what do you think of the approach at CIn/UFPE? How do they teach programming at your University?&lt;/p&gt;

&lt;p&gt;You can &lt;a href=&quot;http://news.ycombinator.com/item?id=5302042&quot;&gt;join the discussion&lt;/a&gt; on Hacker News.&lt;/p&gt;
</content>
   <author>
     <name>Rodrigo Alves Vieira</name>
     <uri>http://www.rodrigoalvesvieira.com/about</uri>
   </author>
 </entry>
 
 <entry>
   <title>Startup Validation Questions</title>
   <link href="http://www.rodrigoalvesvieira.com/startup-questions"/>
   <updated>2013-01-09T00:00:00-08:00</updated>
   <id>http://www.rodrigoalvesvieira.com/startup-questions</id>
   <content type="html">&lt;p&gt;&lt;span class=&quot;drops&quot;&gt;I&lt;/span&gt;t&amp;rsquo;s a very tough to determine wheter a product/startup idea is feasible or really interesting or not. There are many ways to increase the chance of success and many ways to measure growth and market acceptance. But before all of these, I think one should consider asking oneselves some questios about one&amp;rsquo;s idea. I&amp;rsquo;ve collected some questions in books and other blog posts and put them all here for future consulting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Is it something customers want?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What problem are you solving?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can it be solved?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Whose problem is it?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Will they pay for it?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How hard would it be for another company to copy you?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Why are you able to produce and deliver it more than anybody else?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How hard is it to acquire a customer?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Are your customers coming back or attracting more customers?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</content>
   <author>
     <name>Rodrigo Alves Vieira</name>
     <uri>http://www.rodrigoalvesvieira.com/about</uri>
   </author>
 </entry>
 
 <entry>
   <title>Comments Are Important to Your Code and Team</title>
   <link href="http://www.rodrigoalvesvieira.com/comments"/>
   <updated>2012-11-12T00:00:00-08:00</updated>
   <id>http://www.rodrigoalvesvieira.com/comments</id>
   <content type="html">&lt;p&gt;&lt;span class=&quot;drops&quot;&gt;I&lt;/span&gt;&amp;rsquo;ve spent a great deal of time thinking that comments are a superfluous thing in a code base. I used to believe that any code can be succinct and well-written enough that it become obvious for any programmer to figure out what it does.&lt;/p&gt;

&lt;p&gt;That is incorrect for the choice of documenting or not is not about aesthetics, it&amp;rsquo;s about &lt;strong&gt;communication&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Any arguably large software will be developed for several months or even a couple years with changing teams. Not having the critical parts pragmatically documented by comments in the code may increase the chances of misunderstandings and misleading assumptions.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/images/Ancientlibraryalex.jpg&quot; title=&quot;The Ancient Library of Alexandria&quot; alt=&quot;The Ancient Library of Alexandria&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image_caption&quot;&gt;The Ancient Library of Alexandria&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;You &lt;strong&gt;should not&lt;/strong&gt; deliberately document your code. Having tons of comments for the sake of having them is going to hurt you. Don&amp;rsquo;t forget that once you add comments to your functions and classes, you should maintain it just like the code itself.&lt;/p&gt;

&lt;p&gt;The following code is a good example of documentation done in a very straighforward way:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;# This method is designed to perform select by a single column as direct SQL query&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Returns Array with values of the specified column name&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# The values has same data type as column.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Examples:&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#   Person.pluck(:id) # SELECT people.id FROM people&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#   Person.uniq.pluck(:role) # SELECT DISTINCT role FROM people&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#   Person.where(:confirmed =&amp;gt; true).limit(5).pluck(:id)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pluck&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;column_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;column_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;column_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_s&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;klass&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;select_all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;column_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;map!&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;attributes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;klass&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;type_cast_attribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;attributes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;keys&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;first&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;klass&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;initialize_attributes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;attributes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;In the example above (&lt;a href=&quot;https://github.com/rails/rails/blob/f8f4ac91203506c94d547ee0ef530bd60faf97ed/activerecord/lib/active_record/relation/calculations.rb&quot;&gt;extracted from ActiveRecord&lt;/a&gt;) the comments are totally appropriate. They do not provide useless and duplicated information. In fact, they are essencial to the understanding of the code that it describes.&lt;/p&gt;

&lt;p&gt;Conscious selection of what has to be documented and what need not to be is essential for your code base. Also, you should use automated tools with good markup options for generating documentation. There are many tools that do it well such as YUIDoc for JavaScript and RDoc for Ruby.&lt;/p&gt;

&lt;p&gt;I believe that in special cases, documentation is as important as testing. The special cases are represented by some critical parts of our code base, such as calculation functions and vector graphic generators.&lt;/p&gt;

&lt;p&gt;Many of the problems that occur to Software Development come from communication failure. Your code is probably never expressive enough. By using simple, straightforward comments to describe the behaviour of our code we can prevent bad stuff from happening as well as helping new developers grasp the functionality of the software better and making development easier and occasionally faster.&lt;/p&gt;

&lt;p&gt;Thanks to Bruno Coelho for reviewing this article.&lt;/p&gt;
</content>
   <author>
     <name>Rodrigo Alves Vieira</name>
     <uri>http://www.rodrigoalvesvieira.com/about</uri>
   </author>
 </entry>
 
 <entry>
   <title>Learn a Programming Language Faster by Copying Unix</title>
   <link href="http://www.rodrigoalvesvieira.com/copy-unix"/>
   <updated>2012-11-03T00:00:00-07:00</updated>
   <id>http://www.rodrigoalvesvieira.com/copy-unix</id>
   <content type="html">&lt;p&gt;&lt;span class=&quot;drops&quot;&gt;R&lt;/span&gt;eading books is great, reading other people&amp;rsquo;s code is great but no other technique is more efficient for those trying to learn a new programming language than actually &lt;strong&gt;writing&lt;/strong&gt; code.&lt;/p&gt;

&lt;p&gt;That said, I&amp;rsquo;m making a suggestion here: copy Unix.&lt;/p&gt;

&lt;h2&gt;How? Gimme a hint.&lt;/h2&gt;

&lt;p&gt;Suppose you&amp;rsquo;re learning Python, you should try to build a copy of the &lt;strong&gt;cat&lt;/strong&gt; program with it or try to implement &lt;strong&gt;tree&lt;/strong&gt;, for example.&lt;/p&gt;

&lt;p&gt;Unix programs are often small and focused on doing something unique and doing it very well (&lt;a href=&quot;http://en.wikipedia.org/wiki/Unix_philosophy&quot;&gt;read more&lt;/a&gt; about the concept), which is also ideal for learning to program. Just pick up a single problem and solve it in the best way possible.&lt;/p&gt;

&lt;p&gt;Chris Wanstrath &lt;a href=&quot;http://ozmm.org/posts/time_in_irb.html&quot;&gt;has an example&lt;/a&gt; of it from long ago.&lt;/p&gt;

&lt;p&gt;Reproducing these tiny programs in your language of choice has the amazing benefit of helping you learn about the classes and functions of that language.&lt;/p&gt;

&lt;p&gt;Have this for an example:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#!/usr/bin/env ruby&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Reproducing cat in Ruby would be as simple as this:&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;ARGV&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Although virtually doable with any programming language, this technique works even better if you&amp;rsquo;re learning a scripting language like Ruby or Python. Or even JavaScript with Node.js.&lt;/p&gt;

&lt;p&gt;As developers we always need to learn things. I think small habits like this can make a difference.&lt;/p&gt;

&lt;p&gt;You can &lt;a href=&quot;http://news.ycombinator.com/item?id=4736830&quot;&gt;join the discussion&lt;/a&gt; on Hacker News.&lt;/p&gt;
</content>
   <author>
     <name>Rodrigo Alves Vieira</name>
     <uri>http://www.rodrigoalvesvieira.com/about</uri>
   </author>
 </entry>
 
 <entry>
   <title>Web Inspector and Firebug element selection trick</title>
   <link href="http://www.rodrigoalvesvieira.com/inspector-firebug"/>
   <updated>2012-11-01T00:00:00-07:00</updated>
   <id>http://www.rodrigoalvesvieira.com/inspector-firebug</id>
   <content type="html">&lt;p&gt;&lt;span class=&quot;drops&quot;&gt;S&lt;/span&gt;o you are inspecting elements via the Web Inspector on Chrome/Safari or the Firebug on Firefox and you wanna play with those elements you just selected in the console.&lt;/p&gt;

&lt;p&gt;Normally what you&amp;rsquo;d do is record the element&amp;rsquo;s class name or id and use jQuery (let&amp;rsquo;s assume you&amp;rsquo;re using jQuery for brevity&amp;rsquo;s sake) to select it, like this:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;.github-logo-4x-hover&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;But here&amp;rsquo;s a nice trick to speed this up for you. In both Web Inspector and Firebug you&amp;rsquo;re allowed to refer to a few previously selected elements with the aliases &lt;span class=&quot;small_code&quot;&gt;$0&lt;/span&gt;, &lt;span class=&quot;small_code&quot;&gt;$1&lt;/span&gt;, &lt;span class=&quot;small_code&quot;&gt;$2&lt;/span&gt;, &lt;span class=&quot;small_code&quot;&gt;$3&lt;/span&gt; and &lt;span class=&quot;small_code&quot;&gt;$4&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;See the example:&lt;/p&gt;

&lt;p&gt;Here I select the element:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.rodrigoalvesvieira.com/public/images/element_selection.png&quot;&gt;&lt;img src=&quot;/public/images/element_selection.png&quot; title=&quot;Selecting an element on the Web Inspector&quot; alt=&quot;Selecting an element on the Web Inspector&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now it can be accessed via the Console through the &lt;span class=&quot;small_code&quot;&gt;$0&lt;/span&gt; variable:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.rodrigoalvesvieira.com/public/images/element_selection1.png&quot;&gt;&lt;img src=&quot;/public/images/element_selection1.png&quot; title=&quot;Fetching the last selected element on the Web Inspector&quot; alt=&quot;Fetching the last selected element on the Web Inspector&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;small_code&quot;&gt;$0&lt;/span&gt; exactly corresponds the last selected element. &lt;span class=&quot;small_code&quot;&gt;$1&lt;/span&gt;, &lt;span class=&quot;small_code&quot;&gt;$2&lt;/span&gt;, &lt;span class=&quot;small_code&quot;&gt;$3&lt;/span&gt; and &lt;span class=&quot;small_code&quot;&gt;$4&lt;/span&gt; correspond to the other previously selected elements in reverse order.&lt;/p&gt;

&lt;p&gt;jQuery, for example, can deal with these variables just well:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;You have clicked it!&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This is a simple trick, but can really help us during our day-to-day software craftsmanship.&lt;/p&gt;
</content>
   <author>
     <name>Rodrigo Alves Vieira</name>
     <uri>http://www.rodrigoalvesvieira.com/about</uri>
   </author>
 </entry>
 
 <entry>
   <title>OpenStruct for rapid object prototyping in Ruby</title>
   <link href="http://www.rodrigoalvesvieira.com/openstruct"/>
   <updated>2012-10-18T00:00:00-07:00</updated>
   <id>http://www.rodrigoalvesvieira.com/openstruct</id>
   <content type="html">&lt;p&gt;&lt;span class=&quot;drops&quot;&gt;W&lt;/span&gt;hat if we can quickly build custom data structures and prototype them with no effort? Ruby&amp;rsquo;s &lt;span class=&quot;small_code&quot;&gt;OpenStruct&lt;/span&gt; class is here to help.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;ostruct&amp;quot;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;car&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;OpenStruct&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;ss&quot;&gt;brand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Ford&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Phusion&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;ss&quot;&gt;year&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2013&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;owner_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The &lt;a href=&quot;http://rubyquicktips.com/post/1718141794/use-openstruct-for-application-configuration-variables&quot;&gt;Ruby Quicktips&lt;/a&gt; blog has another good example on how we can use it for app configuration variables.&lt;/p&gt;

&lt;p&gt;Jake Scruggs &lt;a href=&quot;http://jakescruggs.blogspot.com.br/2007/03/using-openstruct-to-enhance-your-mocks.html&quot;&gt;has also&lt;/a&gt; made a point about using &lt;span class=&quot;small_code&quot;&gt;OpenStruct&lt;/span&gt; for mocking.&lt;/p&gt;

&lt;p&gt;&lt;figure&gt;
  &lt;img src=&quot;/public/images/abandoned_train.jpeg&quot; title=&quot;Abandoned train&quot; alt=&quot;Abandoned train&quot; /&gt;
&lt;/figure&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image_caption&quot;&gt;Abandoned train&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;I believe this class is more for rapid prototyping purposes. &lt;span class=&quot;small_code&quot;&gt;OpenStruct&lt;/span&gt; is &lt;a href=&quot;http://stackoverflow.com/questions/1177594/ruby-struct-vs-openstruct&quot;&gt;demonstrably slower&lt;/a&gt; than &lt;span class=&quot;small_code&quot;&gt;Struct&lt;/span&gt; and probably not very reliable to go for production code.&lt;/p&gt;

&lt;p&gt;More bad news about it is that it is not as extensible as &lt;span class=&quot;small_code&quot;&gt;Struct&lt;/span&gt;. There is no way for adding methods to it as it relies solely of the &lt;span class=&quot;small_code&quot;&gt;OpenStruct&lt;/span&gt; class itself.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;small_code&quot;&gt;OpenStruct&lt;/span&gt; is one of Ruby&amp;rsquo;s proof of its own simplicity and dynamism. Hashes that behave like classes? That&amp;rsquo;s definitely cool.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;small_code&quot;&gt;OpenStruct&lt;/span&gt; is Ruby&amp;rsquo;s metaprogramming magic all across the pond.&lt;/p&gt;

&lt;p&gt;Have an opinion about this article? &lt;a href=&quot;https://news.ycombinator.com/item?id=5366968&quot;&gt;Discuss on Hacker News&lt;/a&gt;.&lt;/p&gt;
</content>
   <author>
     <name>Rodrigo Alves Vieira</name>
     <uri>http://www.rodrigoalvesvieira.com/about</uri>
   </author>
 </entry>
 
</feed>