Random Blog
Join JournalHome.com.
Create your own free blog today.
Create Your Blog
Flag this entry/bog.
It will be manually reviewed.
Report This!

Code Craft
The art, science and craft of writing quality software

Oct. 18, 2005 - Looks like I picked the wrong week to give up smoking crack

Posted in Programming

 

Certain "discoveries" when working on code can make you want to move to Alaska and get a job as a lumberjack or as the captain of a garbage scowl.  Today's example is a function quietly named public boolean isReadyToDoSomeWork()(changed to protect the guilty).  This sounds like a nice function one might interrogate to find out something.  So unless one was psychotic, it does not seem like a place to be manipulating things and making state changes to the system.  Ahh, if only.  In the code I was just shown it is indeed just the right place to make very major changes to the persistent state of the system.  Finding something like that can really lead someone to go bald at an early age.  Recommendation to the novice: functions that begin with the words "is" or "get" should probably not do any work other than returning data about the object (perhaps computed data) but they should never change the state of the system.

 

 

Share |
Post A Comment!

Notify me of followup comments via e-mail.

Oct. 18, 2005 - Brilliant

Posted by nobody
This reminds me of your article on hiding complexity. It's quite smart thought out to try and hide the complexity of an entier use case in one tiny method that just return the boolean value of successness :)



You should introduce the guy to this website: www.thedailywtf.com - It's full of wonderful idears and exciting new programing techniques ^_^
Permanent Link

Oct. 18, 2005 - WTF is right

Posted by codecraft
complexity so well hidden it would take a bloodhound and three spy satelites to track down its real location.
Permanent Link

Oct. 20, 2005 - is...()

Posted by Evil One
Whats wrong with this:



boolean isWorldFlat() {

world.flatten() ;

return true ;

}
Permanent Link

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
<- Last Page • Next Page ->

Kevin Barnes

Code Craft is the place for my thoughts, rants, ideas and occassional jokes on what it means to write code, why some people are better at it than others, and how we think about software in general.

Copyright (C) 2005, Kevin Barnes. All rights reserved.