- Act with Prudence
- take extra care to avoid tech debt
- if you must accrue it, track cost appropriately
- Apply Functional Programming Principles
- learn to apply functional principles to make your code simpler and easier to debug
- Ask, “What Would the User Do?” (You Are Not the User)
- the user may not think like you
- best way to understand them is to watch them
- Automate Your Coding Standard
- automate checking of standards and incorporate into build process
- Beauty is in Simplicity
- strive for readability, maintainability, speed of development and beauty
- enabled by simplicity
- Before You Refactor
- assess current code base, refactor incrementally, ensure test coverage for changes
- make sure refactor for valid reasons
- refactors can fail, assess risk
- Beware the Share
- shared code increases dependency
- similarities may be accidental
- check your context first
- The Boy Scout Rule
- leave campground cleaner than you found it
- systems would gradually improve
- Check Your Code First Before Looking to Blame Others
- more likely issues are due to your code than underlying technologies if mature
- Choose Your Tools with Care
- tools have different assumptions, lifecycles and maintenance costs
- start small and can try to isolate to avoid lock-in
- Code in the Language of the Domain
- code in the domain not algorithms
- make domain concepts explicit
- Code is Design
- in construction, reduced build cost would reduce design quality
- speed becomes central push, pressure to use incomplete design
- tests are simulations and design not complete until validated
- need to dedicate yourself to mastering design craft
- Code Layout Matters
- read code more
- easy to scan with standardized patterns
- compact, fit less state in head
- Code Reviews
- make reviews about not only fixing mistake but also share knowledge and establish common guidelines
- share burden with roles and involve other people
- Coding with Reason
- divide sections and argue correctness with peer
- avoid goto, global vars
- use small scope, immutable objects, descriptive names, few params, narrow interface, avoid setters
- A Comment on Comments
- use comments they are not evil
- header comments for providing info on how to use
- inline comments for someone trying to edit/fix
- Comment Only What the Code Cannot Say
- comments should be treated as code
- Continuous Learning
- responsible for your own education
- books, hand-on, mentor, study framework/libraries, teach, conferences, podcasts, learn domain
- when fixing bug, try to really understand what happened
- Convenient Is Not an -ility
- good API’s follow consistency and forms vocabulary for an expressive language
- convenience of caller
- easy to use
- Deploy Early and Often
- make sure assumptions made in development environment hold
- refactor deployment process as you go
- Distinguish Business Exceptions from Technical
- handle business and technical exceptions separately
- mixing can confuse the caller
- Do Lots of Deliberate Practice
- getting better is about deliberate practice, not just completing the task
- repetition and increasing mastery
- practice something you’re not good at
- Domain-Specific Languages
- take target audience into account and adapt the technical level of the language
- Don’t Be Afraid to Break Things
- don’t be afraid to improve code
- care for general health of the code
- Don’t Be Cute with Your Test Data
- always consider what can happen if your work becomes public
- Don’t Ignore That Error!
- always handle errors for more robust and secure code
- Don’t Just Learn the Language, Understand Its Culture
- language is more than syntax, learn the patterns
- enriches your understanding of design patterns and makes you more capable in your language
- Don’t Nail Your Program into the Upright Position
- avoid complex intertwined exception handlers
- leave useful trail
- Don’t Rely on “Magic Happens Here”
- if not actively involved, the unconscious tendency is to assume they are simple
- when magic stops, project can be in trouble
- good to understand some and appreciate someone who does understand it
- Don’t Repeat Yourself
- remove maintained code, source of future bugs and complexity
- repeated processes that can be automated should be and standardized
- design patterns address repetition in logic e.g. factory, strategy, also structures like db schemas
- repetition can be necessary in order to meet performance or other requirements, but should only do when it addresses an actual problem
- Don’t Touch That Code!
- local, development, staging, production
- developers shouldn’t have access beyond development
- QA shouldn’t touch development server
- only release manager should have access to both
- development should never have access to production server
- if issues, fix and roll a patch
- production is not the place to fix it
- Encapsulate Behavior, Not Just State
- objects not just record types
- don’t wrap all business logic in a big manager or service object
- breaks encapsulation and methods are easily broken
- Floating-Point Numbers Aren’t Real
- floating-point numbers are imprecise and can result in subtle errors
- understand spacing
- do not use for financial applications
- floating intended for efficient scientific computation
- Fulfill Your Ambitions with Open Source
- can work on almost any kind of project
- need to be willing to give up free time but grow faster
- see how someone else would implement a solution
- real life experience in tech that interests you
- volunteer to add documentation and tests to get started
- The Golden Rules of API Design
- It’s not enough to write unit tests for an API you develop, need to write unit tests for code that uses your API
- will learn hurdles users will have to overcome when they try to test their code independently
- The Guru Myth
- people asking super general questions gurus to know the answer when they usually are better equipped to answer it
- guru is from dedicated learning and refinement of thought process
- not a magical barrier, but a continuum in which anyone can advance
- gurus don’t contribute to the growth of their peers
- need people willing to develop other experts
- Hard Work Does Not Pay Off
- software development is a marathon
- requires observation of effects and adjustments
- need to learn more about software development in general and programming techniques
- also requires constant learning and keeping up to date which you cannot do if always working on the project
- How to Use a Bug Tracker
- good report says how to reproduce, what should happen and what did happen
- get clarification and more context on bug
- take time to explain why closed or changed prioritization to save justification time in future
- make sure there is a place where everyone can find and query
- Improve Code by Removing It
- remove unneeded code YAGNI
- code should add value not amuse you
- extra code always takes longer to write and maintain
- do not invent extra requirements
- Install Me
- if making software for others make it extremely clear what it will do and make easy to use and learn
- Interprocess Communication Affects Application Response Time
- often poor response times due to IPCs looking at algorithm and DS less helpful
- some strategies 1) optimize to fetch only what you need 2) parallel 3) cache
- Keep the Build Clean
- try to have a zero-tolerance policy for compiler warnings
- not useful if there are many / ignoring takes mental work
- fix, suppress, or change policy to reflect what you care about
- Know How to Use Command-Line Tools
- don’t only rely on IDE’s they make decisions for you
- CLI’s help you understand what is going on under the hood
- some tasks easier and better automated with CLI
- Know Well More Than Two Programming Languages
- learn multiple languages and different paradigms: FP, OOP, procedural, logic, dataflow
- cross-fertilization is core of expertise
- learn idioms not just syntax
- Know Your IDE
- can enforce style rules
- many never progress beyond most basic usage
- memorize keyboard shortcuts
- Know Your Limits
- understand the capabilities of algorithms, systems, and runtime complexities
- Know Your Next Commit
- understand what you’re working on and why
- don’t go into a speculative mode without noticing
- decompose
- Large, Interconnected Data Belongs to the Database
- databases are powerful
- used to be expensive, complex, but not now
- handles relationships and indexing
- Learn Foreign Languages
- important to not only understand machine language, but different teams/people also have their own context-specific language
- Learn to Estimate
- when estimating distinguish between an estimate, target, and commitment
- estimates should not be what is acceptable to the manager
- Learn to Say, “Hello, World”
- you can try to run small snippets and experiment outside of integrated project environment
- Let Your Project Speak for Itself
- give project a voice for code metrics/test coverage
- can be done with email or instant message
- more effective to use extreme feedback device e.g lamp
- The Linker is Not a Magical Program
- learn how it works
- concats code, connects references to symbol, and pull unresolved symbols from the library
- The Longevity of Interim Solutions
- interim solutions persis because they are useful
- easy to remain in place forever
- motivation to rework solution will be weak
- avoid creating the interim solution in first place
- try to change forces that influence the decision of the project manager
- Make Interfaces Easy to Use Correctly and Hard to Use Incorrectly
- experiment with it and try to walk through common use cases
- anticipate errors and observe how it is misused
- modify if necessary
- interfaces are for the convenience of users not implementers
- Make the Invisible More Visible
- develop software with plenty of regularly visible evidence
- unit tests reveal characteristics of developer quality
- running tests reveal behavior
- boards and cards reveal progress
- Message Passing Leads to Better Scalability in Parallel Systems
- parallelism hard with shared mutable memory
- don’t use shared mutable memory, use message passing
- A Message to the Future
- think of code as a message for future maintainer
- Missing Opportunities for Polymorphism
- use context, remove if/else blocks
- New of the Weird: Testers Are Your Friends
- small issues in other areas may raise doubts to the competency of programmers
- testers help identify all these areas and provide a better experience to users
- One Binary
- having multiple binaries more prone to error
- separate features core to application and platform
- keep environment info versioned as well
- Only the Code Tells the Truth
- refactor if you need comments
- good structure, names and test to express intent
- treat code like any other composition, that requires craft
- Own (and Refactor) the Build
- code is useless without being deployed
- build scripts are code / refactor
- build is essential part of process and should be owned by dev team
- Pair Program and Feel the Flow
- requires effort from individuals and team
- promotes the distribution of skill and knowledge
- reduces truck factor
- solve problems effectively and have someone to discuss with and revisit solutions
- integrate smoothly especially if the person wrote code
- mitigate interruptions
- bring people up to speed quickly
- can be incredibly productive but also vulnerable
- Prefer Domain-Specific Types to Primitive Types
- consider domain-specific types for higher quality software
- in modern languages can use abstract data type class
- Prevent Errors
- people make errors in predictable ways
- try to limit the way input gets in e.g. calendar vs plain text
- offer cues, people don’t read instructions
- offer smart defaults
- system should be tolerant
- errors are results of misunderstandings between user and software
- redesign to prevent future error
- The Professional Programmer
- most important trait is personal responsibility
- responsible for own career and learning / staying up to date
- responsible for your estimates, commitments, and mistakes
- for the code you write and make sure it works
- team player, cover and help
- do not tolerate big bug lists
- do not make a mess, stay disciplined even under stress and pressure
- Put Everything Under Version Control
- use version control, allows safe/bold changes
- logical change in separate operations
- explanatory message in each commit
- don’t break build
- Put the Mouse Down and Step Away from the Keyboard
- get away after you understand the problem and let idea marinade
- your creative side may come up with a solution
- Read Code
- read other people’s code
- if hard, why hard? and avoid
- if easy, why easy? adopt
- review your own old code
- if hard, are you still doing it that way?
- Read the Humanities
- programmers like to ask for definitions built out of predicates which easily map to a class or table
- generally not how people understand the world
- they understand it off examples
- if insist on Aristotelean answers, can’t ask users right questions
- Reinvent the Wheel Often
- better way to learn than reading
- intimate knowledge of inner workings
- reinventing and getting it wrong is more valuable than getting right first time
- like weight lifting to become a great programmer
- Resist the Temptation of the Singleton Pattern
- often single instance requirement is imagined
- implicit dependencies and coupling
- implicit persistent state, hard to test and reason about
- multithreading inefficient or not safe
- restrict and don’t use singleton’s global access point from arbitrary code, instead direct access should only come from a few well-defined places
- The Road to Performance is Littered with Dirty Code Bombs
- because of dependencies simple refactorings can balloon
- damages credibility and political capital
- consider using metrics e.g. fan-in/fan-out to get a sense of risk
- Simplicity Comes from Reduction
- a lot of time spent wasted trying to salvage bad code
- refactor mercilessly
- start over in extreme cases
- The Single Responsibility Principle
- subsystem, module, class or even function should not have more than 1 reason to change
- reduces dependencies
- in good system, components can be independently deployed
- Start from Yes
- understand why and context
- solve problem and satisfy request
- question your own view
- if compelling reason for incompatibility can have a productive conversation about it
- Step Back and Automate, Automate, Automate
- not only for testing, more faster and reliable
- gives you control and repeatability
- don’t need exotic tools, decent shell language
- start small and learn just enough
- Take Advantage of Code Analysis Tools
- testing is only one tool of code quality
- static analysis, configurable
- can even roll own, many dynamic languages expose AST
- useful to learn dusty corners and pick up gems
- Test for Required Behavior, Not Incidental Behavior
- tests need to be sufficiently precise but also accurate
- too specific can cause breaks due to minor implementation details
- tests should state contractual obligations rather than parrot implementation
- Test Precisely and Concretely
- appropriately constrain tets
- good tests should be readable
- Test While You Sleep (and over Weekends)
- can have mandatory tests for commit and more extensive tests that run overnight
- support long-running tests
- time on performance testing environment
- test all permutations
- Testing Is the Engineering Rigor of Software Development
- hard engineering have math and physics to use for structural solutions
- software building is cheap
- embrace testing as the primary (but not only) verification mechanism
- “we don’t have time to test” like bridge builder saying “no time for structural analysis”
- Thinking in States
- check you’re in the expected state before performing operations
- protect your objects
- understand state machines
- test/unravel valid and invalid states
- study state pattern and design by contract
- Two Heads Are Often Better Than One
- programming is becoming more collaborative
- interact not only with devs
- pair programming great way to improve developers and get better quality work
- the benefits are difficult to measure
- pair with someone where you are weak
- Two Wrongs Can Make a Right (And Are Difficult to Fix)
- single cause issues easier to fix
- multiple causes needing multiple changes harder to resolve
- awareness of the possibility, clear head, and willingness to consider all possibilities are needed
- Ubuntu Coding for Your Friends
- code for others
- think of other developers
- zen vs ubuntu
- The Unix Tools Are Your Friends
- unix commands are powerful, flexible, efficient, composable, and portable
- easy to make your own / just follow a simple contract
- IDEs usually language and task specific
- Use the Right Algorithm and Data Structure
- important to understand algorithms and how they scale
- use the right data structures
- Verbose Logging Will Disturb Your Sleep
- log error if you’re willing to be woken up for it
- one INFO level log per significant application event
- distributed system / external dependencies / have a policy
- WET Dilutes Performance Bottlenecks
- fewer places to fix or improve
- raw collections break encapsulation, return domain-specific collection class
- When Programmers and Testers Collaborate
- work together with testers
- acceptance-test-driven development
- test automation
- help scope out requirements early
- results in better quality
- Write Code As If You Had to Support It for the Rest of Your Life
- gradually improve to become an expert programmer
- leave a trail of knowledge, attitude, tenacity, professionalism, level of commitment
- Write Small Functions Using Examples
- mathematically speaking, not just lines of code
- by limiting possible inputs can prove the correctness
- why using domain inspired types better than native type
- Write Tests for People
- test the tests and make sure errors reported in a helpful way
- have someone read it if they are confused, more likely something is not clear
- You Gotta Care About the Code
- the real difference between adequate and great programmers is the attitude
- want to write the best software you can
- refuse to hack
- code is discoverable and maintainable
- leave better than you found it
- write code that makes you proud
- Your Customers Do Not Mean What They Say
- customers don’t always give you the full picture
- interact with them more
- restate problem using different words
- talk to multiple people about the same topic
- try using visual aids in conversations
Like this:
Like Loading...