The Artima Developer Community
Sponsored Link

Perl Buzz Forum
Develop sensible coding habits on the path to true Laziness

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Andy Lester

Posts: 518
Nickname: petdance
Registered: Jun, 2009

Andy Lester is an author and programmer.
Develop sensible coding habits on the path to true Laziness Posted: Dec 16, 2010 1:33 PM
Reply to this message Reply

This post originated from an RSS feed registered with Perl Buzz by Andy Lester.
Original Post: Develop sensible coding habits on the path to true Laziness
Feed Title: Perlbuzz
Feed URL:
Feed Description: What's happening in the world of Perl programming, including Perl 5, Perl 6, the CPAN and Parrot?
Latest Perl Buzz Posts
Latest Perl Buzz Posts by Andy Lester
Latest Posts From Perlbuzz


Whenever I walk in my front door, I walk straight to the kitchen, open the first drawer, put in my keys and wallet and cell phone, and close the drawer. Always, without fail, no matter how bad I might have to take a leak. It is no less convenient for me to do this than to drop my stuff any old place. It is a habit that I have maintained for close to 30 years now. And I never ever ever have to wonder where I put my keys, or my phone, or my wallet. Ever. Having to do so would be extremely inconvenient. In fact, it would be EXTRA brain cycles on my part to put them where they do not belong.

When the phone rings, I know where it is. I don't run around wondering "Where's my phone?" trying to triangulate position. It's always there in the kitchen drawer. Always.

I also always put on my seat belt in the car. I never wonder if it's "necessary". I just do. Thinking about if it is "necessary" is also inconvenient. It takes brain cycles that I don't need to spend. I also know that the one time I need my seat belt and I don't have it on, I'm screwed.

Trying to decide to save three seconds by not buckling my seat belt is false laziness. And so is worrying about when you can leave out warnings and strict from your Perl programs.

Yesterday in IRC, someone was lamenting that Perl 6 effectively has warnings and strict on by default. All variables must declared before use. This person was one of those programmers who tried for the premature optimization of saving some typing. He forgot that typing is the least of our concerns when programming. He forgot that programmer thinking time costs many orders of magnitude more than programmer typing time, and that the time spent debugging can dwarf the amount of time spent creating code.

He also forgot that he's a human.

Checks like warnings and strict are there because we are fallible humans. We type $totl instead of $total, and we want Perl to tell us that. We try to dereference scalars and since we're no longer using Perl 4, we want Perl to tell us about that, too. We want Perl, which is a program and doesn't get sloppy and forget things, to catch us when we are humans and get sloppy and forget things.

Buy and read The Pragmatic Programmer and Code Complete and develop a solid set of programming habits from them. Sensible habits that are followed even when you might be able to get away without them are the true Laziness.

Read: Develop sensible coding habits on the path to true Laziness

Topic: Perlbuzz news roundup for 2011-01-20 Previous Topic   Next Topic Topic: Perlbuzz news roundup for 2010-12-08

Sponsored Links


Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use