DEV Community

7 Daily Hacks For Programmers To Make Coding Skills Faster

Simc Dev on July 28, 2022

In 21st century, programming is everywhere. Some people are passionate about programming languages. Even though they forgot to do some other works ...
Collapse
 
noriller profile image
Bruno Noriller

5. Try To Debug Your Code
No!

Write tests, it's not that hard to learn how to test and instead of jumping between your code and, possibly, the framework or package code you're using... you start with small steps that build on each other and are far faster than trying to debug line by line of code.

Collapse
 
ravavyr profile image
Ravavyr

I'd say "debug your code" should actually imply "test your pages and application and make sure it works the way it's intended to"

If that's done using written tests, or manually, or a combination of the two, who cares?
I find too many devs rely on badly written tests and their apps still don't work.
Plus if you test it manually you also get an eye for the UI/UX part of the app that written tests cannot test for and which end up being the largest reason things get undone/redone/modified over time anyway.

If you're only writing backend code, api calls and such, sure written tests can cover most of it. In the end though, manually testing your code leads to more efficient code. Your tests can't tell you if your code is inefficient, your eyes can, especially as you become more experienced at writing code.

Collapse
 
bernardwiesner profile image
Bernard Wiesner

Debugging code can be extremely helpful when using good debugger, especially when trying to trace a bug or understand the flow of execution. I agree though that debugging should not replace tests.

Collapse
 
noriller profile image
Bruno Noriller

Actual debugging is something I do a lot more in untested code. In tested code a few well placed logs are usually enough. (Not sure if logging counts as "debugging"...)

I also think that debugging is something "low level", for "common place" stuff like rendering divs and doing CRUDs, it's hardly necessary.

Thread Thread
 
bernardwiesner profile image
Bernard Wiesner

Personally I don't like logging on debug level, I feel it makes the code less readable.

But yeah agree, debugging is mostly useful for lower level, complex logic where you need to figure out what is happening.

Another very useful feature of debugging at least in PHP is digging into packages/frameworks to follow the execution flow and understand how it all works, it's much faster than digging into it manually.

Collapse
 
cepreu5 profile image
cepreu5

"3. Always Write Useful Comments ..."

There is a problem with formating, as shown on following screenshot:
Image description

Collapse
 
ravavyr profile image
Ravavyr

I'd also argue that "Write useful comments" needs to be done not just for yourself but for anyone who will read this in the future. You should always make the assumption the person in the future who reads this knows nothing about this. Is your code clear enough for a decent developer to understand or should they know about external scripts that interact with it or other sections of the application that also use this code [if it's used in multiple places] etc.

Collapse
 
samuelrivaldo profile image
Samuelrivaldo

Thanks 🙏

Collapse
 
moonseeker profile image
Moon Seeker

Would be helpful to take a basic project idea and showcase each of the steps. As on, practical examples to better help us understand and visualize

Collapse
 
chichebewebdev profile image
Chichebe@WebDev

Very impacting, thanks for this bro

Collapse
 
devsimc profile image
Simc Dev

Cheers

Collapse
 
ashm10 profile image
Asther Marie Moreno

Thanks! ♥️

Collapse
 
devsimc profile image
Simc Dev

Cheers

Collapse
 
lawp profile image
Law P

👏👏

Collapse
 
devsimc profile image
Simc Dev

Cheers