<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>hltbra's blog</title>
 <link href="https://blog.hltbra.net/atom.xml" rel="self"/>
 <link href="https://blog.hltbra.net"/>
 <updated>2019-02-08T11:06:26-05:00</updated>
 <id>https://blog.hltbra.net</id>
 <author>
   <name>Hugo Lopes Tavares</name>
   <email>hltbra@gmail.com</email>
 </author>

 
 <entry>
   <title>How I've dealt with pain from too much typing</title>
   <link href="https://blog.hltbra.net/2019/02/07/how-ive-dealt-with-pain-from-too-much-typing.html"/>
   <updated>2019-02-07T00:00:00-05:00</updated>
   <id>hhttps://blog.hltbra.net/2019/02/07/how-ive-dealt-with-pain-from-too-much-typing</id>
   <content type="html">&lt;p&gt;I started using computers when I was ten years old, and since then I’ve spent many hours on a computer, typing, every day.
I used to type very fast, but I never learned how to type correctly. Most people type incorrectly like and it puts a lot of stress on their fingers, wrists, and forearms. I’ve experienced pain in my fingers, wrists, forearm and I knew it was because of keyboard overuse but I never paid much attention to that because it was mild and wouldn’t happen too often. These symptoms, in my context, indicated I was suffering from a &lt;a href=&quot;https://en.wikipedia.org/wiki/Repetitive_strain_injury&quot;&gt;Repetitive Strain Injury (RSI)&lt;/a&gt;. The term Repetitive Motion Injury (RMI) and RSI are used interchangeably.&lt;/p&gt;

&lt;p&gt;In 2014 I started to have tightness and mild pain in my forearms regularly. I woke up in the middle of the night a couple of times with my forearms cramping, and I had to stretch immediately to get relief and go back to sleep. After one terrible night, I woke up and I couldn’t get into typing position because my forearms would get cramps; I had to miss work that day. After that day, I decided to do some research and see what other people had done to treat RSI.&lt;/p&gt;

&lt;h2 id=&quot;immediate-relief&quot;&gt;Immediate relief&lt;/h2&gt;

&lt;p&gt;The first and more obvious thing to do when you are in pain is to stop the pain. In my case, I had to stop typing for a couple of days and take regular breaks after I returned to typing. I also incorporated some stretches that I did every hour. I took Ibuprofen to reduce the discomfort too (it doesn’t help to heal the tissue, it only reduces inflammation but that gave me relief). I ended up buying a pair of wrist braces to fix my wrist position and reduce stress when I moved my hands; I wore them at work and at home.&lt;/p&gt;

&lt;p&gt;I bought the &lt;a href=&quot;https://amzn.to/2GrDCfW&quot;&gt;Mueller Green Fitted Wrist Brace&lt;/a&gt; (watch out because the &lt;a href=&quot;https://amzn.to/2GrDCfW&quot;&gt;left&lt;/a&gt; and &lt;a href=&quot;https://amzn.to/2t7ZOUk&quot;&gt;right&lt;/a&gt; are sold separately):&lt;/p&gt;

&lt;p&gt;&lt;img alt=&quot;front picture&quot; src=&quot;https://images-na.ssl-images-amazon.com/images/I/8102Yc4qwDL._SL1500_.jpg&quot; style=&quot;height:250px; display: inline; margin-right:50px&quot; /&gt;
&lt;img alt=&quot;back picture&quot; src=&quot;https://images-na.ssl-images-amazon.com/images/I/61W9uCSm0lL._SL1500_.jpg&quot; style=&quot;height:250px; display: inline&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;typing-correctly-with-the-kinesis-advantage-keyboard&quot;&gt;Typing correctly with the Kinesis Advantage keyboard&lt;/h2&gt;

&lt;p&gt;I realized I’ve had typed incorrectly my whole life – that means that I didn’t use the “correct” finger for each key on my keyboard. I needed to learn how to type correctly, and a great way to force myself was by buying a split keyboard (the keyboard is split in half so you can’t use the right hand to type on the left half of the keyboard and vice versa).&lt;/p&gt;

&lt;p&gt;After some research, I bought an ergonomic keyboard that has helped my RSI tremendously and I recommend it highly. It took me more over a month to get used to it and type with a comfortable speed. It’s been almost five years since the last time I had bad RSI symptoms, and I attribute most of it to my Kinesis Advantage Keyboard. It helps with your hand position and prevents you from typing incorrectly because each key has a different height – the key heights match the correct finger lengths; the deeper the key, the longer the finger that’s supposed to press that key.&lt;/p&gt;

&lt;p&gt;I bought the &lt;a href=&quot;https://amzn.to/2Ge1qo1&quot;&gt;Kinesis Advantage&lt;/a&gt; keyboard:&lt;/p&gt;

&lt;p&gt;&lt;img alt=&quot;Kinesis Advantage keyboard&quot; src=&quot;https://images-na.ssl-images-amazon.com/images/I/41HqsVDtDuL.jpg&quot; style=&quot;height:300px; margin-left:0;&quot; /&gt; &lt;/p&gt;

&lt;p&gt;I have the first model but there’s a newer version, the &lt;a href=&quot;https://amzn.to/2WLvk8c&quot;&gt;Kinesis Advantage 2&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I haven’t changed much of the key bindings and kept it as QWERTY. I re-mapped the &lt;em&gt;Caps Lock&lt;/em&gt; key to be &lt;em&gt;Control&lt;/em&gt;, enabled Mac OS compatibility (&lt;em&gt;Control&lt;/em&gt; becomes &lt;em&gt;Command&lt;/em&gt; and &lt;em&gt;Alt&lt;/em&gt; becomes &lt;em&gt;Option&lt;/em&gt;), and enabled and &lt;a href=&quot;https://superuser.com/a/403765/216965&quot;&gt;media keys&lt;/a&gt; (&lt;em&gt;F3&lt;/em&gt; is &lt;em&gt;Previous&lt;/em&gt;, &lt;em&gt;F4&lt;/em&gt; is &lt;em&gt;Play/Pause&lt;/em&gt;, &lt;em&gt;F5&lt;/em&gt; is &lt;em&gt;Next&lt;/em&gt;). The mappings are in the firmware, not software, which is great because the keyboard works the same way on any device it’s connected to.&lt;/p&gt;

&lt;p&gt;The keyboard cost $350 but it was worth the investment. I asked my employer to pay for it and they were happy to do so. I bought a used one on eBay for my home office too.&lt;/p&gt;

&lt;p&gt;I have friends that bought other mechanical keyboards and are pain-free, so if you’re too afraid of the Kinesis Advantage, there are hundreds of other options out there, but I’d focus on &lt;em&gt;ergonomic mechanical keyboards&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;mouse-vs-trackpad&quot;&gt;Mouse vs. Trackpad&lt;/h2&gt;

&lt;p&gt;I also switched from using a mouse to a trackpad. I noticed that with the mouse I stressed my wrists because I moved too much (bending left and right all the time). I then tried a trackpad and noticed I don’t move my wrists as much because of the limited surface area, so I kept the trackpad. My home trackpad broke recently and I’ve been using a mouse at home (I don’t use computers at home that much).&lt;/p&gt;

&lt;h2 id=&quot;exercises&quot;&gt;Exercises&lt;/h2&gt;

&lt;p&gt;There are some stretches you can do for relief and some forearm strengthening exercises for prevention, do your research but I’ve found that all variations of a wrist stretch worked for me but wrist flexion made it worse.&lt;/p&gt;

