Your SlideShare is downloading. ×
Good programming
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Good programming


Published on

How to be a guru programmer. Wisdom for the best developers

How to be a guru programmer. Wisdom for the best developers

Published in: Technology

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Wisdom for Programmers Sung-Kook Han
  • 2.
  • 3. The RedMonk Programming Language Rankings: September 2012 1.JavaScript 2.Java 3.PHP 4.Python 5.Ruby 6.C# 7.C++ 8.C 9.Objective-C 10.Shell 11.Perl 12.Scala 13.Haskell 14.ASP 15.Assembly 16.ActionScript 17.R 18.Visual Basic 19.CoffeeScript 20.Groovy
  • 5.     void HandleStuff( CORP_DATA & inputRec, int crntQtr, EMP_DATA empRec, double & estimRevenue, double ytdRevenue, int screenX, int screenY, COLOR_TYPE & newColor, COLOR_TYPE & prevColor, StatusType & status, int expenseType ) {     int i; for ( i = 0; i < 100; i++ ) {  inputRec.revenue[i] = 0;   inputRec.expense[i] = corpExpense [crntQtr ][ i ];  } UpdateCorpDatabase( empRec );  estimRevenue = ytdRevenue * 4.0 / (double) crntQtr; newColor = prevColor;  status = SUCCESS; if ( expenseType == 1 ) { for ( i = 0; i < 12; i++ )   profit[i] = revenue[i] - expense.type1[i]; } else if ( expenseType == 2 ) {  profit[i] = revenue[i] - expense.type2[i]; } else if ( expenseType == 3 )  profit[i] = revenue[i] - expense.type3[i]; }
  • 6. 선서 나는 프로그램 고수들을 나의 멘토로 모시고, 그들의 지혜를 경청하고 실천하여, 프로그래밍의 본질을 깨우쳐 프로그래밍의 전설적 고수가 되고자 합니다...
  • 7. Define the problem completely. If you don't understand it, you can't program it. Without a good problem definition, you might put effort into solving the wrong problem. Be sure you know what you’re aiming at before you shoot.
  • 8. Think first, Program lately. Put the Mouse Down and Step Away from the Keyboard.. Throw away the keyboard !! Fire, Aim, Ready ?? Look before leap. Draw Diagrams !! Think twice, code once. Design first, then code.
  • 9. Use the top-down approach. Look at the whole picture !! Draw Diagrams !!
  • 10. Keep It Simple, Stupid! (KISS) Keep it short and simple. Occam's razor !! Everything should be made as simple as possible, but no simpler. - Albert Einstein
  • 11. Don’t Repeat Yourself. (DRY) Once And Only Once !! Duplication is Evil (DIE). Insanity: doing the same thing over and over again and expecting different results.
  • 12. Read The Fine Magazine. (RTFM) Read The Fine Manual. Read books, magazines, blogs, twitter feeds, and web sites. Always try to work with a mentor. If you can't find a mentor, consider moving on. Go to conferences. Listen to podcasts. Continuous Learning…
  • 13. Understand the Art behind the Language. Understand the philosophy of programming language. Understand the culture of your programming language !! Be aware of the specific strengths and weaknesses of the language you’re using. Choose the right programming language. Don’t limit your programming thinking only to the concepts that are supported automatically by your language.
  • 14. Divide and Conquer !! Modern software is inherently complex. Minimize the amount of essential complexity that anyone’s brain has to deal with at any one time. Don't Be Afraid to Break Things. Keep accidental complexity from needlessly proliferating.
  • 15. Modeling. Without good software modeling, you may have the right problem but the wrong solution. It may be impossible to have successful construction. Code is design. Model-driven architecture: MVC Model GoF: Design Patterns
  • 16. Abstraction !! Keep the level of the abstraction !! Encapsulate all in the side . Hide Secrets (Information Hiding). Localize them. Avoiding global data.
  • 17. Single Responsibility. Single Responsibility Principle: a class should have one, and only one, reason to change. Every piece of knowledge must have a single, unambiguous, authoritative representation within a system. -- Andy Hunt and Dave Thomas in The Pragmatic Programmer. Single Source of Truth in model-driven architectures.
  • 18. Defensive Programming A clever person solves a problem. A wise person avoids it. – Einstein Be careful for Exceptions, Errors, Warnings,… Make it fail-safe before you make it better. Protecting Your Program From Invalid Inputs. garbage in, nothing out / garbage in, error message out / no garbage allowed in Build Your Own Assertion Mechanism.
  • 19. Automate Your Coding Standard. Pretty Print (PP). Style !! Layout !! Format !! Hungarian notation by Charles Simonyi. Use (naming) conventions.
  • 20. Iterate, Repeatedly, Again and Again Programming is neither fully an art nor fully a science. As it’s typically practiced, it’s a “craft” that’s somewhere between art and science. -- McConnell 2004 A first attempt might produce a solution that works, but it’s unlikely to produce the best solution. Don't be afraid to start over
  • 21. Programmer(programming) Comments are not evil. Provide good documentation. Don't just echo code in comments - make every comment meaningful.
  • 22. Choose Your Tools with Care. Right Programming Language and Right Tools !! Design Tools // Source-Code Tools // Executable-Code Tools Tool-Oriented Environments Building Your Own Programming Tools Discipline is the best tool.
  • 23. Ask "What Would the User Do?" You are not the User. Use case analysis. The User is the King. The user is Dummy. User-Friendly.
  • 24. Pieces of the advice  Never assume the computer assumes anything.  Don't patch bad code - rewrite it.  Make sure all variables are initialized before use.  Choose a data representation which makes the program simple.  Be sparing with temporary variables.  Parenthesize to avoid ambiguity.  Avoid side effects  Use library functions.  Choose a data representation which makes the program simple.  Test input for plausibility and validity.
  • 25. Be Open Mind !! Refuse to pretend you’re an expert when you’re not. Readily admit your mistakes. Get excited about programming !! Open, Share, Communicate, and Cooperate !! .
  • 26. References.
  • 27. Very Simple Quiz: What’s wrong ? // Compute roots of a quadratic equation. // This code assumes that (b*b-4*a*c) is positive. temp = Sqrt( b*b - 4*a*c ); root[O] = ( -b + temp ) / ( 2 * a ); root[1] = ( -b - temp ) / ( 2 * a ); ... // swap the roots temp = root[0]; root[0] = root[1]; root[1] = temp; for ( int i = 0; i < numPayCodes; i++ ) { for ( int j = 0; j < 12; j++ ) { for ( int k = 0; k < numDivisions; k++ ) { sum = sum + transaction[ j ][ i ][ k ]; } } }