the most important lessons I’ve learned so far in coding
Never write more code than necessary. You will save both debugging and development time you can use for other projects.
- Never write similar code twice. Abstraction needs some time to setup, but will make writing code faster, cleaner and fun
- Check which parts of your application has been written before by other developers
- all your code at every part of your application should only specify what is really important, and do so only once.
//WRONG: <input type="text" name="name" id="name" /><label for="name">name</label> //RIGHT <?= GetInput("name"); ?>
every language has its own conventions. it simplifies communication between developers and keeps code clean and consistent. Take the time to read through them, it is well worth it.
- It will make reading of both foreign and own code a lot easier and consistent
- other developers can use/understand your code without adaptation to match their own coding style.
- all tools for your specific language will work for your code
optimize your workflow
if you notice steps you do often repetitively, chances are there is already a tool for that. Especially in php / web development workflow tools like grunt and package managers like composer can save you a lot of time, while speeding up development and making deployment safe.
if you encounter a piece of code with keywords you don’t know or structures you’ve never used before, its your lucky day! take the time to understand what is going on, chances are you’ve been doing everything wrong so far.
After all, you do not know what you do not know. So here are some keywords which helped me archive some “breakthrough”, something which changed the way I code or work:
- Coding principles: Code the way grown ups do
- Patterns: Divide you code in a way it is easy understandable and makes sense, not only to you
- Reflection: Get the type of object at runtime, dynamically access properties
- async-await (only C#): asynchronous (non-blocking) api calls
- npm / composer / bower: php / web workflow utilities
- continuous integration: workflow concept
- scrum / kanban: project management (relevant)