Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: How Much Is Too Much (on one line of code)?

by halley (Prior)
on Jun 18, 2007 at 13:44 UTC ( [id://621786]=note: print w/replies, xml ) Need Help??


in reply to How Much Is Too Much (on one line of code)?

...argued that it best reflects the business logic...

I can understand that argument, but whenever you're describing business rules in code, you should be very clear to separate each business rule check from each of the others.

In this case, it's pretty obvious that there are two separate business rules in play: (1) that 'gbr' is a special overriding case, and (2) that the template must show countries in a particular format.

If either one of those business rules were to be changed by the boss, then the code involved would have to be restructured anyway. Maybe the 'gbr' isn't the only special case next year. Maybe the template will need something more complicated next month. Maybe 'gbr' will still be a special case but its appearance should be derived from the usual templating format, not just a completely empty string. So why invite a headache at that point, when you can just write things more clearly delineated and flexibly now?

The group I am in right now tries to be very careful and makes the code auditable. We are supposed to tag various code with the exact paragraph-number in the requirements document that the code is intending to implement. Many companies don't need to go that far, but they do prefer a bugfix patch to include the exact bug-number in the tracker database.

--
[ e d @ h a l l e y . c c ]

  • Comment on Re: How Much Is Too Much (on one line of code)?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://621786]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-18 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found