The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Can a boy scout be too eager?

2 replies on 1 page. Most recent reply: May 29, 2009 4:00 AM by Christian Horsdal

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 2 replies on 1 page
Christian Horsdal

Posts: 253
Nickname: horsdal
Registered: Mar, 2009

Christian Horsdal is a software architect at Mjølner Informatics.
Can a boy scout be too eager? Posted: May 23, 2009 12:18 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Christian Horsdal.
Original Post: Can a boy scout be too eager?
Feed Title: Horsdal
Feed URL: http://www.horsdal-consult.dk/feeds/posts/default
Feed Description: A blog that will be about code, architecture, design, and .NET.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Christian Horsdal
Latest Posts From Horsdal

Advertisement
The software craftsman movement tells us that as professionals we should strive to do our best. Among other things we should strive to write the cleanest code we can. One of the ways do that is to adopt the so-called Boy Scout Rule. When adapted to software development the Boy Scout Rule goes as follows:Always leave the code cleaner than you found itSo what does that mean? Well, if I was to

Read: Can a boy scout be too eager?


Tony Marston

Posts: 37
Nickname: tony32
Registered: May, 2007

Re: Can a boy scout be too eager? Posted: May 23, 2009 2:48 AM
Reply to this message Reply
Like so many other aspects of computer programming the definition of "cleaner code" can mean different things to different people. Provided that the code is maintainable and efficient when it is executed then it should be left alone.

My style of OOP is often criticised not because it doesn't work (which it most certainly does) but because it does not follow the arbitrary rules that they have been taught. For example, I use a separate class for each database table, which means that my class structure is always totally synchronised with my database structure, which means that I do not suffer from Object-Relational impedence mismatch, which means that I do not have to employ that abomnination called an Object-Realtional Mapper (ORM). Now just suppose some bright spark decides that my code would be "cleaner" if it followed the rules and had a "proper" class structure which was out of step with the database structure so that it could use an ORM. Would it in fact be "cleaner" or just "different"?

As another example, some programmers have a separate Data Access Object (DAO) for each individual database table whereas I use a single DAO for an entire database engine (MySQL, PostgreSQL, Oracle). Now just suppose some bright spark decides that my code would be "cleaner" if it was rewritten to use a separate DAO for each database table. Would it in fact be "cleaner" or just "different"?

I think that the biggest problem here is that it is impossible to come up with a definition of "cleaner code" that is acceptable to everybody, just like it is impossible to come up an answer for "what is OOP?" that is acceptable to everybody

Christian Horsdal

Posts: 253
Nickname: horsdal
Registered: Mar, 2009

Re: Can a boy scout be too eager? Posted: May 29, 2009 4:00 AM
Reply to this message Reply
I think it is important to respect that other developers on the team have valid reasons for the way they structure their code. On other hand I also think it is important to challenge those reasons when there is a disagreement: Having an on-going debate about what "clean" code is on a team is the basis for reaching some level of agreement on "cleanness" within the team. Once the team has (some of) that agreement in place incrementally cleaning code helps everyone.

Flat View: This topic has 2 replies on 1 page
Topic: Gezippt unter .NET Previous Topic   Next Topic Topic: MeineStadt, Silverlight, Tiefe Einblicke

Sponsored Links



Google
  Web Artima.com   

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