&lt;figure style=&quot;margin-bottom: 10px;&quot;&gt;
    &lt;a alt=&quot;wrist stretches and exercises&quot; target=&quot;_blank&quot; href=&quot;http://transcribeme.com/wp-content/uploads/2016/01/55ab8db96291ff7b4652902c2808f31a.jpg.gif&quot;&gt;
        &lt;img src=&quot;http://transcribeme.com/wp-content/uploads/2016/01/55ab8db96291ff7b4652902c2808f31a.jpg.gif&quot; style=&quot;height: 500px; margin-left: 0;&quot; /&gt;
    &lt;/a&gt;
    &lt;figcaption style=&quot;font-size: 90%; color: #6c757d; text-align: left;&quot;&gt;Source: &lt;a target=&quot;_blank&quot; href=&quot;https://www.transcribeme.com/blog/how-to-prevent-repetitive-motion-injuries-with-transcription&quot;&gt;https://www.transcribeme.com/blog/how-to-prevent-repetitive-motion-injuries-with-transcription&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;And in regards to forearm strengthening, I’ve been doing &lt;a href=&quot;https://stronglifts.com/deadlift/&quot;&gt;deadlifts&lt;/a&gt; and &lt;a href=&quot;https://stronglifts.com/pullups/&quot;&gt;pull-ups&lt;/a&gt; since 2013. Although they are not isolated exercises, over time they strengthen your grip &amp;amp; forearms.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://stronglifts.com/deadlift/&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;deadlift grip&quot; src=&quot;https://cdn.stronglifts.com/wp-content/uploads/deadlift-mixed-grip.jpg&quot; style=&quot;display:inline-block; width: 500px;&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;https://stronglifts.com/pullups/&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;chin-up and pull-up&quot; src=&quot;https://cdn.stronglifts.com/wp-content/uploads/pullup-vs-chinup.jpg&quot; style=&quot;display:inline-block; width: 500px&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;If you have RSI symptoms, do some research and pay attention to how you type, maybe just typing correctly is enough. I highly recommend you to buy an ergonomic mechanical keyboard and avoid typing on laptop keyboards at all costs.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Personal Finance 101</title>
   <link href="https://blog.hltbra.net/2019/02/04/personal-finance.html"/>
   <updated>2019-02-04T00:00:00-05:00</updated>
   <id>hhttps://blog.hltbra.net/2019/02/04/personal-finance</id>
   <content type="html">&lt;p&gt;The first time I remember getting a recommendation about a personal finance book was in 2012, from my Airbnb host &lt;a href=&quot;https://twitter.com/bonesrodriguez&quot;&gt;Bones Rodriguez&lt;/a&gt;. He recommended me to read the book Rich Dad Poor Dad, which I had heard about before but never paid attention to. I grew up in a poor family in Brazil, my parents didn’t know much about money, they knew about the basics such as compound interest, never spent more than you earn, don’t get in debt, but not anything about the stock market, bonds, assets vs liabilities, etc; I heard to learn everything as an adult many years after I started working.&lt;/p&gt;

&lt;p&gt;In 2013 moved to the USA and here most savings accounts are garbage, they’re not a means to invest money, so I decided to learn more about personal finance at the end of the year and picked up a copy of the book Rich Dad Poor Dad. I loved the book and read The Cashflow Quadrant after that (same author). I learned terminology about how “the rich” think (he stories in the book are great but the author seems to be shady in real life). I learned many lessons and eventually found other books, blogs, podcasts, and that’s what I want to share with this post.&lt;/p&gt;

&lt;p&gt;If you don’t know the basics of personal finance, you are in debt, or you don’t know what to do with the extra money you’re saving, do yourself a favor and get educated. The tech industry pays a lot of money and you’ll have to learn how to best use that money. The following resources have helped me and may help you too.&lt;/p&gt;

&lt;h3 id=&quot;books&quot;&gt;Books&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://amzn.to/2UGjD0F&quot;&gt;Rich Dad Poor Dad&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://amzn.to/2GlbZ8e&quot;&gt;The Cashflow Quadrant&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://amzn.to/2WEM1SJ&quot;&gt;The Bogleheads Guide to Investing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://amzn.to/2t6bSpm&quot;&gt;The Simple Path to Wealth&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;blogs&quot;&gt;Blogs&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.madfientist.com&quot;&gt;The Mad FIentist&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.mrmoneymustache.com&quot;&gt;Mr. Money Mustache&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://jlcollinsnh.com&quot;&gt;jlcollinsnh&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;subreddits&quot;&gt;Subreddits&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://reddit.com/r/personalfinance&quot;&gt;r/personalfinance&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://reddit.com/r/financialindependence&quot;&gt;r/financialindependence&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;podcasts-available-on-itunes-and-stitcher&quot;&gt;Podcasts (available on iTunes and Stitcher)&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.madfientist.com/podcast&quot;&gt;The Mad FIentist&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.choosefi.com/podcast-episodes/&quot;&gt;Choose FI&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.radicalpersonalfinance.com/&quot;&gt;Radical Personal Finance&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>How I got into Powerlifting</title>
   <link href="https://blog.hltbra.net/2014/06/15/how-i-got-into-powerlifting.html"/>
   <updated>2014-06-15T00:00:00-04:00</updated>
   <id>hhttps://blog.hltbra.net/2014/06/15/how-i-got-into-powerlifting</id>
   <content type="html">&lt;p&gt;Can Programmers be Powerlifters? Of course! Two years ago I have never had a gym membership and was pretty much a sedentary; I played basketball in high school and once in a while with friends in Rio de Janeiro.&lt;/p&gt;

&lt;p&gt;After I started dating my wife I started working out in a gym near Globo.com and I thought I was doing everything alright… Until I moved to the USA and started studying more about the subject.&lt;/p&gt;

&lt;h3 id=&quot;look-good-and-be-healthy&quot;&gt;Look good and be healthy&lt;/h3&gt;

&lt;p&gt;I worked out in a commercial gym in Rio de Janeiro for 8 months, saw some progress, but I was not happy with it. The instructors didn’t pay close attention to my program neither my progress, but I had them as a resource and thought that I should rely on them - but they have never asked me about my nutrition to begin with!&lt;/p&gt;

&lt;p&gt;My training was pretty much a &lt;a href=&quot;http://www.urbandictionary.com/define.php?term=bro%20split&quot;&gt;“bro split”&lt;/a&gt;, where you isolate muscle groups in separate days, and the focus is physique. My gym only had machines and light dumbells, and I worked out 5 times a week. I knew I was not pushing myself to my limits, and thus my workouts were suboptimal.&lt;/p&gt;

&lt;p&gt;I wanted to look good and be healthy, and I realized that in order to do so, I need to get more knowledge on the subject by myself, and learn more about nutrition. That’s how I found strength training.&lt;/p&gt;

&lt;h3 id=&quot;strength-training&quot;&gt;Strength Training&lt;/h3&gt;

&lt;p&gt;I started researching and found &lt;a href=&quot;http://stronglifts.com&quot;&gt;StrongLifts&lt;/a&gt;, a strength training routine, based on compound lifts, and that consisted of &lt;em&gt;only 3 lifts a day, and only 3 times a week!&lt;/em&gt; That was a dream, because you go to the gym three times a week and do your best every day you go, and you are very focused - after all, you do only 3 exercises a day. One more nice thing is that you use linear progression, that means that every workout you are lifting heavier weights than the last workout.&lt;/p&gt;

