DEV Community

Cover image for 100 Tips from The Pragmatic Programmers Book: Part 5/10
Rajesh Royal
Rajesh Royal

Posted on

3 1 1 2 1

100 Tips from The Pragmatic Programmers Book: Part 5/10

5.1. Act Locally.

Keep the scope of mutable variables and open resources short and easily visible.

 

5.2. Take Small Steps—Always.

Small steps always; check the feedback; and adjust before proceeding.

 

5.3. Avoid Fortune-Telling.

Only look ahead as far as you can see.

 

5.4. Decoupled Code Is Easier to Change.

Coupling ties things together, so that it’s harder to change just one thing.

 

5.5. Tell, Don’t Ask.

Don’t get values from an object, transform them, and then stick them back. Make the object do the work.

 

5.6. Don’t Chain Method Calls.

Try not to have more than one dot when you access something.

 

5.7. Avoid Global Data.

It’s like adding an extra parameter to every method.

 

5.8. If It’s Important Enough To Be Global, Wrap It in an API.

…but only if you really, really want it to be global.

 

5.9. Programming Is About Code, But Programs Are About Data.

All programs transform data, converting an input into an output. Start designing using transformations.

 

5.10. Don’t Hoard State; Pass It Around.

Don’t hang on to data within a function or module. Take one down and pass it around.

 
Thanks for reading, happy coding 😀

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more