Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Thursday, March 27, 2014

I Love DeBugger

I'm not sure how I ever got along without using my compiler's debugger. It's SO much nicer to see the call stack and step through my code rather just making wild guesses about what might be wrong.

I am reminded of Winston Smith's epiphany at the end of 1984 (though, I hope, without the sinister overtones). With apologies to George Orwell:
O cruel, needless misunderstanding! O stubborn, self-willed exile from the loving breast! Two gin-scented tears trickled down the sides of his nose. But it was all right, everything was all right, the struggle was finished. He had won the victory over himself. He loved DeBugger.

Wednesday, March 5, 2014

Baby Steps

I am working on a pretty big C++ project to take XML, parse out certain fields in it, and then use it to populate various tables.
My first few efforts in writing this class were akin to giving a mouse a drink from a firehouse -- extremely frustrating, and not particularly enjoyable or profitable. It dampened my fur, to say the least.

But then I remembered some of the best programming advice I ever received, and that has helped things to go better.

When in doubt, remember Bob's method: baby steps. It'll make you feel much better.

Tuesday, March 4, 2014

The Pragmatic Programmer: Craftsmen and Cathedrals

I'm still only in the preface to Andrew Hunt's and David Thomas's The Pragmatic Programmer, but I can already tell it's going to be a favorite.

Hunt and Thomas have this to say about about the importance of craftsmanship in software development:
Think about the large cathedrals built in Europe during the Middle Ages. Each took thousands of person-years of effort, spread over many decades. Lessons learned were passed down to the next set of builders, who advanced the state of structural engineering with their accomplishments. But the carpenters, stonecutters, carvers, and glass workers were all craftspeople, interpreting the engineering requirements to produce a whole that transcended the purely mechanical side of their construction. It was their belief in their individual contributions that sustained the projects.
We who cut mere stones must always be envisioning cathedrals.

-Quarry Worker's Creed  
 (p. xx of The Pragmatic Programmer, Boston: Addison-Wesley, 2000 )
Good stuff -- makes me want to do more than just sling code that compiles. It's an excellent reminder that there is always room for beauty and elegance, even in the seemingly mundane.

Tuesday, January 14, 2014

Lots of Code

I'm a little bit stunned to think of the sheer volume of code in the project that my machine is compiling right now. I'm on line 60,000 of... well, a really big number. So big that it has made my int roll over to negative twice so far.

What is even more striking -- sobering, even -- is that this code represents the lives of the people who work here. Most of their waking hours, on most days, for most of their lives, have been spent adding to this code. They have created it, perfected it, sweated and sighed over it... and now here I am, distilling it to machine-readable 1s and 0s in a matter of minutes.

With that thought in mind, and in honor of National Poetry at Work Day (here's a delightful infographic about it), I will quote a few lines of Eliot's "Love Song of J. Alfred Prufrock":

For I have known them all already, known them all:
Have known the evenings, mornings, afternoons,        50
I have measured out my life with coffee spoons;
I know the voices dying with a dying fall
Beneath the music from a farther room.
  So how should I presume?
But what are any of our lives, really, but a long, slow measuring out? And lines of C++ are as good a yardstick as coffee spoons, I reckon.