&lt;p&gt;I did StrongLifts for 12 weeks, and it was a very good progress. I also read the book &lt;a href=&quot;http://www.amazon.com/gp/product/0982522738/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0982522738&amp;amp;linkCode=as2&amp;amp;tag=hugosblog-20&quot;&gt;Starting Strength&lt;/a&gt; and paid a lot of attention to my lifting form to get the most out of my workouts and to avoid injuries. I posted my progress (with before &amp;amp; after pics) on reddit after those 12 weeks: &lt;a href=&quot;http://www.reddit.com/r/Fitness/comments/1nkvsr/m216_159lbs176lbs_12_weeks_after_doing_sl/&quot;&gt;http://www.reddit.com/r/Fitness/comments/1nkvsr/m216_159lbs176lbs_12_weeks_after_doing_sl/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After finishing those 12 weeks, I started doing a similar program created by Mark Rippetoe: &lt;a href=&quot;http://www.amazon.com/gp/product/0982522738/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0982522738&amp;amp;linkCode=as2&amp;amp;tag=hugosblog-20&quot;&gt;Starting Strength&lt;/a&gt;. The main difference between the two programs is that Starting Strength use 3 sets, and has Power Cleans rather than Barbell Rows. The book &lt;a href=&quot;http://www.amazon.com/gp/product/0982522738/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0982522738&amp;amp;linkCode=as2&amp;amp;tag=hugosblog-20&quot;&gt;Starting Strength&lt;/a&gt;, written by Mark Rippetoe, is an amazing resource that is going to teach you all the glory details of each movement, muscle, position, everything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: I posted my 1 year transformation to r/fitness: &lt;a href=&quot;http://www.reddit.com/r/Fitness/comments/29gvnz/1_year_progress_159lb_to_190lb_with_progress_pics/&quot;&gt;http://www.reddit.com/r/Fitness/comments/29gvnz/1_year_progress_159lb_to_190lb_with_progress_pics/&lt;/a&gt;&lt;/p&gt;

&lt;h4 id=&quot;stronglifts&quot;&gt;StrongLifts&lt;/h4&gt;

&lt;p&gt;&lt;a href=&quot;http://stronglifts.com&quot;&gt;StrongLifts&lt;/a&gt; is basically split in A and B routines, 3 times a week, with a rest day between them (I did Monday, Wednesday, and Friday). Routine:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A (sets x repetitions)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Squat: 5x5&lt;/li&gt;
  &lt;li&gt;Bench Press: 5x5&lt;/li&gt;
  &lt;li&gt;Barbell Rows: 5x5&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;B (sets x repetitions)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Squat: 5x5&lt;/li&gt;
  &lt;li&gt;Overhead Press: 5x5&lt;/li&gt;
  &lt;li&gt;Deadlift: 1x5&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every workout you should increase 5lb to each lift, and keep this linear progression for as long as you can - that’s pretty much the program. For more details visit the official &lt;a href=&quot;http://stronglifts.com&quot;&gt;StrongLifts website&lt;/a&gt;.&lt;/p&gt;

&lt;h4 id=&quot;starting-strength&quot;&gt;Starting Strength&lt;/h4&gt;

&lt;p&gt;After doing SL for 12 weeks, I felt that I should do Starting Strength and keep the linear progression, because it was less volume, meaning that you could keep linear progression for a little longer. As Rippetoe puts in the book, everyone makes great progress in the first 3 months, because you are a “novice” and your body recovers and progress very easily. After the novice phase it’s a little bit harder to progress, but still very possible. It’s known of people that do SS for years and still progress.&lt;/p&gt;

&lt;p&gt;This program is also based on A and B days, with a rest day between workout days (I do Monday, Wednesy, Friday):&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A (sets x repetitions)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Squat: 3x5&lt;/li&gt;
  &lt;li&gt;Overhead Press: 3x5&lt;/li&gt;
  &lt;li&gt;Deadlift: 1x5&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;B (sets x repetitions)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Squat: 3x5&lt;/li&gt;
  &lt;li&gt;Bench Press: 3x5&lt;/li&gt;
  &lt;li&gt;Power Clean: 5x3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The program has Power Clean, a very complex movement, and very hard to master. It took me months to learn how to do a proper Power Clean, but there is no known replacement for that exercise.&lt;/p&gt;

&lt;p&gt;Redditors love Starting Strength, and that was one of the reasons that I started doing it. Besides the great book, I would like to have community support with the program.&lt;/p&gt;

&lt;h3 id=&quot;what-is-powerlifting&quot;&gt;What is Powerlifting&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Powerlifting&quot;&gt;Powerlifting&lt;/a&gt; is a strength sport, consisting of three movements: Squat, Bench Press, and Deadlift. The goal is to lift the maximum amount of weight in each of the lifts. Sometimes Powerlifting is confused with &lt;a href=&quot;http://en.wikipedia.org/wiki/Olympic_weightlifting&quot;&gt;Olympic Weightlifting&lt;/a&gt;, but the latter consists of Snatch and Clean &amp;amp; Jerk (two complete different movement from the ones in powerlifting).&lt;/p&gt;

&lt;h3 id=&quot;how-i-got-into-powerlifting&quot;&gt;How I got into Powerlifting&lt;/h3&gt;

&lt;p&gt;After doing strength training for months, reading about it, watching lots of videos about it, I decided that I should compete and see how it goes. I knew I was not super strong, but I was good to compete for the fun and experience.&lt;/p&gt;

&lt;p&gt;I talked to my wife about it, and she told me that I should attend to a meet - but I thought she meant that I should &lt;em&gt;compete&lt;/em&gt; in a powerlifting meet! - and I started looking for competitions close to New York.&lt;/p&gt;

&lt;p&gt;I was searching &lt;a href=&quot;http://www.powerliftingwatch.com/&quot;&gt;Powerlifting Watch&lt;/a&gt; and I found there was a meet in Ronkonkoma, New York, in the next months, then I decided that I was going to compete. I joined the &lt;a href=&quot;http://ipapower.com/&quot;&gt;IPA federation&lt;/a&gt; (the federation responsible for the meet), and got my meet entry later.&lt;/p&gt;

&lt;p&gt;I changed my programming to get my deadlift and bench press better. I wrote a detailed meet report at r/weightroom: &lt;a href=&quot;http://www.reddit.com/r/weightroom/comments/2646gc/meet_report_2014_ipa_new_york_grand_prix/&quot;&gt;http://www.reddit.com/r/weightroom/comments/2646gc/meet_report_2014_ipa_new_york_grand_prix/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My best attemps were:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Squat: 355lb&lt;/li&gt;
  &lt;li&gt;Bench Press: 205lb&lt;/li&gt;
  &lt;li&gt;Deadlift: 400lb&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Video: &lt;a href=&quot;https://www.youtube.com/watch?v=hJOVwpAzZyI&quot;&gt;https://www.youtube.com/watch?v=hJOVwpAzZyI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I had a great time and I recommend it to everyone that does strength training and is not sure if they should compete. Go for it!&lt;/p&gt;

&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;I love strength training because it’s very easy to measure progress - if you are lifting more, you are progressing, otherwise you are not -, and you are not doing 10 exercises every time you go to the gym. And even doing strength based training, you still grow a lot of real muscle, not just get swolen.&lt;/p&gt;

&lt;h3 id=&quot;resources&quot;&gt;Resources&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/0982522738/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0982522738&amp;amp;linkCode=as2&amp;amp;tag=hugosblog-20&quot;&gt;Starting Strength book&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://stronglifts.com&quot;&gt;StrongLifts&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.reddit.com/r/fitness&quot;&gt;r/fitness&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.reddit.com/r/weightroom&quot;&gt;r/weightroom&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/user/CanditoTrainingHQ&quot;&gt;Candito Training HQ&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/user/OmarIsuf/&quot;&gt;Omar Isuf&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/user/strengthcamp/&quot;&gt;StrengthCamp (Elliot Hulse)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/user/sanfranciscocrossfit/&quot;&gt;MobilityWOD (Kelly Starret)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/user/RyanSaplanPT/&quot;&gt;Ryan Saplan&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>Don't Repeat Yourself (DRY) and Testing</title>
   <link href="https://blog.hltbra.net/2013/04/08/dry-and-testing.html"/>
   <updated>2013-04-08T00:00:00-04:00</updated>
   <id>hhttps://blog.hltbra.net/2013/04/08/dry-and-testing</id>
   <content type="html">&lt;p&gt;At &lt;a href=&quot;http://globo.com&quot;&gt;globo.com&lt;/a&gt; my team is responsible for live video streaming infrastructure, and we have a huge infrastructure with &lt;em&gt;lots&lt;/em&gt; of projects.&lt;/p&gt;

