The ACTUAL Way to Code Productively & Professionally

Harmony Hive Workplace
32 followers
Sep 15, 2024
I want to tell you how to be a more efficient software developer.
Now my why I code for four hours video goes over the broader spectrum of how I'm able
to improve efficiency in all different parts of my life that drip into my work as a software
developer.
But this video is to get into the nitty gritty details specific to developers like mastering
your IDE, refactoring code, not over-engineering your solutions or reinventing the wheel, having
a set of coding standards and style guidelines that you stick by to have uniform code or
even something as simple as learning keyboard shortcuts.
These things, while may take a little bit of time to learn up front, will pay you back
tenfold.
I think I said that same thing in that other video, but it's true.
You may be off put by it a little bit because of how much time it takes to do up front,
but you have to weigh in the long-term time savings because you'll realize that the long-term
gain heavily outweighs the short-term loss in time.
The first thing you need to do is write your code with principle.
Find good coding standards and style guidelines and follow them.
It'll pay back in dividends and save you from rewriting.
If you work in a team, then you should already have something in place, so learn it.
Take the time and learn it.
If you're working by yourself, still implement it because it's good practice and it'll save
you a lot of time.
I mean, think about it.
Having a coding standard gives a uniform appearance to the code written by multiple different
engineers.
It improves readability and maintainability of the code and it reduces the complexity.
It also helps in code reuse and to detect errors.
A few examples include indentation, standard headers for different modules, naming conventions,
coding documentation, and even things like error return values and exception handling.
It should all be uniform across the code base.
Find good coding standards and style guidelines and stick to it.
But just because you have those things in place doesn't mean your code will always
be good.
That's why it's important to go back and refactor your code.
Dedicate a small block every week to refactor.
Some say you should refactor on a daily basis or else your code isn't in good health.
See, I'm giving you a little bit and saying you only need to do it on a weekly basis.
Either way, just make sure it gets done regularly.
From your architecture to your methods and functions, variable names and number of arguments
a method receives, everything.
To be more specific, if your function or method is more than 20 to 25 lines, it's more
likely that you are including too much logic inside it and you can probably split it into
two or more smaller functions or methods.
And if the name of your function or method is longer than 20 characters, you should either
rethink the name or rethink the entire function or method itself using the first rule.
If you have a lot of nested loops, then you may be doing some resource-intensive processing
without realizing it.
In general, while there are some exceptions, you should rethink the logic if you are nesting
more than two loops.
Three nested loops is just not good.
Unless you're trying to mess with somebody in a code review, at that point, it's just
hilarious.
Consider if there are any applicable design patterns your code can follow.
You shouldn't use patterns just for the sake of using patterns, but there are patterns
for a reason.
They offer tried and true ready-thought solutions that could be applicable.
And just like the coding standards and style guidelines, all of this refactoring increases
your code's readability, maintainability, reusability for when you need to reference
old code.
And you know what makes both of those things a whole lot easier?
Your tools.
Your familiarity with your toolset can be a force multiplier in your coding, starting
with your IDE.
Now frankly, I don't care what IDE you use, but I do care that you take the time to master
it.
Learn how to compile, debug, refactor, profile in your IDE.
In another video, I went over my entire VS Code setup to share with you what I use and
why I use it.
I have customized settings to increase my workflow.
I have custom shortcuts for easy navigation and use.
I have extensions to help me not think about these mundane things that aren't worth my
time but need to be right.
And what you can do in your IDE is sync your coding standards and style guidelines with
the rest of your teams.
That way you know it'll always match up.
It won't cover everything, but it will cover a lot.
A tool for refactoring, you can use a linter so you can refactor while you code.
You'll get recommendations as you code for better practices in what you're currently
using.
Or use a code analysis tool like Sonar Cube or Kodana.
The tools out there that'll help you keep up with new language updates and code smells
and give you recommendations on how to refactor your code.
Or tools to help you implement APIs or to be using APIs in the first place.
If you don't know, APIs let your product or service communicate with other products
and services without having to know how they're implemented.
Which can simplify app development, saving time and money.
That's not my definition, that is the definition as per Red Hat's definition.
Defining APIs give you flexibility, they simplify design, and provide opportunities for innovation.
I also created a video recently about 3 coding projects, beginner, intermediate, advanced.
So if you need any ideas on projects in case you need to build something for your portfolio,
check out the intermediate one that goes over how you can use an API in a project.
I hope that segment really allowed you to understand why API marketplaces are of use
and why APIs are of use in improving your efficiency.
There are also other things that we can go into in a future video about how you should
go about testing when using an API because it is rather specific in order to make sure
your code stays efficient, but that's slightly out of the scope of today's video.
Let me know in the comments if you would be interested in a video like that.
And then of course you have other tools that you've probably heard a lot about like to
help you with project management for CICD, version control, hosting, I think you get
the idea.
Learn about these tools and implement them when you need to use them.
Because believe it or not, you don't always need all of these tools on all projects all
of the time.
But learn about them so you know they exist for when you do need them.
And for the ones you do use, master them.
But I feel maybe most important of all, don't reinvent the wheel.
Don't over-engineer what can be a simple solution to the problem you're facing.
I once read this quote, an efficient software developer is one who has a knack for producing
what is needed and will be used.
They don't add bells or whistles, speculative features or unnecessary extensibility or abstraction.
They start working a problem by seeing what's been done before.
Understand the common approaches and when to use them.
They figure out how what they're going to develop will be used.
This is what I implore you to do.
Become an efficient programmer by following the things I laid out today.
You won't be able to implement everything at once, but pick one or two and start.
Then pick up another few once you feel confident you have accomplished and can maintain the
prior two.
I appreciate you watching this entire video through and comment below on something you
learned today that maybe you'll start implementing tomorrow will be greatly appreciated.
And a like and a subscribe plus hitting the bell for notifications.
I hope y'all enjoyed this video.
Have a good rest of your day until next time.
