The Art of Computer Programming

is what you get here

Created by Vikram Pudi / vikram@iiit.ac.in

Why Master Programming?

  • Automate anything that is:
    • repetitive (boring, tedious,...)
      • DRY Principle: Don't repeat yourself.
    • dangerous
  • People = lazy. Every task gets boring and tedious.
  • Man-power = costly.
  • Automation is the future. Don't worry about unemployment!

Express Yourself!

  • Design and create your own worlds!
  • Build systems that have an impact on society.
  • Create your own company.

You are a master when you

Learn to use documentation.

  • Windows: Help
  • Linux: man pages, info pages, apropos
  • Internet: use right keywords on google; stack-exchange, ...
  • Text books, Online tutorials
  • People

The One and Only Technique

To write any program to solve a problem

  • First be able to solve the problem yourself, manually (40%)?
  • Introspect (40%)?
    • Notice the sequence of steps that you follow to do the task
  • Write the code (10%)?

Well, there is one more technique

The Magic of Modularity

  • Split your task into functions
  • When writing a function, don't worry about how other modules will work
    • Assume that they will work
  • Then, writing that function will be simple
  • Writing the next module will be simpler!

Yeah, there are more techniques

  • Avoid premature optimization - use profiling to find areas to optimize
  • Focus on readability
    • Simple = Easy to (write, read, modify)
    • Take trouble in choosing meaningful names for variables / functions
    • Indent properly - it is like putting paragraphs in text
    • Concise is better, but avoid hard-to-read cryptic code
    • If a few lines of stock code is repeatedly written, separate it out into a function
  • Refactoring
    • Be prepared to throw out your program and rewrite it better - it won't take that much time

The 3 Virtues of a Programmer

Laziness

The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don't have to answer so many questions about it.

Hence, the first great virtue of a programmer.

Impatience

The anger you feel when the computer is being lazy. This makes you write fast programs fast that don't just react to your needs, but actually anticipate them.

Hence, the second great virtue of a programmer.

Hubris

Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people can't say bad things about.

Hence, the third great virtue of a programmer.

Computer Hygiene

  • Neat and tidy work-place
  • Document and indent code
  • Take backups
  • Regular breaks
    • mini-break (30 seconds) every 15 min
    • short-break (5 minutes) every 1 hour

Grading Policy (Tentative)

  • Assignments = 20%
  • Labs = 20%
  • Lab Tests (2 tests) = 20%
  • Mid Sem Exams (2 exams) = 25%
  • End Sem Exam = 15%

For Academic Code of Honour

click here

THE END

BY Vikram Pudi