&lt;p&gt;One of our projects is &lt;a href=&quot;http://premierefc.com&quot;&gt;PremiereFC’s&lt;/a&gt; website, where we live stream brazilian soccer games.&lt;/p&gt;

&lt;p&gt;PremiereFC is written in Python + Tornado + MongoDB, the project is not complex and we have great test suites. It seems perfect.&lt;/p&gt;

&lt;p&gt;We did not touch the project for months, and some months ago we needed to adapt it to embrace new championships and other stuff.
My colleague &lt;a href=&quot;http://about.me/flavioribeiro&quot;&gt;Flávio Ribeiro&lt;/a&gt; started running the current tests against our QA1 environment. For his surprise &lt;strong&gt;some tests were broken&lt;/strong&gt;! Can you believe it? Nobody touch the project and &lt;em&gt;BOOM&lt;/em&gt;, some tests are failing.&lt;/p&gt;

&lt;p&gt;He started digging into the tests to find out what happened, and unfortunately he could not understand easily what was happening.&lt;/p&gt;

&lt;p&gt;WHY? Our conclusion is that we have lots and lots of test helpers…&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;I started to draft this post in the end of 2012, but I’ve forgotten to publish it.&lt;/em&gt;&lt;/p&gt;

&lt;h2 id=&quot;testing-and-test-helpers&quot;&gt;Testing and Test Helpers&lt;/h2&gt;

&lt;p&gt;We do love &lt;a href=&quot;http://en.wikipedia.org/wiki/Test-driven_development&quot;&gt;Test-Driven Development&lt;/a&gt;, and we have lots of unit, functional, and integration tests. As we do not like repeating ourselves,
creating abstractions around our repeated tests seems obvious, and we started doing it in the beginning of PremiereFC.&lt;/p&gt;

&lt;p&gt;We have a test to ensure our FAQ is only visible to authorized users:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;def test_should_access_faq():
    headers, html = get_authorized('/ajuda')
    assert &amp;quot;200&amp;quot; == headers['status']&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The test name is just kind of generic and there is a &lt;code&gt;get_authorized()&lt;/code&gt; test helper. The assertion is based on HTTP status code.
Seems ok, let’s move on.&lt;/p&gt;

&lt;h2 id=&quot;do-not-repeat-yourself---dry&quot;&gt;Do not repeat yourself - DRY&lt;/h2&gt;

&lt;p&gt;Why do we have a &lt;code&gt;get_authorized()&lt;/code&gt; test helper? Because we have other tests that share common steps, and we like &lt;a href=&quot;http://en.wikipedia.org/wiki/Don't_repeat_yourself&quot;&gt;the idea
of not repeating ourselves&lt;/a&gt;. Using that test helper we can create new
tiny tests that do a lot and we do not need to care about lots of details. That idea is really great when you are writing new tests and they don’t fail or break.&lt;/p&gt;

&lt;p&gt;Let’s see what &lt;code&gt;get_authorized()&lt;/code&gt; is:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;def get_authorized(url, user_name='PFCGuy', session_key=None):
    cookies = set_user_in_cookie(user_name)
    return get_html_with_cookie(url, cookies)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Hmm, it uses other two test helpers: &lt;code&gt;set_user_in_cookie()&lt;/code&gt; and &lt;code&gt;get_html_with_cookie()&lt;/code&gt;,
and it seems to use &lt;code&gt;&quot;PFCGuy&quot;&lt;/code&gt; as the user trying to see that page. Keep going.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;def set_user_in_cookie(user_name):
    pfc_cookie = serializer.serialize({'authorized': True, 'user_name': user_name})
    cookies = {
        settings.PFC_COOKIE: pfc_cookie
    }
    return cookies&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Okay, it just creates a dictionary with a serialized entry.&lt;/p&gt;

