the cat
S.16

A review: The Pragmatic Programmer

A review of the book: The Pragmatic Programmer

21 May 2022 · review · software development

Hello, this is an attempt to condense this classic book to about.. some very less words, hoping to still capture the core of each topic.

The article should be kept as a reference to the important pointers. However, make a point of reading this book: seriously. :crossed_fingers:

Resource: https://bit.ly/2ARPd7e


Chapter 1: A Pragmatic Philosophy

We who cut mere stones must always be envisioning cathedrals!

It's a continuous process: coding.

The greatest of all weaknesses is the fear of appearing weak.

Take responsibility. Provide solutions not excuses.


Software Entropy


Good enough software

Know when to stop.


Invest in Knowledge

It always pays pays interest: knowledge.

Knowledge and experience are you most professional assets.


Communicate

"I believe it is better to be looked over than it is to be overlooked."

Chapter 2: A Pragmatic Approach

Don't Repeat Yourself!

Don't duplicate knowledge throughout your system.

Make it easier to reuse code than to write it yourself.


Orthogonality

Decouple.

Separate the infrastructure from the application.

The larger the people needed when discussing changes, the less orthogonal the team is.


Reversibility

Be constantly critical of your code.

Refractor!

There's nothing more dangerous than an idea if it's the only one you have.

Critical decisions are not easily reversible; however, there are no final decisions.

Have a flexible architecture. Whatever mechanism you use, make it reversible.


Tracer bullets

Because projects take time, you can pretty much guarantee environment to change before you are done.

A tracer bullet is something that gets us from a requirement to some aspect of the final system quickly, visibly, and repeatably. It shows what you are hitting(user requirements), you then adjust your aim until you hit the target. This is the point.

A prototype is something that gets you intelligence gathering and trying out ideas. It is disposable.

There is luxury in self-reproach. When we blame ourselves we feel no one else has a right to blame us.

- If it can't happen, use **assertions** to ensure that it won't.
- Don't use assertions in place of real **error handling**.

---

### Balancing and exceptions

- Exceptions should be reserved for **unexpected** events.

An error handler is a routine that is called when an error is detected.

- **Balancing resources**:
    - Finish what you start. The routine allocating a resource should be responsible for **deallocating** it.
    - Nest allocations..

        These are routines needing more than one resource at a time.

        - Deallocate in **LIFO**.
        - When allocating same set of resources in different places, **allocate in same order**. This reduces deadlock.

    It is always a good idea to build code that actually checks that resources are indeed **freed appropriately**.

   > Check for **memory leaks** too.

Chapter 5: Bend Or Break

We need to make effort to write code that's as flexible as possible.

Good fences make good neighbours.


Decoupling

Minimise coupling.


Metaprogramming

No genius can overcome a preoccupation with detail.

Configure, don't integrate.


Temporal coupling- About time: concurrency and ordering.

We need to allow for concurrency.

Analyse workflow to improve concurrency.

Events- Can be used to signal changes in one object that some other object may be interested in.

Don't spam objects!!

Separate views from models.


Chapter 6: While You Are Coding

Coding is not mechanical. There are decisions to be made every minute.

Program deliberately!


The O-Notation.


Refractoring

Code needs to evolve, it is not static.

Refactor early, refactor often.


Write Code that's Easy to Test.

Use a test window:

Test your software, or user users will!

Don't use wizard code that you don't UNDERSTAND.


Chapter 7: Before The Project

Don't gather requirements, dig for them.

Abstractions live longer than details.


He who hesitates is sometimes saved.

Listen to any nagging doubts- start when you are ready.

Don't be a slave to formal methods.


Chapter 8: Pragmatic Projects

Quality is a team issue.

Organise team around functionality, not job functions.

Civilisation advances by extending a number of important operations we can perform without thinking.

Don't use manual procedures.


Find bugs once.


The palest ink is better than the best memory.

Build documentation in, don't bolt it in.


Sign Your Work!

Signed off,

A writer has no name. ;)