Expecially because the big picture is easily stated: Write the least amount of clean code while providing value.
(PS: code is liability)
The way you put it, you're optimizing for only one side of the books. The fact is that the value in a company is not in minimal clean code; it's in a recurring revenue stream, and ideally profits. Provide the most value with code which has low interest payments. Everything else being equal, smaller code has lower interest payments, but everything else isn't always equal. And depending on cash flow and market opportunity, maximizing value and to hell with minimal clean code - throwing money & devs at the problem - can make sense.
I think the spirit of the comment you replied to was closer to the "clear and concise" methodology rather than the "as short as is humanly possible" methodology.
However in many cases, code is for; edge cases, input sanitization, type checking, null checking, graceful failure, logging... etc
Remember, [1] Docker can be implemented in a 100 LOC bash script, that doesn't mean it's a good implementation...
After I left, I heard the company 10x programmer replaced it with 10KLOC of C++. (sigh)
I can write boilerplate much much faster than I can type, either I or the community have scripted that shit :D
I once worked on a product and identified an ability to eliminate 100K lines of poorly written, inconsistent tracing code into a robust ~250 line file using AspectJ. Management threw a sh-t fit and thought the risk was untenable.
Plus, AspectJ is something that you have to be careful with. It injects code at the start or end of methods that can do arbitraty things and the method source code doesn't indicate that this is happening. So it has a great potential for code obfuscation.
In C#, with the various frameworks - including on the API level with ASP.Net - you can use attributes to decorate the classes/methods with your aspects and it’s pretty easy to see what it’s doing.
You get the runtime binding basically by just using dependency injection as you always do.
I have yet to find any equivalent to this .NET world. Especially of you're using EF. Either you use ADO and have your try/catch/finally with manual transaction management, or you have the EF context which is just one big blob you hope succeeds at the end.
It just came back to EF Core in 2.1
https://www.google.com/amp/s/codewala.net/2018/05/06/transac...
[Transaction]
DoYourBusinessWork() { ...; AlsoAudit(); }
[Transaction(RequiresNew, NoRollbackFor(AuditException)]
AlsoAudit() { ... }
The TransactionScope is handled in the aspect. Commit/Rollback is all handled there is well. There are not usings or exception handlings within your methods unless you want to handle those specifically.You could put the logic in attributes but I don’t consider a transaction a cross cutting concern. It would create a spooky action at a distance situation.
For some reason all calls were dog slow. Like minutes for simple pages.
Profiling revealed the class in question - and we were spending all our time in deserializing strings.
Copied the latest version of that class from the FB repo and luckily the interfaces were the same.
Worked for the next two years until we finally deprecated the PHP stuff.
I think what had happened is somebody had designed the file and everybody else followed suit patching stuff on - the entire codebase for that app was well below average. they had front end devs who didn’t know any JavaScript. In 2016. I lasted 6 months before I nope.png’d the fuck out.
It’s still not the worst application I’ve ever worked on though
It was a support nightmare, so we built a common library and collapsed the code base by 70%. Each tool was probably in the -8k eslocs range. Thankfully it wasnt c++.