Best Practices
Hammock Driven Development
Before you dive into coding, take a step back and think about the problem.
"A few weeks of hard work can save a few hours of careful planning"
A note pad and pen are the best tools for planning your solution and will save you a lot of time and headaches.
"First, solve the problem. Then, write the code."
— John Johnson
Productivity
Single Responsibility Principle
Your functions and objects should do one thing only and do it well.
KISS
Simplicity is prerequisite for reliability
- Edsger W. Dijkstra
"Simplicity is the ultimate sophistication."
— Leonardo da Vinci
DRY
If you find yourself writing the same code more than twice, break it out into a function.
YAGNI
A principle of extreme programming that states don't add functionality until you need it.
Structure Code
- Modules
- Functions
- Patterns
Reuse Code
Is there a module, tool or framework already written that fits your solution?
"Good programmers know what to write. Great ones know what to rewrite (and reuse)"
- Eric S. Raymond
Clean Code
Keep your code readable. You and others will thank you in the future!
Iteration
Remember software development is an iterative process. Don't expect to write it perfect first time. Make it good enough and then refactor your code to make it better next time.
Pair Programming
Two heads are better than one!
Code Reviews
Ask someone to review you code for feedback.
Coding Standards
Keep your code readable, consistent and maintainable.
Testing
Learn how to practice TDD/BDD it will help you write decoupled code with less bugs.
Use the source control, Luke!
Use source control, what would happen if the dog ate your codes?
Documentation
Comment your code, however if you have well structured clean code with descriptive functions and variables the code should speak for itself.
Make sure your project has a good README file
Design Patterns
Design patterns are reusable solutions to commonly occurring problems in software design. They allow us to stand on the shoulders of the combined experience of the many developers that came before us.
Learning JavaScript Design Patterns
Anti Patterns
You don't want to do it like that.
Automate
...
Configure
...
Copy & Paste Variables
Copy and paste variables to avoid error messages from spelling mistakes. Try not to copy and paste code from Stack Overflow and other places without at least trying to understand how it works.
Knowing What You Don't Know
"True wisdom is knowing what you don't know"
- Confucius
Do you know what you don't know!?
Keep Learning
Never stop learning. There are so many resources out there such as books, blogs and podcasts. Try other languages. Talk to other developers. What's happening in the community? Keep adding new tools to your belt, then you have more options for your solutions.
Have Fun!
"Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."
- Linus Torvalds