Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc....

22
1 www.teratech.com 1/20 How to become a Guru Coder Michael Smith, TeraTech, Inc. [email protected] http://www.teratech.com 301-424-3903 x110 Copyright TeraTech 2004

Transcript of Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc....

Page 1: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

1 www.teratech.com 1/20

How to become a Guru Coder

Michael Smith, TeraTech, [email protected]://www.teratech.com

301-424-3903 x110

Copyright TeraTech 2004

Page 2: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

2 www.teratech.com 2/20

Overview

What makes a smart coder? Brains or communications skills?

Does commenting matter to real programmers?

My Code is my Comment. What tips can you learn to become

a true programming guru?

Page 3: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

3 www.teratech.com 3/20

Speaker InformationWho am I? Michael Smith President of TeraTech, Inc Rockville

MD http://www.teratech.com/ ttWebReportServer, CFXGraphicserver

MDCFUG, CFUN-03, Fusebox Conf Articles in CFDJ, Fusion Authority Winner CFDJ award Best Consulting

Page 4: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

4 www.teratech.com 4/20

Programming Experience

22 years programming 7 years with ColdFusion 4 years with Fusebox Also work with SQL, JavaScript, HTML,

VB, Oracle, Access Teach one-on-one and custom classes On site and custom development Fusebox and Process Methodology

Page 5: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

5 www.teratech.com 5/20

Does character matter?

Studies show that 85% of a programmers success is due to human factors rather than pure technical skills.

Page 6: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

6 www.teratech.com 6/20

Humble

My brain can’t take in the whole program at once Use coding crutches Egoless programming Code reviews Ask for help if stuck > 15 minutes Murphy’s law Examples in comments Reference Change Tracker issue# and Desc Document algorithm used Rewrite complex code

Page 7: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

7 www.teratech.com 7/20

Curious

How can I improve? Constantly learning Experiment Problem solving and planning skills Case studies - Programming Pearls,

alphablox.com, open source sourceforge.net RTFM and magazines, websites Have challenging projects Google skills

Page 8: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

8 www.teratech.com 8/20

Honesty

I don’t know I was wrong Fix bugs rather than covering up Understand code before you run it True status reports – including “bad” news Stand by accurate estimates

Page 9: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

9 www.teratech.com 9/20

Communication skills

WORM code, not WMRO code Write code for humans to read, not for computer to

run Clear emails Use the phone

correct understanding Get extra information

Listen to upsets, allow let off steam Remember the user – actors, photo, useability

testing

Page 10: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

10 www.teratech.com 10/20

Coding conventions

Save having to think about that part of code Variable naming Database naming Correct spelling propagates Indenting Case Avoid poor constructs Scope variables, avoid public http://www.cfug-md.org/articles.cfm#code

Page 11: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

11 www.teratech.com 11/20

Coding conventions

Save having to think about that part of code

Variable naming Indenting

Clarifies meaning Case Avoid poor constructshttp://www.cfug-md.org/articles.cfm#code

Page 12: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

12 www.teratech.com 12/20

Lazy

Write smart code instead of repetition of code Write or use a tool instead of repeating steps by hand Macros in your code editor Use a pre-built tool instead of reinventing the wheel Write less code – copy existing code, searchable

library of code Using template, existing document Consistent look between programmers and projects

Page 13: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

13 www.teratech.com 13/20

Prioritize

Plan before you Code before you Debug

Think before you Document before you Code before you Run

Test as you go

Page 14: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

14 www.teratech.com 14/20

Not as important

Persistence – pigheaded Experience – is 10 years of experience or

10 x 1 year’s experience? Jolt programming – all nighters Code disappear can be good – chance to

rewrite Avoid tweaking for ever for perfect code

Page 15: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

15 www.teratech.com 15/20

Good habits

Code and understand before running End loops before coding the “filling” Don’t go long with code “broken” Plan before coding Figure out how you will test code before coding Take a break; sleep on problems “Telephone” review of problem to a buddy Write algorithm on whiteboard – diagram Comment to relate distant open and close tags

Page 16: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

16 www.teratech.com 16/20

Reduce complexity

Avoid global data Short routines, few parameters Limited nesting Data driven vs complex logic Named constants – rather than magic numbers Descriptive names – variable, database, files, short,

no weird characters Comment – see below rather than break up code Don’t make code or comments horizontally, printable

Page 17: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

17 www.teratech.com 17/20

Modularize to simplify

Hide details – black box De-Couple routines Cohesion – do one thing well Test parameters

Page 18: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

18 www.teratech.com 18/20

Code for humans to read

WORM code is easier to: Understand Review Less errors Faster to debug Easier to modify Faster to develop overall

Sets a good habit

Page 19: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

19 www.teratech.com 19/20

Defensive coding

If it can go wrong it will go wrong Check parameters exist and data type Throw errors if assumptions not met Always code the ELSE part of IF

Page 20: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

20 www.teratech.com 20/20

Debugging

If you can prove your algorithm must work It is less effort to Debug.

Test Parameters at and beyond their limits. (Some tests must show a failure)

Keep it Simple, Stupid (Kiss) If you can’t remember what it does, how can it be

maintained? Use debug mode variable to get extra info, stop page

execution, save to file, email to self Take a break, take different approach Use multiple catches

Page 21: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

21 www.teratech.com 21/20

Resouces

“Code Complete” – Steve McConnell “The Mythical Man-Month” by Frederick

Brooks “Peopleware” by Tom Demarco, et al

Page 22: Www.teratech.com 1/20 1 How to become a Guru Coder Michael Smith, TeraTech, Inc. michael@teratech.com  301-424-3903 x110 Copyright.

22 www.teratech.com 22/20

Questions?

Email me at

[email protected]