Select Page

7 Easy Ways to Improve Your Coding Skills

I know, I know… I am writing again after like forever even though I’ve promised I will be writing more often. Well, I could tell you that I was busy but I wasn’t. You can always find free time for things you love. I was just lazy. I am going through the coder’s burnout but I will be writing more about that in other posts. Today I’ve wanted to write and remind myself about some of the basics I should follow so what’s the better way than sharing it with you guys as well. Maybe it will help you improve your coding skills as well.

Sometimes even professional coders who were coding for years forget the good habits. I’ve seen veterans being lazy to comment or even declare variables appropriately relevant to the project functions. Anyways, without further ado here are short and quick 7 ways to make your coding skills and your code better.

1. IDE Theme

Now, this might sound basic to some of you and I know it has nothing to do with the term “improve your coding skills” but I don’t think that many coders actually realize how important is the color theme inside your IDE of choice. Using the same theme for a longer period has been proven to be working well for me. It’s kind of a habit like a thing if that makes sense. You get used to watching code inside the same color arrangements and your eyes and your brain just expect it to see that same colors every time you open your IDE. I prefer using the Darcula theme since it’s available in almost every IDE or if I use Visual Studio Code which very often actually I just go on with the default dark theme.

ide theme
My Visual Studio Code Color Arrangement

That reminds me of the dark mode that is present in almost every single device and operating system we use in 2020. I’ve heard older coders not loving the dark theme but I think it’s actually beneficial not for your eyes only (it stops the bright blue light ruining your eyes, especially at nights) but for the devices you use itself. The latest monitors and displays use an amazing technology that can actually show true black colors, meaning if you see the black color, the pixel behind that color is turned off, which saves a lot of battery if you are on the laptop or even smartphone. Yeah, lot’s of people code on Androids. I might write about it in the future because it’s a very funny concept to me.

2. Declaring Variables for Everyone

I often see people writing code and honestly even I do it sometimes like it’s meant only for me and that only I need to read and understand it. This is bad, technically it works but it’s a very bad practice. Don’t be lazy with variables, declare them with purpose. When declaring them, do it like another 100 coders are going to see your code after you are done. Keep reminding yourself about this. Otherwise, it will come right back to you. I got myself into a situation where I’ve finished the Java software I’ve worked on for 2 years and then I was using it for like another 2 years and when I had to update it, I’ve found myself not understanding what I was doing 4 years ago. Hilarious isn’t it? Not being able to understand your own code makes you feel miserable. So make sure you name your variables correctly. Here is a good example:

proper variable declaration
Bad and Good Practices

3. Don’t Spam Function Parameters

If I could present you with my own words how much this frustrates me… I assume coders do this in order to try and write less code? Maybe they think it’s a more clean and dry code if you put bazillion of parameters inside the functions but that is not the case for sure! Doing this makes your functions look like spam and they are harder to follow. If you have any data to handle just go on and nest the variables. I’ve seen this often in JavaScript code and I never understood why. The most common scenario whereI’ve seen spam functions in was with the login functions or other similar CRUD projects. Let me show you by using the same example from above.

spam functions comparison
Comparison between spam function and pretty function

4. Declare Variables Right Before You Use Them

The previous example reminded me of this so I will have to mention it even though I didn’t plan it. This doesn’t happen often with modern frameworks such React or Vue but I’ve seen it in other places, especially in Java code and old PHP(version 5 or older). There seems to be a common habit, not practice since I believe it’s wrong, to declare all of the variables at the beginning. This is not good. You will end up scrolling looking for declarations or the coder who will continue after you. It can also be harder to follow the scope of the declaration although lately arrow functions save us a lot of pain when it comes to that. Some corporations you might work for in the future will actually instruct you to do this as they know coders often declare all variables at the beginning. Feels like it’s easier, it felt that way for me as well but it wasn’t really. An important thing to mention is that there is a difference when it comes to imports. Those must be used at the beginning if you are going to import functions and libraries as variables to be used later.

5. Clean Your Console Logs

If I had a cent for every time I’ve found a leftover console.log() I would be as rich as Elon now. While I really understand coders using them to easier debug issues they are facing, I just can’t justify leaving them inside the code in production. This is very, and I mean VERY unprofessional. It’s literally like showing your dirty underwear to the whole world. Make sure you clean and remove all the console.log outs after you are done debugging your code! Another thing to mention while we are still on this topic. When showing the errors in the console, it’s ok to use custom messages to help you locate the error as fast as possible but maybe you should try to use console.error() method next time and even colorize the messages, make the world pretty guys, come on!

clean console logs
An example of leftover console.log outs

6. One Task per Function Please

This one will improve your coding skills significantly. Functions can be nested I know and functions can be abnormally huge but that doesn’t mean they should. This brings us back to the minimalistic, simple, and clean code that we aim for. I think I’ve read somewhere that functions should not contain more than 100 lines of code to keep them more simple and clean. Honestly, I think that even 100 lines might be a high number but I agree with the point of keeping one task per function. This way once we get into more complex concurrent and multitask functions on a high corporative scale it will be easier to handle them and it will save us from possible failures. So remember in the future to try and do one task per function if possible. You will thank yourself later. Modularity(Object Oriented Programming) is a beautiful concept and we should use it as much as possible.

nested functions
Overnesting functions as an example

7. Make Conditional Expressions Simpler

Back to our clean and simple code again. I must admit, for me personally reading a full if else expression is easier than a shortened one but I can tell you that all it takes is practice. You will be used to shorter conditional expressions after one week and it will make your coding skills better and your code much cleaner. In some IDEs, we can see a hint offering us to shorten these conditional expressions automatically for us so maybe you can try using those at first although I do recommend writing it by hand first week to get used to them quickly and to improve your coding skills. And of course, as with the examples above, let me show you an example here as well:

simpler conditional expressions
An example of if else expressions


Submit a Comment

Your email address will not be published. Required fields are marked *

10 + 16 =

Share This

Share This

Share this post with your friends!

Share This

Share this post with your friends!