| Search by tag or site | Login to my blog ? Start my own blog |
Jon Aquino's Mental GardenTechnologies that make life wonderful |
Reading Code Aloud
Posted on 03/13/2007 06:21 AM | Link | Post Comment
When reading a programming book, it can be tempting to skim the code examples. But they likely have some nuggets that are worth learning. The problem is that we don't like to read code written by other people - or at least it doesn't come naturally to us. What we need is a technique for rapid understanding of new code.
I propose reading the code aloud. Now, to make sure we don't get distracted by syntactic details, we can probably come up with some rules for what to omit. Consider this example from Martin's Agile Software Development:
I would read this aloud as follows:
So we have a first cut at a rule of thumb for things to skip:
I propose reading the code aloud. Now, to make sure we don't get distracted by syntactic details, we can probably come up with some rules for what to omit. Consider this example from Martin's Agile Software Development:
ifndef GEOMETRY_RAY_H
define GEOMETRY_RAY_H
class Ray : public LinearObject
{
public:
Ray(const Point& p1, const Point& p2);
virtual bool IsOn(const Point&) const;
};
endif
I would read this aloud as follows:
class Ray, extends LinearObject
Ray p1, p2
IsOn Point, returns bool
So we have a first cut at a rule of thumb for things to skip:
- start and end matter (e.g. ifndef, define, endif)
- access modifiers (public, protected, private)
- parameter types
- in C++, read ":" as "extends"
- in function declarations, read "[type] ..." as "... returns [type]"
- Cool Service: Uptime Website Monitoring Service
- Svn Time-lapse View
- Royal Canadian Air Force "5bx" Daily 15-minute Exercise Program
- Simplicity And Difficulty Are Orthogonal
- October Challenge: Reading Knuth's "the Art Of Computer Programming"
- Oct 2007
- Sep 2007
- Aug 2007
- Jul 2007
- Jun 2007
- May 2007
- Apr 2007
- Mar 2007
- Feb 2007
- Jan 2007
- Dec 2006
- Nov 2006
- Oct 2006
- Sep 2006
- Aug 2006
- Jul 2006
- Jun 2006
- May 2006
- Apr 2006
![]()
- The Confused Capitalist
- Counter Intelligence: The Real Estate Cafe Weblog
- Credit Bloggers
- Wishing Wealth
- Edmonton Real Estate
- Don't Mess With Taxes
Examples
ATM Wallstreet - Mon Oct 06, 2008 03:39PM
Made several great trades today. Traded the QID, QQ [read more]
Made several great trades today. Traded the QID, QQ [read more]
ATM Wallstreet - Sat Oct 04, 2008 10:41PM
When I first started Day Trading I traded anything that [read more]
When I first started Day Trading I traded anything that [read more]
Morpheus Trading - Thu Oct 02, 2008 08:58AM
NOTE: Please click on the charts below to enlarge them if [read more]
NOTE: Please click on the charts below to enlarge them if [read more]












<< My Home | TheMoneyBlogs Home