If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Does formatting code matter?

View Poll Results: Does Formatting Code Matter?
Yes, for development. 3 37.50%
Yes, for maintenance. 5 62.50%
No, it doesn't matter. 0 0%
Voters: 8. You may not vote on this poll

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-28-07, 17:06
certus certus is offline
Registered User
 
Join Date: Dec 2003
Location: Canada
Posts: 710
Does formatting code matter?

I am currently doing impact analyis on a data model with a phenomenal number of PL/SQL data tests. There is no documentation, I have to read every datatest to determine if it will affect the addition of a new column to the model. All of the code is unformatted. My eyes have begun to bleed and I have asked the programming team to make my job easier by formatting their code. The Team Lead and Senior Oracle Developer tell me that "formatting code doesn't matter."

What do you think?
__________________
visit: relationary
Reply With Quote
  #2 (permalink)  
Old 06-28-07, 17:15
certus certus is offline
Registered User
 
Join Date: Dec 2003
Location: Canada
Posts: 710
Sorry about the poll not allowing multiple answers. Thought I had clicked on that option when setting up.
__________________
visit: relationary
Reply With Quote
  #3 (permalink)  
Old 06-28-07, 17:57
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
I vote for YES, period (full-stop in English ).
In development and for maintenance purposes.

Whenever you are looking at code it should be easily readable and easy to understand.
There's nothing worse than trying to find out where an If statement ends in a 100 line blob of code.

Just show them this: http://www.ioccc.org/1998/banks.c
Quote:
Since the fine folks over at the IOCCC have already compiled some of the most beautiful Ugly Code ever created (seriously – a C-based flight simulator with code shaped like an airplane – that’s impressive)
__________________
George
Twitter | Blog
Reply With Quote
  #4 (permalink)  
Old 06-28-07, 18:42
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
[x] Yes, for development.
[x] Yes, for maintenance.
[x] No, it doesn't matter.
[x] All of the above



why doesn't it matter? because really good code is a piece of cake to write, even unformatted, and certainly doesn't require maintenance
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 06-29-07, 10:33
certus certus is offline
Registered User
 
Join Date: Dec 2003
Location: Canada
Posts: 710
Rudy doesn't believe in safe sex, but he always uses a condom.
__________________
visit: relationary
Reply With Quote
  #6 (permalink)  
Old 06-29-07, 10:41
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 06-29-07, 10:53
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
No brainer. Basic good practice.
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #8 (permalink)  
Old 06-29-07, 10:56
jezemine jezemine is offline
another indirection layer
 
Join Date: May 2004
Location: Seattle
Posts: 1,312
definitely must format code.

if you suffer from a lack of documentation, see my sig.
__________________
elsasoft.org
Reply With Quote
  #9 (permalink)  
Old 06-29-07, 13:24
Brett Kaiser Brett Kaiser is offline
Window Washer
 
Join Date: Nov 2002
Location: Jersey
Posts: 10,303
I wish I could vote yes on both

But doersn't it mean that doing it for developement means that you have it for maint?

Maint, btw, what is that?
__________________
Brett
8-)

It's a Great Day for America everybody!

dbforums Yak CorralRadio 'Rita
dbForums Member List
I'm Good Once as I ever was

The physical order of data in a database has no meaning.
Reply With Quote
  #10 (permalink)  
Old 06-29-07, 13:39
certus certus is offline
Registered User
 
Join Date: Dec 2003
Location: Canada
Posts: 710
Hi Brett,

Maintenance is any work done to change the production system after initial development--addition of columns, minor changes to process. In my scenario maintenance changes tend to cascade throughout the system.

Since I started this post I have successfully persuaded my team to use TOAD's code formatter in the future. Minor victory. I don't have TOAD right now, so I don't even know how good it is yet. Also, the team won't be formatting legacy code. I just have to format the legacy code file by file with a text editor and then read it to determine if there is any impact.

Has anybody used TOAD's code formatter?

Rudy, that bicycle article give "humpin" a whole new meaning.

Will look jezemine and georgev.
__________________
visit: relationary
Reply With Quote
  #11 (permalink)  
Old 06-29-07, 14:03
certus certus is offline
Registered User
 
Join Date: Dec 2003
Location: Canada
Posts: 710
I am coining a new term: Code Slob

I think I am going to create design and sell it as a product at CafePress.

Gotta come up with a term for the nemesis of a code slob.
__________________
visit: relationary
Reply With Quote
  #12 (permalink)  
Old 07-09-07, 18:34
loquin loquin is offline
Super Moderator
 
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,797
Consistently formatted code costs less to produce, and it costs less to maintain, because it is easier to debug and troubleshoot.

On the other hand, to the compiler/interpreter, formatting DOES make no difference.
__________________
Lou
使大吃一惊
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert

Reply With Quote
  #13 (permalink)  
Old 07-10-07, 10:23
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,899
I am afraid I have to agree with the majority on this one. First thing I do when someone dumps a query in my lap is to reformat it using the "Crowley indentation" method. Maybeyourcoworkersliketotryreadingsloppycode,butId on't.
Reply With Quote
  #14 (permalink)  
Old 07-11-07, 13:14
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
I don't think it matters either way, however I find code that isn't formatted a pain to read, a pain to comprehend, and a pain to debug.

I don't like picking up code which isn't formatted, but thats the least of my concerns. Id rather have competantly written, tested & deployed code that looks rougher than a bears backside (providing I don't have to dive in and fix faults), than wonderfully well formatted and laid out code which doesn't do what is required.

I think there is a danger of confusion, it doesn't matter but its good practice at all levels, during design, testing and maintenance. I find it especially useful in languages such as PHP, C# and the like which use brackets to start and end code blocks, but I would never insist on it. Fundamentally the the clearer the code is the easier it is to understand (or should that read the less difficult it should be...)

I prefer to break apart the SQL in VB into separate elements eg the selects in one block, the joins in another, the parameters another. as far as the compiler is concerned its irrelevant.. The compilers bin such formatting, so its irrelevant to the codes function.

Heck if someone wants to pay me £25...40per hour to reformat their code I don't care, if they want to pay me to read their mangled code I don't care.. providing the cheque clears, thats fine by me.

if you are selling code to a third party there are tools that will deliberately obfuscate the code...
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #15 (permalink)  
Old 07-12-07, 11:34
certus certus is offline
Registered User
 
Join Date: Dec 2003
Location: Canada
Posts: 710
I've finally received my license for TOAD and I must say, it's code formatter is excellent. Such a tool should be built into every editor.

I want to thank everyone for their input. I've used what's been said to write an email to the team to urge them to go through the legacy code and use TOAD to format it for those who don't have TOAD licenses.
__________________
visit: relationary
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On