Author Topic: programming style/formatting  (Read 1514 times)

0 Members and 1 Guest are viewing this topic.

wizman

  • Bull Frog
  • Posts: 290
programming style/formatting
« on: December 16, 2007, 12:46:17 PM »
hi to all, i would like to ask for a good reference on programming style and formatting. Ive been seen codes which are neatly written,
are there any rules for building a program's structure?Thanks.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: programming style/formatting
« Reply #1 on: December 16, 2007, 01:43:57 PM »
Off the top of my head ...

• consistency applies to all that follows
• remember you're writing for humans, not just for the computer
• write all code so that a stranger can understand it one year from now without your presence / coaching
• generally speaking provide high level comments; what is the program trying to solve / achieve?
• use camel case, pascal case, Hungarian notation ... whatever spins your propeller
• name classes / modules / functions / variables meaningfully so code is self documenting (nouns and verbs)
• use comments where preceding fails to illuminate
• avoid magic / clever code that you may not understand a year from now
• indent to easily demonstrate hierarchy / parentage
• don't be afraid to use white space liberally
• if you have a problem defining your own style find someone's style you like and mimic it until your own style emerges

That's all I've got for now ...

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

wizman

  • Bull Frog
  • Posts: 290
Re: programming style/formatting
« Reply #2 on: December 16, 2007, 08:50:59 PM »
Good pointers MP, thanks for your reply,  :-)