&lt;p&gt;We are not done yet and we had to stack lots of stuff in our head just to understand something I can’t remember, because I had to dig into a lot to understand what my test is doing. If our brain is limited to deal with 7 different things (based on the &lt;a href=&quot;http://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two&quot;&gt;Seven, Plus or Minus Two paper&lt;/a&gt;), we are in trouble, because we already stacked 1) &lt;code&gt;test_should_access_faq()&lt;/code&gt; 2) &lt;code&gt;get_authorized()&lt;/code&gt; and 3) &lt;code&gt;set_user_in_cookie()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now that we know that we first need to set a cookie before requesting the FAQ page, we can move on &lt;code&gt;get_html_with_cookie()&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;def get_html_with_cookie(url, cookie_value):
    return get_with_cookie(url, cookie_value, get_html)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Hmm, it uses another helper and there is a &lt;em&gt;magic&lt;/em&gt; &lt;code&gt;get_html&lt;/code&gt; thing. What is that? Using my text-editor search I could find that is yet another helper. Oh god…&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;def get_html(url, follow_redirects=False, cookies=None, headers=None):
    headers, body = get(url, follow_redirects, headers, cookies=cookies)
    if not body:
        pytest.fail(&amp;quot;Response could not be parsed as html. &amp;quot;
                    &amp;quot;Status: %r. Body: %r&amp;quot; % (headers['status'], body))
    else:
        return headers, html.fromstring(body)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Oh, &lt;code&gt;get_html()&lt;/code&gt; is just a wrapper to &lt;em&gt;yet another f*cking helper&lt;/em&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;def get(url, follow_redirects=False, headers=None, host=settings.SITE_URL, cookies=None):
    if url.startswith('/'):
        url = host + url
    resp = requests.get(url, headers=headers, allow_redirects=follow_redirects, cookies=cookies)
    headers = resp.headers
    content = resp.text or ''
    headers['status'] = str(resp.status_code)
    return headers, content&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now that we got here we can go back and look for &lt;code&gt;get_with_cookie()&lt;/code&gt;, that is called inside &lt;code&gt;get_html_with_cookie()&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;def get_with_cookie(url, cookies, get_function=get, follow_redirects=False, **kwargs):
    headers, body = get_function(url,
                                 follow_redirects=follow_redirects,
                                 cookies=cookies,
                                 **kwargs)
    return headers, body&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It just call that &lt;code&gt;get_html&lt;/code&gt; callback, named &lt;code&gt;get_function&lt;/code&gt; here, using the arguments we already had.&lt;/p&gt;

&lt;p&gt;I am pretty sure you are lost here, because we, that wrote the code in the past, got lost multiple times. And as I am writing this post I got lost again.&lt;/p&gt;

&lt;p&gt;Let’s see what our mental stack is:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;code&gt;test_should_access_faq()&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;get_authorized()&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;set_user_in_cookie()&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;get_html_with_cookie()&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;get_html()&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;get()&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;get_with_cookie()&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;SEVEN? &lt;a href=&quot;http://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two&quot;&gt;That magical number&lt;/a&gt;?! Really? My mind can’t stack that much and not get lost. When we reached &lt;code&gt;get_html()&lt;/code&gt; I was already lost.&lt;/p&gt;

&lt;h2 id=&quot;do-repeat-yourself-when-testing&quot;&gt;DO REPEAT YOURSELF! (when testing)&lt;/h2&gt;

&lt;p&gt;Our conclusion is that when you are writing tests, &lt;em&gt;YOU SHOULD&lt;/em&gt; repeat yourself, and make the test very clear.&lt;/p&gt;

&lt;p&gt;No matter how much similar test code you have, repeat it and make yourself as clear as possible.&lt;/p&gt;

&lt;p&gt;We discussed these ideas with our colleague &lt;a href=&quot;https://twitter.com/jbochi&quot;&gt;Juarez Bochi&lt;/a&gt;, and he mentioned &lt;a href=&quot;http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-10.html#%_sec_1.1&quot;&gt;the beginning of the Structure and Interpration of Computer Programs book&lt;/a&gt;, where the authors describe three mechanisms every powerful language have:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;primitive expressions&lt;/strong&gt;, which represent the simplest entities the language is concerned with,&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;means of combination&lt;/strong&gt;, by which compound elements are built from simpler ones, and&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;means of abstraction&lt;/strong&gt;, by which compound elements can be named and manipulated as units.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And after mentioning that he asked us: “Are you saying that we should not combine abstraction?”&lt;/p&gt;

&lt;p&gt;My conclusion is that we should apply these abstraction ideas to our tests, but not so extensively as we should in our business code. We must be very careful to not fall into those matrioskas traps.&lt;/p&gt;

&lt;p&gt;Flávio and I tried to rewrite that single test as clear as possible. The result:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;def test_authorized_user_should_access_faq():
    user_name = &amp;quot;PFCGuy&amp;quot;
    url = settings.SITE_URL + &amp;quot;/ajuda&amp;quot;
    pfc_cookie = serializer.serialize({'authorized': True, 'user_name': user_name})
    cookies = { settings.PFC_COOKIE: pfc_cookie }

    resp = requests.get(url, cookies=cookies)

    assert 200 == resp.status_code
    assert resp.text&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now we have &lt;em&gt;one&lt;/em&gt; thing to stack in our head, nothing else. If we have a new test that shares that authorization logic, we are going to repeat ourselves, and we are ok with it. The benefit is immediate: if the test break, we know where to set breakpoints and debug. And everyone that looks at that test know &lt;em&gt;exactly&lt;/em&gt; what happened.&lt;/p&gt;

&lt;p&gt;If we compare these two approaches we realize the first (with lots of helpers) have business logic spread all over the code, while the second is self-contained. We like self-contained tests, they are better to mantain.&lt;/p&gt;

&lt;p&gt;After this story we discussed some guidelines in order to avoid that kind of trap.&lt;/p&gt;

&lt;h2 id=&quot;guideline&quot;&gt;Guideline&lt;/h2&gt;

&lt;p&gt;We are not set yet, but we are discussing some set of rules when testing:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;If your helper calls another helper, stop right now. Do not do that.&lt;/li&gt;
  &lt;li&gt;If your helper hides business logic, stop it. That should be clear in your test.&lt;/li&gt;
  &lt;li&gt;If your helper has default arguments, you are probably hiding important information and hurting the next developer that touch that code. Think twice before doing it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;next-steps&quot;&gt;Next steps&lt;/h2&gt;

&lt;p&gt;We have lots of great discussions here in my team and we are always getting better. That’s why I love these guys. Unfortunately we lost &lt;a href=&quot;https://twitter.com/igorsobreira&quot;&gt;Igor Sobreira&lt;/a&gt; (he moved to Hawaii), a great developer and he always made our discussions richer. And I am about to leave the team (that’s for another post).&lt;/p&gt;

&lt;p&gt;Some ideas we have discussed over and over again are: how to write and maintain documentation, and how to do environment-dependent configuration. These subjects need a special post, but let me just introduce them.&lt;/p&gt;

&lt;h3 id=&quot;documentation&quot;&gt;Documentation&lt;/h3&gt;

&lt;p&gt;My team works phisically in the same place, one next to the other, and most of what we write is not opensource. We work at the same place and day hours, and because of that we are not forced to write better documentation.
Our opensource projects have a way better documentation, due to the nature of the project itself (people around the world will try to use and contribute), they are not only for ourselves. We need to learn how to improve on it.&lt;/p&gt;

&lt;h3 id=&quot;configuration&quot;&gt;Configuration&lt;/h3&gt;

&lt;p&gt;We have projects where there is a &lt;code&gt;settings/&lt;/code&gt; directory and there are &lt;code&gt;prod.py&lt;/code&gt;, &lt;code&gt;qa1.py&lt;/code&gt;, &lt;code&gt;dev.py&lt;/code&gt;, and these files contain environment-specific configuration. It sucks because you &lt;em&gt;must&lt;/em&gt; remember to change all files if one configuration changes and they tend to mix code and configuration. If you use Django you are probably used to this workflow, but think twice the next time you touch a settings file.&lt;/p&gt;

&lt;p&gt;That settings on different files practice is bad because someone needs to manage that, and it is possible to add code to one file and forget to add to another. There is a possibility that you have all tests passing and everything working fine in an environment, but it may break when you deploy to production because of a missing line at &lt;code&gt;prod.py&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://12factor.net/&quot;&gt;Twelve Factor App&lt;/a&gt; has a section on &lt;a href=&quot;http://www.12factor.net/config&quot;&gt;Configs&lt;/a&gt;, and they recommend using &lt;em&gt;environment variables&lt;/em&gt; for configuration. We like that idea and in some projects we have a hybrid approach.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Rethinking Education</title>
   <link href="https://blog.hltbra.net/2012/04/12/rethinking-education.html"/>
   <updated>2012-04-12T00:00:00-04:00</updated>
   <id>hhttps://blog.hltbra.net/2012/04/12/rethinking-education</id>
   <content type="html">&lt;p&gt;I dropped my bachelor degree in 2010 while I was in the second semester; my classes were boring, some teachers were not updated to
what is happening in the industry (some not even in the academia), and most of the students were not interested in learning,
they just wanted to get enough score to go to the next semester.&lt;/p&gt;

&lt;p&gt;That was not right. Maybe my university or my course was not good enough. Or maybe the way the university teaches is not as good as it could be.&lt;/p&gt;

&lt;p&gt;Every person learn in a different pace, and in a class with 30 or more students someone will be left behind,
and others will get bored because they learn in a faster pace.&lt;/p&gt;

&lt;p&gt;All text that follows is based on my experiences.&lt;/p&gt;

&lt;h3 id=&quot;the-start-of-a-revolution&quot;&gt;The Start of a Revolution&lt;/h3&gt;

&lt;p&gt;In 2002 MIT started &lt;a href=&quot;http://en.wikipedia.org/wiki/OpenCourseWare&quot;&gt;MIT OpenCourseWare&lt;/a&gt;, an initiative to put all their material from undergraduate and graduate courses online to everyone;
no other well named institution had anything like that, they pioneered.
After some time other universities started to do the same, and projects like &lt;a href=&quot;http://cs50.net&quot;&gt;CS50&lt;/a&gt; from Harvard were born. I’ve watched CS50 videos and they are gold material.&lt;/p&gt;

&lt;p&gt;Institutions started to put recorded video classes, pdfs, textbooks, and assignments online, but it was not enough. Something was missing.&lt;/p&gt;

&lt;h3 id=&quot;khan-academy-and-short-videos&quot;&gt;Khan Academy And Short Videos&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Salman_Khan_(educator)&quot;&gt;Salman Khan&lt;/a&gt; started to record videos to help his cousin with math, and uploaded them to YouTube.
In a short amount of time he was recording more videos to help more people in the family. And them friends.
It was so quick and enlightening that Khan founded &lt;a href=&quot;http://khanacademy.org&quot;&gt;Khan Academy&lt;/a&gt;, a non-profit organization with a noble mission: change the world education.&lt;/p&gt;

&lt;p&gt;Khan Academy’s video format is very nice, all videos are about 10 minutes - they break a subject into many short videos.
It is much easier to grasp the content this way.&lt;/p&gt;

&lt;p&gt;Students can pause, go back to some point they did not understand very well, replay, watch later, read what other students are saying in the comments,
practice with many online exercises, and do all this any time.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://khanacademy.org&quot;&gt;Khan Academy&lt;/a&gt; started with Math, but now it is about Math, Computing, Biology, Physics, History, and much more.
There are more than &lt;strong&gt;3,100&lt;/strong&gt; videos on many subjects.&lt;/p&gt;

&lt;p&gt;
    &lt;a target=&quot;_blank&quot; href=&quot;/assets/imgs/khan_academy2.png&quot;&gt;
        &lt;img style=&quot;margin-left: 0&quot; title=&quot;Khan Academy Video On Probabilty&quot; alt=&quot;Khan Academy Video On Probabilty&quot; src=&quot;/assets/imgs/khan_academy2.png&quot; height=&quot;400px&quot; /&gt;
    &lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;Watch Salman Khan at TED: &lt;a href=&quot;http://www.ted.com/talks/salman_khan_let_s_use_video_to_reinvent_education.html&quot;&gt;http://www.ted.com/talks/salman_khan_let_s_use_video_to_reinvent_education.html&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;ai-class-and-the-concept-of-a-class&quot;&gt;AI Class and the Concept of a Class&lt;/h3&gt;

&lt;p&gt;Last year I saw an announcement of an &lt;a href=&quot;http://ai-class.com&quot;&gt;Introduction to Artificial Intelligence&lt;/a&gt; free course offered by Stanford,
which had &lt;a href=&quot;http://norvig.com/&quot;&gt;Peter Norvig&lt;/a&gt; and &lt;a href=&quot;http://robots.stanford.edu/&quot;&gt;Sebastian Thrun&lt;/a&gt; as teachers.
I signed up and waited the starting date.&lt;/p&gt;

&lt;p&gt;I got shocked with the first videos. It was different from everything I had seen. There were about 160,000 (one hundred sixty thousand) students enrolled!
And the videos were made using only pencil and paper.&lt;/p&gt;

&lt;p&gt;
    &lt;a target=&quot;_blank&quot; href=&quot;/assets/imgs/aiqus2.png&quot;&gt;
        &lt;img style=&quot;margin-left: 0&quot; title=&quot;AI Class video on Bayes Network&quot; alt=&quot;AI Class video on Bayes Network&quot; src=&quot;/assets/imgs/aiqus2.png&quot; height=&quot;400px&quot; /&gt;
    &lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;AI Class was somehow like Khan Academy: short videos and a kind of whiteboard. But they had something different: the concept of a class.
The videos were broken in units, each unit with many videos (each video about 4 minutes long), and a homework with a deadline.
Later a midterm and a final exam were set.&lt;/p&gt;

&lt;p&gt;They had the great idea to setup &lt;a href=&quot;http://aiqus.com&quot;&gt;a forum&lt;/a&gt; where students could discuss the content. Every time I had questions I went to the
forum and could find answers to my questions - in a class with many thousand students there will always someone with the same questions you do.&lt;/p&gt;

&lt;p&gt;Another great idea in AI Class was quizzes along the units. The quizzes are meant to help students follow the content,
and it does not matter if anyone get them wrong, because the key idea is to make students think for a while about what they have been learned.&lt;/p&gt;

&lt;p&gt;It was an amazing experience to me, and at the same time there were other courses been offered by other Stanford professors:
&lt;a href=&quot;http://ml-class.org&quot;&gt;Machine Learning&lt;/a&gt; by professor &lt;a href=&quot;http://ai.stanford.edu/~ang/&quot;&gt;Andrew Ng&lt;/a&gt;, and &lt;a href=&quot;http://db-class.org&quot;&gt;Introduction to Databases&lt;/a&gt; by professor &lt;a href=&quot;http://infolab.stanford.edu/~widom/&quot;&gt;Jennifer Widom&lt;/a&gt; - I did not signed up for any of them.&lt;/p&gt;

&lt;p&gt;All these courses were beta so professors could see what works well and what not. After AI Class &lt;a href=&quot;http://robots.stanford.edu/&quot;&gt;Sebastian Thrun&lt;/a&gt; and some fellows founded &lt;a href=&quot;http://udacity.com&quot;&gt;Udacity&lt;/a&gt;,
and &lt;a href=&quot;http://ai.stanford.edu/~ang/&quot;&gt;Andrew Ng&lt;/a&gt; and &lt;a href=&quot;http://ai.stanford.edu/~koller&quot;&gt;Daphne Koller&lt;/a&gt; founded &lt;a href=&quot;https://www.coursera.org&quot;&gt;Coursera&lt;/a&gt;. Both offering high level online courses for free.&lt;/p&gt;

&lt;p&gt;I took only AI Class last year, and I do not know how the other courses were - I heard some people saying that ML class was too much slide oriented.&lt;/p&gt;

&lt;h3 id=&quot;udacity&quot;&gt;Udacity&lt;/h3&gt;

&lt;p&gt;Sebastian Thrun and his fellows want to change how online classes work with very audacious goals in their courses.
Their teaching method is the same used in AI Class: whiteboard with quizzes along the videos.&lt;/p&gt;

&lt;p&gt;They started with &lt;a href=&quot;http://www.udacity.com/overview/Course/cs101&quot;&gt;CS101: Building a Search Engine&lt;/a&gt;, and &lt;a href=&quot;http://www.udacity.com/overview/Course/cs373&quot;&gt;CS373: Programming a Robotic Car&lt;/a&gt;. Both courses were 7-week long.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.udacity.com/overview/Course/cs101&quot;&gt;CS101&lt;/a&gt; aims people who knows &lt;strong&gt;nothing&lt;/strong&gt; about computing, and they are promising these students will build a &lt;strong&gt;search engine&lt;/strong&gt; in &lt;em&gt;7 weeks&lt;/em&gt;?! Very audacious.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.udacity.com/overview/Course/cs373&quot;&gt;CS373&lt;/a&gt; aims people with &lt;strong&gt;basic programming knowledge&lt;/strong&gt; and they are promising these students are going to program the basics of a &lt;strong&gt;self-driving car&lt;/strong&gt; in &lt;em&gt;7 weeks&lt;/em&gt;?!
Really audacious.&lt;/p&gt;

&lt;p&gt;Udacity have a web programming environment and a studio to record their classes with a high tech whiteboard. The video quality is very good.&lt;/p&gt;

&lt;p&gt;
    &lt;a target=&quot;_blank&quot; href=&quot;/assets/imgs/udacity2.png&quot;&gt;
        &lt;img style=&quot;margin-left: 0&quot; title=&quot;Udacity class on Robot motion&quot; alt=&quot;Udacity class on Robot motion&quot; src=&quot;/assets/imgs/udacity2.png&quot; height=&quot;400px&quot; /&gt;
    &lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;Other cool thing in Udacity is that the teachers are always motivating and challenging the students.
They say phrases like “I would be blown away if you got it right,” “There is no problem if you get it wrong.” You can be sure it challenges people.&lt;/p&gt;

&lt;p&gt;I did the final exam of both courses last week and I am very proud of me and feel as I am being part of &lt;strong&gt;the future of education&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;There will be more cool classes starting April 16. Check them out at &lt;a href=&quot;http://udacity.com&quot;&gt;udacity.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Ex-Stanford Teacher’s New Startup Brings University-Level Education To All: &lt;a href=&quot;http://techcrunch.com/2012/04/04/ex-stanford-teachers-new-startup-brings-university-level-education-to-all-tctv/&quot;&gt;http://techcrunch.com/2012/04/04/ex-stanford-teachers-new-startup-brings-university-level-education-to-all-tctv/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Udacity Co-Founder on Internet Classes, Robotic Car: &lt;a href=&quot;http://www.bloomberg.com/video/89001551/&quot;&gt;http://www.bloomberg.com/video/89001551/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Sebastian Thrun: Google’s driverless car: &lt;a href=&quot;http://www.ted.com/talks/sebastian_thrun_google_s_driverless_car.html&quot;&gt;http://www.ted.com/talks/sebastian_thrun_google_s_driverless_car.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;coursera&quot;&gt;Coursera&lt;/h3&gt;

&lt;p&gt;I signed up for some classes from Coursera: &lt;a href=&quot;https://www.coursera.org/course/saas&quot;&gt;Software as a Service&lt;/a&gt;, &lt;a href=&quot;https://www.coursera.org/course/algo&quot;&gt;Design and Analysis of Algorithms I&lt;/a&gt;, Information Theory, and others.&lt;/p&gt;

&lt;p&gt;But I was a little bit disappointed because there was a big delay to start the classes. Some did not even start yet.
I took SaaS class and I am in the last week of DAA class.&lt;/p&gt;

&lt;p&gt;Software as a Service is a hot topic, and the teachers were well named people in the software industry: &lt;a href=&quot;http://www.armandofox.com/geek/&quot;&gt;Armando Fox&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/David_Patterson_(scientist)&quot;&gt;David Patterson&lt;/a&gt;.
Yes, in the Industry.&lt;/p&gt;

&lt;p&gt;I got more disappointed when the class started, because I was expecting something like Khan Academy or Udacity, where the videos are made to online audience.
But in the SaaS course the videos were recordings from Berkeley classes, and too much slide oriented. At least they had an online judge and good content.&lt;/p&gt;

&lt;p&gt;They did provide a VirtualBox VM where you had an Ubuntu with all your needs self-contained. So people would only need VirtualBox to do the assignments.&lt;/p&gt;

&lt;p&gt;There were a few quizzes along the videos, but they were very confusing to me because they used to ask using the negative
(e.g “What is NOT something?”, “Which statement is NOT true about something?”).&lt;/p&gt;

&lt;p&gt;My expectations with the course were all about creating services and developing communication between them, but the course was not about it.
&lt;a href=&quot;https://class.coursera.org/saas/forum/thread?thread_id=476&quot;&gt;The course was not about SaaS at all&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The course title is “Engineering for Software as a Service,” and the professors wrote the &lt;a href=&quot;http://beta.saasbook.info/&quot;&gt;textbook
“Engineering Long-Lasting Software: An Agile Approach Using Cloud Computing and SaaS.”&lt;/a&gt;
The course was about good development process and practices, but it was not clear to me and most of the students.&lt;/p&gt;

&lt;p&gt;A nice experience anyway. The content was not new to me, because I had worked in a research group with Agile methods, BDD/TDD,
and I work as a software developer since 2008. I got 100% in all programming assignments :-)&lt;/p&gt;

