You think you know how to code
--
Here are things that you should not do, things that you should do and things that you should realize about yourself.
Fixing Bugs
When fixing bugs, fix the disease not the symptoms.
Symptomatic treatment, supportive care, or supportive therapy is any medical therapy of a disease that only affects its symptoms, not the underlying cause.
— Symptomatic_treatment (wiki)
When trying to fix something, don’t just try to make it work. Putting band-aids on an infected wound isn’t going to fix it. There are specific things you have to do to treat that wound. If you don’t, then with time it’s just going to get worse to a point where it might become a chronic wound.
Now, read the paragraph above replacing medical terms with developer terms, let me help you:
When trying to fix something, don’t just try to make it work. Putting workarounds on a buggy code isn’t going to fix it. There are specific things you have to do to treat bugs. If you don’t, then with time it’s just going to get worse to a point where it’s going to pile up code, become full of workarounds, and almost impossible to understand and/or change.
Fundamentals
Some people say that they can work in any project, that they consider themselves to be senior developers and then you see their code (JavaScript) and it’s like:
const quarterOf = (month) => {
let quarter
if (month <= 3) {
quarter = 1
}
if (month >= 4 && month <= 6) {
quarter = 2
}
if (month >= 7 && month <= 9) {
quarter = 3
}
if (month >= 10) {
quarter = 4
}
return quarter
}
You could just do
const quarterOf = (month) => Math.ceil(month / 3)
The difference is very easily noticeable when a developer knows what they’re doing vs when they think they know.
We can check out another example (also in JavaScript). If you’re asking someone to validate some form fields and check if the name is not empty, you might see:
const validateName = (name) => {
if (name === undefined || name === null || name === '') {
return false
} return true
}
Again, if you do understand JavaScript, you know that Falsy is a thing in JavaScript. Lets assume in this example that the return type should be boolean and you’ll code this validation function as
const validateName = (name) => !!name
Knowing the language and tools that you’re going to be using everyday can significantly impact your work. Instead of writing paragraphs of code you can potentially reduce them to 1 line which can potentially be way easier to read and understand what’s being done.
By writing good code you can easily scale a project and be able to implement new feature or fix bugs really quickly.
Matrix of Knowledge
Being aware of the different states of knowledge in your mind can significantly help you find things that you take for granted and question more.
There’s this image that shows you the states of your knowledge.
A) I know that I know: You are aware of the knowledge you have.
B) I know that I don’t know: You are aware of the knowledge you don’t have.
C) I don’t know that I know: You are not aware of the knowledge you have. You do something so automatically that you don’t realize that what you’re doing is something other people might not even know about.
D) I don’t know that I don’t know: You don’t know that something exist or you think you understand something, but you don’t.
One of the biggest issues that can be observed today is that people are taking things for granted and trying to force their knowledge into “I know that I know” (A), which actually becomes “I don’t know that I don’t know” (D).
Some Bad Arguments (these arguments are WRONG, they don’t know that they don’t know)
> I know React
There are people that study the framework/library and they don’t learn the language.
> I use MongoDB
Some people doesn’t know or can’t explain why they use that instead of another database.
> I use MongoDB because I can store anything
Some people doesn’t know that many databases nowadays support a JSON type in a column. So you can store a JSON object in Postgres or mySQL for example.
> I know Clean Code
Some people can’t even speak about some concepts or best practices that they know and they try to sound like they know what they’re talking about.
> I consider myself to be a senior developer
Sometimes they can’t talk about the fundamentals. They do trivial stuff using things they learned in college or some “Learn how to program in 5 days” kinda thing instead of using the language’s full potential.
> I don’t like [insert thing here] because it [does something that is not true]
Some people make arguments that are factually incorrect. You can easily prove that they’re wrong with official documentation.
> I use [insert thing here] because it’s popular
Some people just use things because they’re popular. They can’t make an argument about the PROS and CONS of the chosen thing.
You should realize you know nothing
When you’re truly wise you start to realize that there’s so much that you don’t know. You can see this in quotes from philosophers and geniuses.
I know that I know nothing
— SocratesThe more you know, the more you know you don’t know.
― AristotleThe more I learn, the more I realize how much I don’t know.
― Albert Einstein
So bottom line
Recognize where you are, question everything, start coding wisely!