How To Be A Programmer

Author:Robert L Rea

Introduction

Personal opinions of the authors. Focuses on social problems and summarizes the skills needed for a programmer.

Beginner

Personal Skills

Learn to Debug

  • To debug is to remove errors
  • To get visibility into the execution of a program you must be able to execute the code and observe something about it.
  • Ways:
    • Debugging tools: useful but
    • Printlining: Producing a simple, usually temporary, log.
    • Logging: Logging is the practice of writing a system so that it produces a sequence of informative records, called a log.

How to Debug by Splitting the Problem Space

  • divide and conquer technique
  • mental model: Space of executed lines, data structure, memory management, interaction with foreign code.
  • Once you have evenly subdivided the space of all that can go wrong, you must try to decide in which space the error lies.

How to Remove an Error

  • In fixing a bug, you want to make the smallest change that fixes the bug.
  • The best process for this is to be able to easily reproduce the bug, then put your fix in place, and then rerun the program and observe that the bug no longer exists.

How to Debug Using a Log

  • Logging is the practice of writing a system so that it produces a sequence of informative records, called a log.
  • Too much information makes the log expensive and produces scroll blindness.
  • Too little information and it may not contain what you need.
  • each record in the log will identify its position in the source code, the thread that executed it if applicable, the precise time of execution, and, commonly, an additional useful piece of information, such as the value of some variable, the amount of free memory, the number of data objects, etc.

How to Understand Performance Problems

  • Before you try to make it faster, you must build a mental model of why it is slow.
  • To do this you can use a profiling tool or a good log to figure out where the time or other resources are really being spent.

How to Fix Performance Problems

  • The key to improving the performance of a very complicated system is to analyze it well enough to find the bottlenecks.

How to Optimize Loops

  • First try to see if you can find a way to remove it completely.
  • Then try to remove floating point operations.
  • Don't allocate new memory blocks unnecessarily.
  • Move I/O into a buffer.
  • Try not to divide.
  • Try not to do expensive typecasts.
  • Move a pointer rather than recomputing indices.

How to Deal with I/O Expense

  • To build a fast system you need to improve I/O.
  • Two techniques:
    • caching
    • representation: approach of making I/O cheaper by representing data more efficiently.

How to Manage Memory

  • You might need a garbage collector.
  • Hash tables cause memory leaks.

How to Deal with Intermittent Bugs

  • What makes it hard is that it occurs only under unknown conditions.
  • Try to reproduce the bug in a controlled way.

How to Learn Design Skills

  • To learn how to design software, study the action of a mentor.
  • Then study well-written pieces of software.
  • Then you must do it yourself.

How to Conduct Experiments

  • Testing systems with small examples to verify that they conform to the documentation.
  • Testing small code changes to see if they actually fix a bug
  • Measuring the performance of a system under two different conditions due to imperfect knowledge of there performance characteristics
  • Checking the integrity of data, and
  • Collecting statistics that may hint at the solution to difficult or hard-to-repeat bugs.

Team Skills

Why Estimation is Important

Good estimation provides predictability.

How to Estimate Programming Time

  • Take time for investigation.
  • Any risk factor that you can identify and assign an estimate to should go into the schedule.

How to Find Out Information

  • To find information about concrete things you can ask people or search the internet.
  • If you need general knowledge about something subjective try the library.
  • If you need to know how to do something that is not trivial get two or three books on the subject and read them.
  • fI you want to make a personal decision that only you can make like whether or not you should start a business, try putting into writing a list of arguments for and against the idea.

How to Utilize People as Information Sources

The benefits of communication must be weighed against the costs.

How to Document Wisely

The truth is cold and hard: documentation, like testing, can take many times longer than developing code.

Intermediate

Personal Skills

How to Stay Motivated

  • Use the best language for the job.
  • Look for opportunities to apply new techniques, languages, and technologies.
  • Try to either learn or teach something, however small, in each project.

How to be Widely Trusted

To be trusted you must be trustworthy. You must also be visible.

How to Tradeoff Time vs. Space

Time (processor cycles) and space (memory) can be traded off against each other.

How to Stress Test

At first it appears that the purpose of stress testing is to find out if the system works under a load. In reality, it is common that the system does work under a load but fails to work in some way when the load is heavy enough.

How to Balance Brevity and Abstraction

Abstraction is key to programming. You should carefully choose how abstract you need to be.

How to Learn New Skills

Humans learn by doing. To learn any skill, you have to put yourself in a forgiving position where you can exercise that skill. When learning a new programming language, try to do a small project it in before you have to do a large project. When learning to manage a software project, try to manage a small one first.

Communication Languages

These languages are designed specifically to facillitate communication through standardization.

  • UML is a rich formal system for making drawings that describe designs
  • XML is a standard for defining new standards.
  • SQL is a very powerful and rich data query and manipulation language

Team Skills

How to Manage Development Time

Judgment

Advanced

Technological Judgment

Compromising Wisely

Serving Your Team

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.