&lt;p&gt;I am in the last week of &lt;a href=&quot;https://www.coursera.org/course/algo&quot;&gt;Design and Analysis of Algorithms&lt;/a&gt;, taught by &lt;a href=&quot;http://theory.stanford.edu/~tim/&quot;&gt;Tim Roughgarden&lt;/a&gt;. The classes have been very theoretical,
and that is exactly what I wanted. Different from SaaS course, Tim remade the videos to aim the online class.&lt;/p&gt;

&lt;p&gt;Despite Tim’s horrible handwriting, he is an excellent educator. The most I have been learning is about induction proof and run time analysis.
All topics I had seen before, when I used to do programming contests - but not so in depth as in the course. For those who wants to see more practical algorithms examples
I recommend reading &lt;a href=&quot;http://www.amazon.com/gp/product/0387001638/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=hugosblog-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0387001638&quot;&gt;Programming Challenges&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Coursera offers great content by great teachers, but they are not as interactive as Udacity. It feels like they are only publishing material online, as MIT OCW does.&lt;/p&gt;

&lt;h3 id=&quot;mitx&quot;&gt;MITx&lt;/h3&gt;

&lt;p&gt;MIT realized &lt;a href=&quot;http://en.wikipedia.org/wiki/OpenCourseWare&quot;&gt;OpenCourseWare&lt;/a&gt; was not enough and launched &lt;a href=&quot;http://mitx.mit.edu&quot;&gt;MITx&lt;/a&gt; March this year. I did not signed up to its &lt;a href=&quot;https://6002x.mitx.mit.edu/&quot;&gt;Circuits &amp;amp; Electronics (6.002x)&lt;/a&gt; first class,
and I can not say anything about the course.&lt;/p&gt;

