Skip to main content

Three things I learnt from The Pragmatic Programmer - Chapter 4

 Three things I learnt from The Pragmatic Programmer - Chapter 3. Link to chapter 1 here. 

1. Balance Resources. If you have a large piece of data that is accessed in your program, don't forget to close it. If a variable, set to 'Null' when done so garbage disposal can delete it. Always allocate resources in the same order, and de-allocate in the reverse.

2. No one writes perfect code - use assertions to check you have the data you expect. You can't rely on testing to catch every eventuality.

3. Avoid big feedback delays, try things out in small steps instead. Try using REPLs to understand a new API. Use unit tests on new pieces of code.

Link to next chapter here.

Comments

Popular posts from this blog

Three things I learnt from The Phoenix Project

Recently I read the Phoenix Project by Gene Kim, George Spafford, and Kevin Behr. Here are the things I learnt: 1. I much prefer reading a novel to a textbook. This was a great book to trick my brain into learning DevOps basics without having to read a textbook. I shall have to find more books like this. 2. DevOps is when developers and operations work together to create a seamless process that delivers features quickly. 3. Good IT teams could often use the following: - Kanban boards for visibility of all work that's in progress - Teams where knowledge is shared and documented instead of staying with one person - All people understanding the prioritisation of their tasks - Prioritisation of tasks to follow the goals of the business as a whole - Well designed environments and processes so that changes can be deployed up to multiple times per day into production - Security and controls that are built into deployment - Management that is open to change I enjoyed this book and will rea...

Three things I learnt from The Pragmatic Programmer - Chapter 2

  Chapter 1 link here I'm currently reading  a book called  The Pragmatic Programmer  by David Thomas and Andrew Hunt. The first chapter is an easy read, all common sense. The second chapter starts introducing code and is a little more technical. Here are three things I learnt from the second chapter: 1. Every design principle is there to make your code easier to change (ETC). If you're not sure what code design principles to follow and when, use ETC as a guide. 2. Eliminate effects between unrelated things. (Increase orthogonality - parts of code that don't rely on each other). Keep code decoupled, avoid global variables, avoid similar functions, be careful of third part toolkits. 3. Get good at estimating. Every time you have a task, estimate how long it will take. Think about each little step in the task before you provide an answer. When you finish the task write down how long it took, and if you can, why your estimate was wrong. You'll learn to spot patterns....

Three things I learnt from The Pragmatic Programmer - Chapter 3

Three things that I learnt from the Pragmatic Programmer - Chapter 3.  Link to chapter 1 here.   1. Achieve editor fluency to make you so much faster. Try to do the following without using the mouse and preferably in one keyboard combo:     - select characters, words, lines, paragraphs      - format and indent code       - comment/uncomment block of code      - undo and redo changes     - spilt the editor into multiple panels     - navigate to a line number     - search for strings     - create multiple cursors based on a search term     - run all tests     - find compilation errors 2. Debugging but can't find a bug? Use the Binary Chop method - split code in half. Which half causes the bug/gives you unexpected values? Repeat. Most efficient way to track it down. 3. Keep an 'Engineering Daybook' or personal physical notebook. Keep important things you jot down in ...