10 Quick Tips that Will Speed Up Your Development
Sam Ringleman
Posted on July 16, 2019
Everyone wants the silver bullet. How do I learn x in 24 hours? Well, I hate to be the bearer of bad news, but coding is hard. You will want to bang your head against the desk, you will want to cry, you will cry. But in time it gets better. And there are ways to speed up learning. Here are 10 quick tips that you can implement right away, not only will it speed up your learning, but it will speed up your development process.
10. Use a debugger.
Some consider this knowledge a basic rule for coding. Just using this tool alone will help you gain a wonderful knowledge of your code. It is not enough to use print statements. You must get comfortable with the execution of your code. That is how you learn. Here is a tutorial on the basic usage of a debugger.
While simple to learn, I believe that debugging should be included in every university curriculum and practiced at every software development company. – Peter Franklin CEO Pryze
9. Be expressive.
In a code review, I love seeing theArrayReturnedFromAnIterator
over i
. In fact, I won’t approve a review if I see variables like this. Being expressive provides a quick glimpse into your code. Not only for others but for yourself 6 months down the road. What does the variable i mean in this context? Is it an iterator? Is it the count in a for loop? Is i an object (I don’t name all my variables based on what type it is, that what annotations are for)? Be more explicit with your variables. It may seem tedious to write it out now, but you are paying yourself dividends in the long run. Sometimes, those Java devs have the right idea.
8. Communicate with your team.
Always communicate. Express your ideas, no matter how new you are to the code. If you come from a different job, please, express your experience. No, we don’t think you are bragging. You could save the company millions, and your team countless hours. You know more than you think. Feel free to share it. In fact, feel obligated to share it.
7. Use an IDE.
If you let them, your tools will make you a better programmer. Quality in tools is important. The latest text editor is fine, but an IDE will allow you to dive deep into your code. There are free options that are close to more professional routes. VSCode has become the standard for a reason, first off it kicks ass. Second, with a couple simple plugins you can emulate a lot of the features that more expensive IDE’s provide. It will only make refactoring and debugging easier. When you are ready, buy yourself a license to JetBrains. Their tools have taught me more about programming than I can express.
6. Follow coding standards.
Standards are there for a reason. You may not like 4 spaces, or 2, or tabs, or I don’t care. What is the language standard? I want to jump in your PHP class and know that all your properties are declared at the top. That your static methods are below your properties. I want to look at an if statement and be able to jump from block to block. You can automate this using a linter. A linter will keep you up to date with the standards that the community has set. In time, you will follow this blindly. Use it. Love it. Automate it.
5. Keep methods small.
Hey, see that 650 line controller action? That’s how bugs are born.
In most cases, excessively long methods are the root of all evil. – Source Making
If you have a method that has nested conditionals, break that up. Make 15 small methods. You can hop to each method and know that it does one thing. Since you also followed step 9, you will be able to tell exactly what that method does because of the name of the function.
//This is hard to read, and gets messy quick.
if ($date->before(SUMMER_START) || $date->after(SUMMER_END)) {
$charge = $quantity * $winterRate + $winterServiceCharge;
} else {
$charge = $quantity * $summerRate;
}
//This is much better.
//Thank you Source Making for the wonderful examples.
if (isSummer($date)) {
$charge = summerCharge($quantity);
} else {
$charge = winterCharge($quantity);
}
Trust me, be more explicit, it will make you much faster in the long run.
4. Keep classes single use.
Create new classes, no you are not bloating the code! I suffered from this phobia for far too long. In most modern tools, jumping between classes is a simple keystroke. In PHPStorm for instance, hover over a class name, hit cmd + b.Jumps you right to the class. Like the last tip, I want to read your class name/namespace and know off the bat what this class does. Make a new class with only one or two methods. You will extend it in time, or you will learn what can extend from it. Small is always easier to test, and easier to read. Take a closer look at the SOLID principles if you want a more in-depth explanation.
3. Break things.
Version control is there for a damn good reason. Make that new branch. Break the shit out of everything! Test your idea.See where it succeeds, and see where it fails. This is how you learn. When I was first hired, I was horrified to try anything different than my seniors. I thought that my code needed to be like theirs. When I finally became confident that, yes I was going to break things, and that it was alright. I started to learn. That is one of the joys of software.You can take the internet out in one misplaced semicolon. It’s alright though, it can always be reverted. After all, it’s just a website .
2. Write tests unapologetically.
If your company doesn’t test, be the change. Lead that charge. Test your code.
You shouldn’t ask to write unit tests for the same reason you shouldn’t ask to do a good job. – Ted Bendixson
There is nothing more liberating than running your unit tests. It may take a little longer up front, but once that test coverage grows, you can refactor to your heart’s desire. You will know that your code works. And best of all, you can blame Chad over there, when he adds code and doesn’t run the testing suite…
1. Build personal projects.
This is the single most important thing you can do for yourself. Learn outside of work. Build that passion project that deep down you know is going to light you on fire. You will gain such a deep understanding of your language, your tools, your processes. It is invaluable. I cannot express in this short post how important this is. I implore you if you want to get good, build outside of work. Chase that passion. Then turn it into something someone else will use. Share it, live it, love it.
Closing
Some of these steps will take you time to learn, unit testing. Others you can implement immediately, using a debugger.The point is, if you use these steps, you will get faster at developing. Let me know in the comments what you think and if you have any other tips that have helped you along the way!
If you would like to join me in along my codeJourney, please come visit, read a few posts and join in on the conversation. I would love to see and hear from more of you!
Posted on July 16, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.