It’s honestly quite easy. Basically, anything can tick off a developer. The more “religious” views the developer holds, the easier it is. In my opinion, there’s no culture more toxic than that of developers, programmers, and engineers.
Yeah, there’s even much discussion on when you’re a measly developer — aka code monkey — an esteemed programmer, or a sanctimonious engineer. Some engineers are furiously agitated when called “developer.”
I’m just going to enumerate a bunch of stuff that really hits home with developers, in no particular order. …
I know what you’re thinking “double the amount of code?! Who is this nutjob.” And “you’re the reason a clock app takes 20MB.”
But, let's get one thing straight.
Lines of code have never been a good metric for code quality. Ever.
Lots of developers want to skill up and abandon their old ways. Expanding your repertoire of approaches and techniques to eliminate branching is one quick way to do so.
Crazy code like the above example needs to go. It’s not readable. It’s not maintainable or flexible. It’s just terrible code. Sadly, this is not even that bad.
One question lots of beginner developers often ask is “is unit testing worth it?”, “Why should I unit test”, or see them make claims like “testing is a waste of time”.
Guess what the very first thing any beginner developer does whenever they’ve completed a feature, say, created a repository class and used it in a web controller action.
You guessed it: they make a request to the endpoint using postman or thru the browser. They’re testing to see if the repository is actually returning what they’re expecting.
Primitive types don’t convey any meaningful domain knowledge — so don't build your domain classes solely with these types.
Obviously, you can’t avoid strings, ints, doubles, and other primitive types entirely. They’re the fundamental building blocks for any piece of code and application. But, you can make an effort where it matters.
Neglecting to write proper domain classes and value objects is a recurring theme of many codebases.
Let’s take a look at how you can write better classes that properly capture domain-specific knowledge and business rules, resulting in safer, more flexible code.
You’ve noticed structuring code isn’t that easy. Starting from scratch often begs the question “where should this class go?”. Even the simple act of naming a solution, module, project, or what have you, can be mindboggling difficult.
It’s very likely you’ve already read tons of articles on this matter. You get different answers every time. This is great, as it broadens your repertoire of possible approaches, but, at the same time, it poses new questions. Also, having lots of options may even hinder your decisiveness.
Great, you’re in a hurry, I get it. Here’s how I typically structure my code…
Attending meeting-filled days wearing blue-light glasses, with a pizza slice in one hand and a dumbbell in the other, striking a perfect balance of endorphins and staying healthy, you wonder how the best developer ever gets any work done.
The secret is, he knows coding is only the last-mile to any solution.
We all know one engineer who seems to have the answers to all and everyone’s questions — or, more importantly, knows how to dig out answers.
The one who knows exactly how to deal with that difficult issue you’re facing, or, can elegantly model a complex domain and…
I’ll just cut right to the chase. No introduction needed.
Look at this method
WithdrawMoney(string accountIban, decimal amount). In a (European) financial system, you’re dealing with IBANs, which is a plain text string looking something like this
Despite being purely text, some stringent rules govern how IBANs are constructed and validated.
Simply using a
string type is communicating to the world — anyone using your code — that any text whatsoever is completely OK to pass in.
This is obviously wrong.
A much better approach is to capture the domain knowledge in a special class and verify that it’s…
You’re not alone if you find OOP difficult and tedious. A simple google search “why is OOP so hard” reveals a ton of dismayed want-to-be developers.
Object-oriented programming is absolutely awesome and paves the way for incredibly flexible, testable, and easy to read code. Though it’s so difficult to get right, and more than usual poor code is produced with OOP.
To a beginner or uninitiated, object-oriented programming seems like a collection of buzzwords that carries little to no intrinsic meaning. …
You’ve probably already done a ton of research on what attributes are, when to use them and why you should care. And let me guess, you’ve met the same old
[Obsolete] attribute over and over…
Let’s do something totally different.
I remember when I first encountered attributes and reflection some years ago, I had absolutely no clue about how they worked, but nevertheless was able to radically change the behavior of my application.
The simple act of consuming attributes was a mystery to me…
Fast forward 5-6 years, I’m using custom attributes to complete my tasks on a daily basis.
Code comments are an interesting topic that’s often subject to heavy debate, and programmers hold almost religious views on the matter. So, I thought, why not have a go at this one, as I do with the whole “not using if-else” and traditional branching.
Commenting on your code is like telling the same story twice. Except, one may get out of sync with reality and starts becoming a lie instead. Code should ideally be self-documenting and annotating it with
// or # only increases the signal-to-noise ratio, for the worse.
That’s at least the mindset developers nowadays have converged on.