&lt;p&gt;Most of what I know about MITx comes from &lt;a href=&quot;http://www.insidehighered.com/news/2012/04/06/how-could-mitx-change-mit&quot;&gt;http://www.insidehighered.com/news/2012/04/06/how-could-mitx-change-mit&lt;/a&gt;
and &lt;a href=&quot;http://www.aiqus.com/questions/39268/mitx-circuits-and-electronics-is-it-practical-or-theoretical&quot;&gt;http://www.aiqus.com/questions/39268/mitx-circuits-and-electronics-is-it-practical-or-theoretical&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;whats-next&quot;&gt;What’s next?&lt;/h3&gt;

&lt;p&gt;I do not know what the future of education is, but it seems universities will need to change their education system to accomodate initiatives like
&lt;a href=&quot;http://khanacademy.org&quot;&gt;Khan Academy&lt;/a&gt;, &lt;a href=&quot;http://udacity.com&quot;&gt;Udacity&lt;/a&gt;, &lt;a href=&quot;https://www.coursera.org&quot;&gt;Coursera&lt;/a&gt;, and &lt;a href=&quot;http://mitx.mit.edu&quot;&gt;MITx&lt;/a&gt;.
Maybe institutions will use an exam (oral, written, or practical) to certificate people in near future - maybe something like &lt;a href=&quot;http://www.lpi.org/&quot;&gt;LPI&lt;/a&gt; certificates.&lt;/p&gt;

&lt;p&gt;The other day I was talking about it at ##udacity-373 @ freenode with a bunch of guys about undergraduation and I said
I do not know if this idea of online education fits law or medicine. There is a part I can not forget:&lt;/p&gt;

&lt;pre class=&quot;chat&quot;&gt;
-- What is the name of the bottom student in med school?
-- What?
-- Doctor.
&lt;/pre&gt;

&lt;p&gt;What he meant by that is a med degree tells nothing about how good a doctor is.
And it also means that online universities can offer better content than physical ones.&lt;/p&gt;

&lt;pre class=&quot;chat&quot;&gt;
&lt;span class=&quot;nick&quot;&gt;&amp;lt;hltbra&amp;gt;&lt;/span&gt; I know it is a long discussion but I would like to know your opinion about the future of &quot;formal&quot; education
&lt;span class=&quot;nick&quot;&gt;&amp;lt;hltbra&amp;gt;&lt;/span&gt; do you have any strong opinions about it?
&lt;span class=&quot;nick&quot;&gt;&amp;lt;eghm&amp;gt;&lt;/span&gt; &quot;education bubble&quot;
&lt;span class=&quot;nick&quot;&gt;&amp;lt;hltbra&amp;gt;&lt;/span&gt; eghm: what about lawyers, doctors, engineers?
&lt;span class=&quot;nick&quot;&gt;&amp;lt;@gundega&amp;gt;&lt;/span&gt; hltbra: I think that formal education institutions will have to really step up their game and add more value for being actually on campus
&lt;span class=&quot;nick&quot;&gt;&amp;lt;eghm&amp;gt;&lt;/span&gt; you know what they call the person who graduates at the bottom of their class in med school?
&lt;span class=&quot;nick&quot;&gt;&amp;lt;@gundega&amp;gt;&lt;/span&gt; doctors could have chemistry taught online by the best teachers and go to campus for some practical exercises only
&lt;span class=&quot;nick&quot;&gt;&amp;lt;hltbra&amp;gt;&lt;/span&gt; eghm: no. what they call?
&lt;span class=&quot;nick&quot;&gt;&amp;lt;eghm&amp;gt;&lt;/span&gt; Doctor
&lt;span class=&quot;nick&quot;&gt;&amp;lt;@gundega&amp;gt;&lt;/span&gt; there are a lot of possibilities how formal schools can use the new online schools
&lt;/pre&gt;
&lt;p&gt;Extracted and adpted from &lt;a href=&quot;http://www.elitter.net/~amberj/irclogs/udacity-cs373/year-12/month-04/%23%23udacity-cs373-day03.txt&quot;&gt;http://www.elitter.net/~amberj/irclogs/udacity-cs373/year-12/month-04/%23%23udacity-cs373-day03.txt&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My eyes are wide open to see what is going to change in universities’s education systems,
and I am really enjoying learning so much from the best teachers in their fields.&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.kqed.org/a/forum/R201204091000&quot;&gt;Disruptive Innovation: Higher Education&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.wired.com/wiredscience/2012/03/ff_aiclass/all/1&quot;&gt;The Stanford Education Experiment Could Change Higher Learning Forever&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.aiqus.com/questions/38410/building-a-search-engine-review-after-2-weeks&quot;&gt;Building a Search Engine - Review (after 2 weeks)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.armandofox.com/geek/2012/03/the-downside-of-online-education/&quot;&gt;The downside of online education&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.aiqus.com/questions/38411/software-engineering-saas-review-after-2-weeks&quot;&gt;Software Engineering (SaaS) Review (after 2 weeks)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.class-central.com&quot;&gt;A complete list of free online courses offered by Stanford’s Coursera, MIT’s MITx, and Udacity&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.class-central.com&quot;&gt;Class Central: A complete list of free online courses offered by Stanford’s Coursera, MIT’s MITx, and Udacity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>The Practice of Programming Book - first chapter review</title>
   <link href="https://blog.hltbra.net/2012/02/22/the-practice-of-programming-thoughts.html"/>
   <updated>2012-02-22T00:00:00-05:00</updated>
   <id>hhttps://blog.hltbra.net/2012/02/22/the-practice-of-programming-thoughts</id>
   <content type="html">&lt;div id=&quot;review-description&quot; style=&quot;overflow: hidden;&quot;&gt;

