Seven Habits of * Highly Effective Developers * YMMV
Lee Chuk Munn Staff Engineer Sun Microsystems
[email protected]
1 – Understand the Problem • “Computer science is no more about computers than astronomy about telescopes” - Dijkstra • Programming is about problem solving > Focus on the problem > Programs are expression of the solution
• “Think outside the box” > What if there is no box? > Define the boundaries of the problem
1 – Understand the Problem • Bounce problem off people > Do not isolate yourself > Talk with a person face to face, avoid
email if possible
> Never know where the discussion may lead
• Avoid “The first solution syndrome” > Resist the urge to pick the first solution
or use the first API especially if you are under pressure
• Research, research, research > Real data, real use cases
2 – Use Appropriate Tools • “If the only tool you have is a hammer, you will see every problem as a nail” Abraham Maslow • Programming concepts and data structures > Learn programming not programming
languages > Remember your basics
• Build a reservoir of design patterns > Solutions to design problems
2 – Use Appropriate Tools • Use a variety of tools > Tendency is to stick with what we are
comfortable with > One per project is a good time frame to pick up tools > Compare and contrast tools
• Do not be dogmatic > The problem should dictate the tool, not
the other way round
2 – Use Appropriate Tools • Use tools creatively > Javadoc and XDoclet (Rickard Öberg)
• Develop your own tools if nothing is appropriate > Project specific if need be > Time spend on tool allows you to be
efficient
> Might open new business opportunities
3 – Strive for Simplicity • “Simple things should be simple. Complex things should be possible” Alan Kay • Simplicity reflects your understanding of the problem > Really easy to develop complex and
convoluted systems > Test – simple rules → complex behaviour
• Simplicity does not mean “simplistic”, > Does not mean crippled or for beginners > Tic-tac-toe is a simplistic game, Tetris is a
simple game
3 – Strive for Simplicity • Easy to understand, easy to explain, easy to maintain, easy to document > “... debugging is twice as hard as writing
a program...”
• Steps I take to assume some degree of simplicity > Assume that your users is at least as
smart as you > Do not duplicate functionality > Try to use simple structures throughout > If you are stuck, walk away to think about it
4 – Keep Your Code Clear • Code for others to read > Chances are you will be reading it again
• Comment your code > Especially if you are doing clever things > You may forget the next week > Personally do not like to comment code > Extreme view – commenting code means that you code cannot be understood easily
• Keep methods short and simple > Good indication is the names you choose
for methods
4 – Keep Your Code Clear • Only incorporate code that you understand > Especially when you are copying it from
somewhere else > You cannot maintain what you do not understand
• Express your code in the idiom of that language > Do not try to write Ruby programs like
Java
4 – Keep Your Code Clear • Aesthetics and layout of the code > Nobodyisgoingtobeabletoreadevenifitisbr
illiant > Alt-Shift-F in most IDE reformat your code!!!!
• Fine line between abstraction and obfuscation > Do not erase that line
5 – Learn to Debug • “Each problem that I solved becomes rule which served afterwards to solve other problems” - Rene Descartes • Bug comes and goes, debugging skill accumulates > The debugging process is more important
than the bug
• General things that I do > Collecting information is essential > Observer the behaviour of the bug > Isolate the code by making a stand-alone
version
5 – Learn to Debug • Get a good tool to allow you to follow code > Like reading a novel – difficult if words
too small, or book falling apart > My favourite is vim and ctags / cscope
• Lay the foundation for debugging > Logging/debug statements > Asserts – supported since JDK 1.4 > MBeans for dynamically for stats, debug
level, etc.
5 – Learn to Debug • Write test cases to catch bug early
> “The Way of Testivus” > http://www.agitar.com/downloads/TheWayOfT
6 – Leverage What is Available • “If I have seen further it is by standing on the shoulders of giants” Isacc Netwon • Look for available solutions or algorithms > Google is your friend, open source
software
• Adopt a frameworks if possible > Standardize the way an application is
developed > Application becomes robust on mature frameworks
6 – Leverage What is Available • If you know someone who is a subject matter expert, even better! • Search appropriate forums and mailing list > Your problem is not unique > Be persistent - “I posted this problem 3
days ago and no one answered me”.
> If you want it bad enough, it can be solved
> Make it easy for others to help you > Research your problem > Phrase questions so that it can be answered easily
6 – Leverage What is Available • Start your own group > Lots of resources, Yahoo Groups,
Facebook are good starting place > Self help, self sustaining
• BragBlog about your predicament > Solicit feedbacks
7 – Plan Ahead • “It is better to know some of the questions that all the answers” James Thurber • Anticipate what you will need soon > Know where to get help, articles, books
• Off-the-job learning – no pressure to find a “solution” > Browse some good technical web sites
for info
> Save interesting articles for offline reading Zotero
7 – Plan Ahead > Maximize your learning > Type out the code rather than CTRL-C CTRL-V > Learn a lot more
• Know the trends – what are you opinion of them? > “There are two ways to slide easily
through life; to believe everything or to doubt everything. Both ways saves us from thinking” - Alfred Korzybski
7 – Plan Ahead • Be proficient in the tools that you are going to use > Side projects (1 – 4 weeks) that uses it > Side effect is keeping your programming /
debugging / typing skills sharp
• Learn from your past programs/codes, bad and good > All our projects have something to teach
us > “Happy families are all alike; every unhappy family is unhappy in its own way.” - Leo Tolstoy
Summary
1.Understand the problem 2.Use appropriate tools 3.Strive for simplicity 4.Keep your code clear 5.Learn to debug 6.Leverage what is available 7.Plan Ahead
Seven Habits of * Highly Effective Developers * YMMV
Lee Chuk Munn Staff Engineer Sun Microsystems
[email protected]