I think the answer to this is lack of adoption.
I think the answer to this is lack of adoption.
How do abstractions help with that? Can you tell, from the symptoms, which “level of abstraction” contains the bug? Or do you need to read through all six (or however many) “levels”, across multiple modules and functions, to find the error?
I usually start from the lowest abstraction, where the stack trace points me and don’t need to look at the rest, because my code is written well.
It’s only as incomprehensible as you make it.
If there are 6 subfunctions, that means there’s 6 levels of abstraction (assuming the method extraction was not done blindly), which further suggests that maybe they should actually be part of a different class (or classes). Why would you be interested in 6 levels of abstraction at once?
But we’re arguing hypotheticals here. Of course you can make the method implementations a complete mess, the book cannot guarantee that the person applying the principles used their brain, as well.
You’re nitpicking.
As it happens, it’s just an example to illustrate specifically the “extract to method” issues the author had.
Of course, in a real world scenario we want to limit mutating state, so it’s likely this method would return a Commission
list, which would then be used by a Use Case class which persists it.
I’m fairly sure the advice about limiting mutating state is also in the book, though.
At the same time, you’re likely going to have a void somewhere, because some use cases are only about mutatimg something (e.g. changing something in the database).
It makes me sad to see people upvote this.
Robert Martin’s “Clean Code” is an incredibly useful book which helps write code that Fits In Your Head, and, so far, is the closest to making your code look like instructions for an AI instead of random incantations directed at an elder being.
The principle that the author of this article argues against seems to be the very principle which helps abstract away the logic which is not necessary to understand the method.
public void calculateCommissions() {
calculateDefaultCommissions();
if(hasExtraCommissions()) {
calculateExtraCommissions();
}
}
Tells me all I need to know about what the method does - it calculates default commissions, and, if there are extra commissions, it calculates those, too. It doesn’t matter if there’s 30 private methods inside the class because I don’t read the whole class top to bottom.
Instead, I may be interested in how exactly the extra commissions are calculated, in which case I will go one level down, to the calculateExtraCommissions()
method.
From a decade of experience I can say that applying clean code principles results in code which is easier to work with and more robust.
Edit:
To be clear, I am not condoning the use of global state that is present in some examples in the book, or even speaking of the objective quality of some of the examples. However, the author of the article is throwing a very valuable baby with the bathwater, as the actual advice given in the book is great.
I suppose that is par for the course, though, as the aforementioned author seems to disagree with the usefulness of TDD, claiming it’s not always possible…
I just beat this level yesterday!
It becomes easy… Once you know what the tricks are supposed to be, which the game doesn’t tell you at all.
For me, these were the tips I needed:
Supposedly the PSX version also has a video in the options menu which shows you a dev completing the course, with button prompts on screen.
Oh, and there’s a cheat code in-game to skip this level entirely.
A part of it is horrible practices and a work culture which incentivizes them.
Who can be happy when the code doesn’t work half the time, deployments are manual and happen after work hours, and devs are forced to be “on-call”?
Introduce Test-Driven Development, Domain-Driven Design, Continuous Deployment with Feature Flags, Mutation Testing and actual agile practices (as described in the Agile Manifesto, not the pathetic attempt to rebrand waterfall we have in most companies) to the project and see how happiness rises, along with the project’s reliability and maintainability.
Oh, and throw in a 4 day work week, because no one can be mentally productive for that long.
IMO the biggest problem in the industry is that most developers have never seen a project actually following best practices and middle management is invested in making sure it never happens.
Isn’t the entire point of federation to be able to do what you’re describing?
Regarding mutation testing, you don’t write any “tests for your test”. Rather, a mutation testing tool automatically modifies (“mutates”) your production code to see if the modification will be caught by any of your tests.
That way you can see how well your tests are written and how well-tested parts of your application are in general. Its extremely useful.
On the one hand, mutation testing is an important concept that more people should know about and use.
On the other, I fail to see how AI is helpful here, as mutation testing is an issue completely solvable by algorithms.
The need to use external LLMs like OpenAI is also a big no from me.
I think I’ll stick to Pitest for my Java code.
Ah yes, advocating for basic human dignity is now “not understanding basic ideas about economics”, and none of the SIX different solutions I provided (which I didn’t invent myself, btw) could ever work in any capacity.
I won’t be continuing this conversation, as it is clearly not productive.
I’m sorry, but you won’t be able to convince me that allowing a single company to own hundreds of apartments is a good idea that won’t contribute negatively to housing prices.
deleted by creator
Some ideas could include, but are not limited to:
You can debate how well each of these would work, but there are many ways to bring prices down without making it less pleasant to live in those houses. I’m most partial to a progressive property tax, rent control and government housing, myself.
No, you’re claiming that that’s what I’m talking about.
What I’m saying is that making density even higher is not the solution to the housing problem. There are other, better ways of making houses more affordable than forcing people to live elbow-to-elbow with their neighbors.
No one ever claimed detached housing is the cheapest form of housing… Way to build a strawman.
About 10% of homes in the US are considered vacant, 5.5% in UK, 18% in Europe. 0.02% of the US population is homeless, I believe it’s 0.006% in UK, 0.07-0.33% in European countries.
Yet your solution is still to make housing even less comfortable for poor people by getting rid of density laws and blame immigrants for the housing prices, to boot.
Saying “Airbnb” is obviously an oversimplification - a ton properties seem to be bought by rental companies, not normal people. There’s a ton of properties just sitting empty, as well.
The solution is to introduce more control for housing, not less. Less control means more cheaply made hell-scape skyscraper buildings housing hundreds of people each, with no green spaces anywhere in sight.
The most shameful part is that the union unequivocally supports RTO, they just want it to be done a bit more slowly.
Fuck neurodivergent people, and people who took the job from another city, like those in rhe article who need to commute 6 hours a day, right?