&lt;div id=&quot;cover&quot; style=&quot;float: right; margin-left: 20px;&quot;&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/020161586X/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=hugosblog-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=020161586X&quot;&gt;&lt;img src=&quot;/assets/imgs/tpop.jpg&quot; alt=&quot;The Practice of Programming cover&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
  &lt;/div&gt;

Last year I read the famous [The Practice of Programming][book] book, by
Brian Kernighan and Rob Pike, and it was a kind of déjà vu; it is a
[Clean Code][clean code] book from the 90s!

I decided to get my paperback and write some thoughts about the first chaper, *Style*.
&lt;/div&gt;

&lt;h3 id=&quot;names&quot;&gt;1.1 Names&lt;/h3&gt;

&lt;p&gt;Code is read much more often than written, and we &lt;em&gt;must&lt;/em&gt; choose the best names to our
variables/functions we can.&lt;/p&gt;

&lt;p&gt;Sometimes we become obsessed by self explanatory names, and we add noisy to the reader
without realizing it.&lt;/p&gt;

&lt;p&gt;From the book:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;c&quot;&gt;for (theElementIndex = 0 ; theElementIndex &amp;lt; numberOfElements ; theElementIndex++)
    elementArray[theElementIndex] = theElementIndex;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This example may look insane and you may think you would never do this. But do you
remember something like:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;c&quot;&gt;for (index = 0 ; index &amp;lt; numberOfElements ; index++)
    elements[index] = index;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The word &lt;code&gt;index&lt;/code&gt; is just noisy. It’s scope is so small it doesn’t deserve that much information.
The book suggests just using &lt;code&gt;i&lt;/code&gt; as variable name.&lt;/p&gt;

&lt;p&gt;Verbose isn’t the same as clear.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Programmers are often encouraged to use long variable names regardless of context. That is a mistake:
clarity is often achieved through brevity.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Use active names for functions&lt;/strong&gt;. Functions that return boolean values are an exception to this rule.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;c&quot;&gt;if (checkoctal(c))
    ...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;vs&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;c&quot;&gt;if (isoctal(c))
   ...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The silliest it may look, it makes trouble. I was reading some code the other day and I had to read the
implementation details to be sure the function doesn’t change any state. I wouldn’t need to do that if
the author was aware of this hint.&lt;/p&gt;

&lt;h3 id=&quot;expressions-and-statements&quot;&gt;1.2 Expressions and Statements&lt;/h3&gt;

&lt;p&gt;We are in 2012 and we still make indentation mistakes. Every time I see a &lt;code&gt;for&lt;/code&gt; loop like the following
I need to reread the lines around it about 3 times to be sure it means “no body here”:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;c&quot;&gt;for (n++ ; n &amp;lt; 100 ; field[n++] = '\0');&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;For God’s sake, add a body to it!&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;c&quot;&gt;for (n++ ; n &amp;lt; 100 ; n++)
    field[n] = '\0';&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Prefer using the natural form for expressions&lt;/strong&gt;. Avoid &lt;a href=&quot;http://www.ionu.ro/2010/10/yoda-conditions/&quot;&gt;Yoda conditions&lt;/a&gt;. If you speak the
expression aloud and it sounds odd, change it.&lt;/p&gt;

&lt;p&gt;Most of us can’t memorize operator precedence, so try to avoid trouble by adding parentheses to
doubtful expressions and extracting subexpressions to variables.&lt;/p&gt;

&lt;h3 id=&quot;consistency-and-idioms&quot;&gt;1.3 Consistency and Idioms&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;The project’s consistency is more important than your own, because it makes life easier
for those who follow.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every programmer has it’s own style, and we create lots of idioms along our projects. Do not
change any project coding style just because you don’t like it; preserve the coding style you
have found.&lt;/p&gt;

&lt;h3 id=&quot;function-macros&quot;&gt;1.4 Function Macros&lt;/h3&gt;

&lt;p&gt;I used to think I was really smart when I used to write inline functions using C preprocessor
macros. I felt really good doing that. But the authors did me a favor writing:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Avoid function macros.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Function macros are not a good idea, since what they do is replace code. They can hide serious
flaws:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;c&quot;&gt;#define isupper(c) ((c) &amp;gt;= 'A' &amp;amp;&amp;amp; (c) &amp;lt;= 'Z')&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It may look correct, but the problem is that inside &lt;code&gt;c&lt;/code&gt; is evaluated two times, and if &lt;code&gt;isupper&lt;/code&gt;
is used as&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;c&quot;&gt;while (isupper(c = getchar()))
    ...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;getchar&lt;/code&gt; is evaluated two times if &lt;code&gt;c &amp;gt;= 'A'&lt;/code&gt;, and make you waste hours debugging it.&lt;/p&gt;

&lt;h3 id=&quot;magic-numbers&quot;&gt;1.5 Magic Numbers&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;As a guideline, any number other than 0 or 1 is likely to be magic and should
have a name of its own.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There is a trick in this section to calculate the number of elements of objects in C:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;c&quot;&gt;#define NELEMS(array) (sizeof(array) / sizeof(array[0]))&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And with this definition you have a dynamic size calculator in C!&lt;/p&gt;

&lt;h3 id=&quot;comments&quot;&gt;1.6 Comments&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Don’t belabor the obvious&lt;/strong&gt;. This rule applies to all code like:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;c&quot;&gt;/* return SUCCESS */
return SUCCES;

zerocount++; /* Increment zero entry count */&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Sometimes we spend hours trying to improve comments, but what we may not realize is that
we have bad code, and no matter how good the comment is, the code is not going to become better.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Don’t comment bad code. Rewrite it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;conclusions&quot;&gt;Conclusions&lt;/h3&gt;

&lt;p&gt;These were only some ideas behind the first chapter, and they are amazing!&lt;/p&gt;

&lt;p&gt;The next chapters talk about complexity, how to grow arrays, how to implement hash tables,
debugging, how they used to test code in the old times, performance hints and much more.&lt;/p&gt;

&lt;p&gt;I loved the book. Go on and get your copy.&lt;/p&gt;

&lt;p&gt;PS.: Rob Pike wrote in 1989 &lt;a href=&quot;http://www.lysator.liu.se/c/pikestyle.html&quot;&gt;Notes on Programming in C&lt;/a&gt;, that is worth reading too.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Updates&lt;/strong&gt;: 23/02/2012 - Fixed typos; Added book cover image&lt;/p&gt;

</content>
 </entry>
 
 
</feed>