News for hackers. Stuff that matters.
Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @02:35AM (#28927457)
All developers know code quality is important for long-term productivity and efficiency. But from a management perspective the problems are:

- There is no way to measure code quality

- There is no way to measure developer productivity

- Code quality is quite subjective and the field is driven by opinions and fads.

I have seen many examples where developers thought they were improving code quality by implementing some pattern or architecture but actually made it worse.

So for non-technical leadership, it is hard to know if "extra time" spent on code quality actually improves anything or is a waste of time and money.

Re:Code quality: a concern for businesses, bottom lines, and... by cheradenine_uk on Wednesday October 20, 2021 @03:36AM (#28927851)
SO MUCH THIS.

It's ironic to me that the "Hammer Factory Factory Factory" post was recently doing the rounds again.

I have recently been working with a client whose "senior" dev swallowed some books with opinions on "quality" wholesale and uncritically.

Thus in the simplest project, implementations that could literally be a lambda function (on receive message, write row into DB) are a festival of multiple tiers of objects, mappers, mediators, IoC frameworks, wrappers, Nuget packages, etc., etc.

Everything is in multiple projects. Simple constants (like: API routes - '/api/foo/bar') are indirected into files containing those strings, so there's a huge cognitive overhead and much clicking around to make sense of it. God help you if you don't use an IDE.

This isn't quality. It's the antithesis of quality. Devs have to understand a whole load of abstractions just to get simple things done. But the author is proud of his tower of 'best practice' - blissfully unaware that adding the simplest feature is now hundreds of lines of code, where one would suffice. This is burning through, literally, thousands of euros of dev time.

Re:Code quality: a concern for businesses, bottom lines, and... by Glyptodon on Wednesday October 20, 2021 @12:38PM (#28932789)
I've come to believe that strong conventions matter a lot more than specific patterns because of stuff like this.
Re:Code quality: a concern for businesses, bottom lines, and... by troppl on Wednesday October 20, 2021 @03:52PM (#28935421)
But... what the OP writes are strong conventions, no?

Coming from Spring or Java EE:

> implementations that could literally be a lambda function (on receive message, write row into DB) are a festival of multiple tiers of objects, mappers, mediators, IoC frameworks, wrappers, Nuget packages, etc., etc.

Spring or Java EE is a strong convention, so IOC is one automatically as well (both make use of that heavily). Hibernate would be the next strong convention, therefore mappers are, therefore we will have multiple tiers of objects. Wrappers will also be needed in a language like Java. About the rest of this list I can't say much now, but I would argue that lots of what this person is doing is based on strong conventions in the enterprise world. And it goes on:

> Everything is in multiple projects. Simple constants (like: API routes - '/api/foo/bar') are indirected into files containing those strings, so there's a huge cognitive overhead and much clicking around to make sense of it. God help you if you don't use an IDE.

Coming from Java again, everything won't be in multiple projects, but in multiple Maven modules instead. AFAIK that is good practice, or, if you want: a strong convention. Stuff like API routes will indeed not be saved in a code file, but in an openapi file instead.

IMO then, what this person was doing was actually following strong conventions. Yes, these are often also specific patterns, but what is the difference, specifically for these things listed here?

It seems to me much more that the person was probably "limited" more by the language. I think there are fairly good reasons for all of these, especially when working with more than ten people - in a language like Java. And in this case you will have to use Java (or something similarly famous) because otherwise you won't find a replacement very quickly that is fairly cheap. Now, maybe the person would not have needed all this in such a small project that is just for one person. But who knows, maybe the project grows. Or maybe this person was simply familiar with this and could get this down fastest. All in all, I think there are many good reasons to decide to make a project with patterns/conventions like this.

Re:Code quality: a concern for businesses, bottom lines, and... by sorokod on Wednesday October 20, 2021 @11:25AM (#28931831)
A charitable way to describe this is (as a play on premature optimization) "premature future proofing"
Re:Code quality: a concern for businesses, bottom lines, and... by nathias on Wednesday October 20, 2021 @10:05AM (#28930801)
I see this stuff too much, "optimizing" the code by making it work for your IDE
Re:Code quality: a concern for businesses, bottom lines, and... by jstimpfle on Wednesday October 20, 2021 @04:35AM (#28928229)
> thousands of euros of dev time

probably you meant to say "hours"? :-)

Re:Code quality: a concern for businesses, bottom lines, and... by simonbarker87 on Wednesday October 20, 2021 @04:37AM (#28928247)
They probably didn’t, swap out euros for dollars or pounds or whatever you local currency of choice is
Re:Code quality: a concern for businesses, bottom lines, and... by jstimpfle on Wednesday October 20, 2021 @06:48AM (#28929150)
"Thousands of euros" is peanuts. It's like a couple of days of work.
Re:Code quality: a concern for businesses, bottom lines, and... by PeterisP on Thursday October 21, 2021 @02:00AM (#28940879)
The market is a bit different than CA, "thousands of euros" can buy man-months of work (especially for junior devs), not a couple days.
Re:Code quality: a concern for businesses, bottom lines, and... by cheradenine_uk on Wednesday October 20, 2021 @09:29AM (#28930399)
I meant euros.

And thousands includes hundreds of thousands, which is indeed the case here.

Re:Code quality: a concern for businesses, bottom lines, and... by Verdex on Wednesday October 20, 2021 @10:27AM (#28931032)
Thousands also includes thousands of thousands or tens of thousands of thousands.

Like ... it was two orders of magnitudes off of what you're stating the reality is. It makes sense that people would try to reinterpret the statement.

Re:Code quality: a concern for businesses, bottom lines, and... by jandrewrogers on Wednesday October 20, 2021 @12:03PM (#28932362)
I would make the distinction that architectural quality has a larger and more concrete impact on long-term efficiency and productivity for developers than code quality. You can incrementally fix code quality when there is value in doing so or time but architecture tends to live forever. I've seen code bases with excellent and diligent code quality but poor architecture, which rendered many nominal productivity gains from the very high code quality moot.

From a business perspective, investing in architecture quality buys a lot more optionality than investing in code quality, and so prioritizing the former is almost always the right decision.

Re:Code quality: a concern for businesses, bottom lines, and... by ToJans on Wednesday October 20, 2021 @02:49AM (#28927567)
IME code quality only matters in the parts that require a lot of change. If you keep your mess contained and easy to replace, the inside doesn't matter in 90% of the cases. You do need to care about code quality in areas where code changes a lot, but you most likely do not know what these areas are upfront.

I consider focus on code quality everywhere a form of premature optimization. Only focus on quality where it hurts... But if it hurts (f.e. you had to change it 3 times and it got messier each time), be very disciplined about refactoring to a better model: whiteboard, brainstorm etc and don't start refactoring until you found a better model.

Re:Code quality: a concern for businesses, bottom lines, and... by Verdex on Wednesday October 20, 2021 @10:42AM (#28931197)
I have a similar philosophy. If you can solve it once and the seal it away in a box and never look at it again ... then who cares. Write some tests or better yet hit it with a property test and then move on with your life.

I'm more worried about low quality code that takes the form of an api or object that everyone in the entire codebase has to use. Something where if it has a bug or if it needs to change, it will impact huge swaths of code.

Meanwhile, the code that takes a double and returns a double ... yeah it can be full of spiders and work by literal earth magic and as long as the unit tests are stable, I'm not losing any sleep.

If you have to change it just rewrite it from scratch and reseal away the evil.

Re:Code quality: a concern for businesses, bottom lines, and... by afarrell on Wednesday October 20, 2021 @03:30AM (#28927811)
Code quality also matters in the parts that a new joiner needs to read to make sense of the application and do their job.
Re:Code quality: a concern for businesses, bottom lines, and... by soco on Wednesday October 20, 2021 @03:42AM (#28927884)
If you have a problem somewhere in a mess, it will definitely hurt. What will you do then? Nevertheless, if the programmer know what they're doing I trust that the mess won't be extreme messy in the first place so maybe our argument is purely academic.
Re:Code quality: a concern for businesses, bottom lines, and... by ToJans on Wednesday October 20, 2021 @07:27AM (#28929401)
I have parts of code that are extremely messy, but I don't spend time on refactoring, because once it works it doesn't need any changes... The moment it starts requiring frequent updates I'll take the time to sit down and do a proper revision or rewrite. I do tend to be very careful with my API interface FWIW...
Re:Code quality: a concern for businesses, bottom lines, and... by otabdeveloper4 on Wednesday October 20, 2021 @03:13AM (#28927704)
> So for non-technical leadership, it is hard to know if "extra time" spent on code quality actually improves anything or is a waste of time and money.

No, it's much harder for technical leadership. Technical leadership operates on opinions, fads, cargo-cult, etc., like you said.

Non-technical leadership can always fall back on business fundamentals.

Re:Code quality: a concern for businesses, bottom lines, and... by Aeolun on Wednesday October 20, 2021 @06:10AM (#28928881)
> Non-technical leadership can always fall back on business fundamentals.

You mean like opinions, fads, cargo-cult, etc?

Non technical leadership is just as susceptible to this. They’re just influenced by different people.

Re:Code quality: a concern for businesses, bottom lines, and... by TeMPOraL on Wednesday October 20, 2021 @08:16AM (#28929751)
> Non-technical leadership can always fall back on business fundamentals.

For little good it'll do them. Any input to their calculations that references the software part of their business will still come with a big "shmaybe?" attached to it, making the results just as bad.

Re:Code quality: a concern for businesses, bottom lines, and... by makeitdouble on Wednesday October 20, 2021 @03:57AM (#28927987)
> - There is no way to measure code quality

Code quality is your new feature rollout average time.

If it's a steep rising curve it is abysmal, if it's mostly flat you have an excellent team.

If it was flat but exponentially grew after you went on a hire spree, you know where to look at.

Re:Code quality: a concern for businesses, bottom lines, and... by d0mine on Wednesday October 20, 2021 @02:23PM (#28934124)
> If it was flat but exponentially grew after you went on a hire spree, you know where to look at.

Initially, one could churn out a lots of features quickly accumulating the technical debt. The increasing time can be rather more about the past, then new people you hired.

Re:Code quality: a concern for businesses, bottom lines, and... by egman_ekki on Wednesday October 20, 2021 @02:32PM (#28934272)
> If it was flat but exponentially grew after you went on a hire spree, you know where to look at.

It takes time for new hires to get familiar with the code and for seniors to help them get up to speed, so I'd be surprised if a hiring spree didn't end up sharply rising curve for feature rollout time.

Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @04:33AM (#28928219)
This assumes all features have equal complexity.
Re:Code quality: a concern for businesses, bottom lines, and... by makeitdouble on Wednesday October 20, 2021 @05:43AM (#28928721)
This assumes a lot of other factors, but I'd say they all converge.

You won't have high code quality without a motivated and competent team for instance. Same if they can't correctly scope their features or engage in long unplannable projects, etc.

I'd make a parallel with clean natural water: you can't have it in isolation, the rest of your environment needs to be functional to preserve it.

Re:Code quality: a concern for businesses, bottom lines, and... by WalterBright on Wednesday October 20, 2021 @03:17AM (#28927728)
> developers thought they were improving code quality by implementing some pattern or architecture but actually made it worse.

https://www.pri.org/stories/2012-08-25/amateur-restoration-b...

Re:Code quality: a concern for businesses, bottom lines, and... by eikenberry on Wednesday October 20, 2021 @02:19PM (#28934052)
> - Code quality is quite subjective and the field is driven by opinions and fads.

I think a big part of this is the tech industries failure to grasp the value of experience. Experience teaches you to pick out the fads from the fashions and the values of various opinions. It helps develop your code smell and your ability to discern the quality of a work. All other trades value experience and trust it to help measure these things. If you wanted to judge the quality of work done by a junior plumber you'd bring in a master plumber to evaluate it.

Re:Code quality: a concern for businesses, bottom lines, and... by stinos on Wednesday October 20, 2021 @09:58AM (#28930743)
There is no way to measure code quality

While it's indeed hard to get objective measurements looking at the codebase alone, telling a manager things like

"look, this is going to take 5x the amount of time it should because the current code is a complete mess so I have to be extra careful not to break things and it takes way longer than it should to figure out where I have to put the new feature in order to mimimize the amount of extra chaos created"

or

"I cannot do anything sensibly without refactoring this first but it will pay off in the next couple of months and years to follow"

should make it pretty clear the quality isn't where it should be. If management doesn't grasp that, or doesn't want to hear it, then management quality is probably at the same level as the code's. I know I'm in a position not every developer is, but when needed I ask and get extra time for things like this. Because I've seen what happens when you try to build a trainwreck on top of existing ones: that stuff is exponential, at least.

Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @10:28AM (#28931037)
Sure you can say such things. My point is just there is no way to determine if you are right. Unless you make an A/B test where you both refactor and keep the old version around, and measure how much time it takes for the same developers to implement same change on both code bases. But nobody ever does such a test since it would be prohibitively expensive.
Re:Code quality: a concern for businesses, bottom lines, and... by stinos on Wednesday October 20, 2021 @03:36PM (#28935141)
My point is just there is no way to determine if you are right.

That is a fair, so I guess that is the point where trust in experience kicks in, like the sibling comment mentions already.

But nobody ever does such a test since it would be prohibitively expensive.*

And also rather hard to do. You cannot reliably use the same developers to do it because both tests would influence each other. Using different developers would raise questions about whether both are at the same level. Etc.

Yet I do think some aspects might be easier to prove than other. Has perhaps been done already but say you take a bit of code with formatting completely off and inconsistent, and the same piece where it looks uniform. Have people read it a couple of times, then ask questions about it. Or something like that, I'm not into that research but you get the point: should be doable to objectively measure which one has the least cognitive overhead and gets understood the fastest. Assuming it's the uniform one, that would then open the door to saying it's worth spending time now to apply project-wide formatting vs continuing with a mix of styles as-is.

Re:Code quality: a concern for businesses, bottom lines, and... by ken47 on Wednesday October 20, 2021 @02:25PM (#28934150)
The example assertions he was making were non falsifiable. However, if the claims were slightly tweaked to say something along the lines of:

"historically, a code modification like the one you've requested has taken 5n units of time. After refactoring, such a change will take n units of time."

You wouldn't perform an A/B test to prove your claim. The managers would simply have to trust you for the reputable engineer that you are, and hopefully observe substantially increased velocity after the refactoring.

Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Thursday October 21, 2021 @08:38AM (#28943522)
> The managers would simply have to trust you

Yeah, that is my point. You can make up any bullshit number, and there is no way to prove of disprove it.

Re:Code quality: a concern for businesses, bottom lines, and... by Verdex on Wednesday October 20, 2021 @10:36AM (#28931139)
I think this is sort of right ... but:

"Hey boss ... this code the other vendor handed off to us is really bad code quality. We'll need to rewrite it or it's going to take 10x as long to do the feature than what we initially estimated."

"Hm, that's not good. I'll talk to the customer."

<later>

"So that's how long it will take without a rewrite."

"That doesn't sound right. I'll ask the other vendor how long it will take them to implement the feature."

<later>

"The other vendor did it in two days. Your team is fired."

<later>

"We've got another round of bug reports from the field. Also a class action law suit from angry customers. Also the product killed someone."

"Someone died? It's a website how is that even possible?"

"One of the many bugs causes the screen to flash wildly. Someone viewed it who was sensitive to flashing lights and had a violent seizure that ultimately claimed their life."

-----

Without a separate objective code quality metric, you can't determine between two parties who argue about what the code quality is. It could be someone isn't willing to spend some time learning something new. It could be that someone is just unfamiliar with the code. It could be that someone is cutting corners and writing dangerous code.

All you can do is to pick the people with the best track record and hope that you don't find out you choose wrong after spending millions of dollars and burning a lot of customer good will.

Because of this, it would be really nice if we had a different way to measure code quality besides: "The software developers are complaining about it."

Re:Code quality: a concern for businesses, bottom lines, and... by marcus_holmes on Wednesday October 20, 2021 @11:20AM (#28931752)
yeah but Not Invented Here is also a thing. Experienced devs also have Their Way Of Doing Things and if the code doesn't fit that, then it's "garbage" and needs to be refactored.

I've seen at least two perfectly good code bases get refactored badly because the dev didn't understand how they worked, or they were in a language the dev didn't want to work in [0].

[0] One of them was me, and in my defence it was PHP.

Re:Code quality: a concern for businesses, bottom lines, and... by ozim on Wednesday October 20, 2021 @09:25AM (#28930366)
Add to that it is a lot easier to write new code than understand existing code base. People nag about previous code base not because it is bad but that they don't want to spend time learning it.

More often than not I see "code quality" as an excuse for being lazy or generic blanket argument that you cannot refute because "code quality".

Re:Code quality: a concern for businesses, bottom lines, and... by sdevonoes on Wednesday October 20, 2021 @10:32AM (#28931090)
> I have seen many examples where developers thought they were improving code quality by implementing some pattern or architecture but actually made it worse.

> - Code quality is quite subjective and the field is driven by opinions and fads.

Agree. In almost every team I have been part of, when discussing code quality there was almost never consensus regarding what's good and bad.

Besides, in almost every company I have worked for, modules (or products) were usually refactored after 3 years or so (as in: the code that deals with retrieving data from the DB remains almost intact, but everything else is moved out to its own repository: the frontend as microfrontend and a new in-between layer (call it a proxy or "backend for frontend"))... so there was never a huge motivation to write quality code, just to write "good enough" code.

Re:Code quality: a concern for businesses, bottom lines, and... by goostavos on Wednesday October 20, 2021 @02:29PM (#28934222)
>when discussing code quality there was almost never consensus regarding what's good and bad.

FWIW, I've found that the best way to approach dragging a team in a new direction is to not focus on what "quality" is at all, but see if everyone can agree on what the problems are.

I think if you can get people aligned on the problems -- specifically high level 'above the code' ones like "X keeps breaking" or "X is really hard to change" -- you can sneak quality into the discussion without it being an attack on any individual developer's code. "why is X hard to change" can become a conversation about loose coupling, cohesion, state, etc..

Re:Code quality: a concern for businesses, bottom lines, and... by pjmlp on Wednesday October 20, 2021 @02:43AM (#28927524)
Consulting and offshoring is specifically hard.

From management and customer point of view, "it works" is the only quality measure.

No one cares about opening the box and the less one knows about how the sausage is made the better.

Re:Code quality: a concern for businesses, bottom lines, and... by OneTimePetes on Wednesday October 20, 2021 @03:46AM (#28927915)
- There is no way to measure code quality

Actually there is: Tech debt materializes in all measurable metrics of the project. Project Deadlines continuously are missed and the time at which they overshoot increases.

A project needs "exponential" people. The quit rate among the developers constantly increases, with experienced devs quitting first.

All these signals should allow actually easily to create a metric for code-quality. Its a signal that bounces from the code through the system to you.

We have ways of computating the original value after it has bounced through the develop teams system.

https://en.wikipedia.org/wiki/Convolution

The problem is rather- nobody wants to know how much debt they own, or to speak bluntly, whether the situation one is in, is actually a tech-debt bankruptcy.

Re:Code quality: a concern for businesses, bottom lines, and... by ganti_r on Wednesday October 20, 2021 @04:39AM (#28928267)
I tend to agree with this. I inherited a product which had one/two engineers supporting each client implementation. It used to take 2+months to add a new data source.

When we dug in and improved the architecture, we could support 3+ clients with one engineer and add any new data source to less than a week.

I don't attribute it only to code quality but a combination of better architecture, good development practices(proper linting, proper conventions etc) and good product road map.

Focusing only on code quality without context may not be useful. Saying that it doesn't take more than a few minutes to set the core tenets of the project even for a small one time project.

Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @04:42AM (#28928285)
> Deadlines continuously are missed

This is a question of the quality of estimates and unrealistic deadlines. This is a separate problem from code quality. E.g. if you have really bad code but you know how bad it it, then this is factored into the time estimate.

Re:Code quality: a concern for businesses, bottom lines, and... by OneTimePetes on Wednesday October 20, 2021 @05:31AM (#28928635)
Deadlines are missed even for equivalent tasks previously done tasks, executed by a developer who is qualified and capable. Means even reproduction of pre-existing work is hard with the code-base.
Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @07:13AM (#28929302)
The problem is you never have "equivalent tasks". This is the blessing and curse of software development: You never have to do the same thing twice.

Software tend to get more complex over time. Even if code quality is optimal, software will get more requirements added over time - especially if it is successful. If you allocate resources rationally, you will start by solving the "low hanging fruit" in the problem domain. So you cant really compare tasks at different stages in development.

Re:Code quality: a concern for businesses, bottom lines, and... by OneTimePetes on Wednesday October 20, 2021 @09:32AM (#28930432)
You obviously have never been blessed with a truly horrific codebase. There are C-projects out there, were people do almost the same thing - twice.

Like a endless papyrus scroll, and medieval scribes, modifying a copy and pasted atrocity for a month.Code this bad, usually never makes it to HN of course.

Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @01:32PM (#28933426)
In any case, you can have the best code quality in the world and still miss deadlines if the deadlines are not realistic.
Re:Code quality: a concern for businesses, bottom lines, and... by commandlinefan on Wednesday October 20, 2021 @12:26PM (#28932630)
Well, you're arguing (and I agree) that poor code quality can be identified, but not necessarily that it can be measured. The symptoms you list are partly caused by poor code quality, but not entirely either.
Re:Code quality: a concern for businesses, bottom lines, and... by a_c on Wednesday October 20, 2021 @04:59PM (#28936499)
Agreed. I think this is why a tech-enabled startups need a technical co-founder/leadership. Someone need to be the final arbiter/advocate for code quality. There are many things cannot be measured directly or conveniently, e.g. aesthetics (visual quality), culture, interview quality, bureaucracy, etc. All of them indirectly impact bottom line and top line. Big org need measurements for all teams, that's the only way to scale. And that's why in my opinion small business will always find a way to survive, or even thrive, by providing better quality. The quality setup in small team will become the baseline for you to up the game into big org. But once you want to scale, all those none measurable stuff become irrelevant. All boil down to, does it bring in revenue/profit
Re:Code quality: a concern for businesses, bottom lines, and... by nradov on Wednesday October 20, 2021 @09:36AM (#28930499)
There are static analysis tools like SonarQube which can measure code quality to an extent by looking for patterns that typically represent defects, or at least maintainability problems. But they usually can't detect deeper design flaws.
Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @06:15PM (#28937520)
Such tools don't measure any objective code quality, they just measure to what extend the code conforms to some criteria defined by the people configuring the tools. Do these criteria correspond to proven long term maintainability benefits, or are they just unfounded opinions?
Re:Code quality: a concern for businesses, bottom lines, and... by nradov on Wednesday October 20, 2021 @11:38PM (#28939921)
The tools will catch issues like excessively long methods or use of "magic numbers" instead of named constants. Most programmers would agree that those are maintainability issues, although I don't know if it's ever been proven. You can disable any rules you don't want.
Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Thursday October 21, 2021 @05:03AM (#28942063)
Yeah but such rules are still just unfounded opinions which have been codified and human judgement have been removed. What is an "excessively long" method, for example? If a method conforms to good design principles like separation of concerns and low coupling high cohesion, no particular length is too long. If a tool force you to split a cohesive method into multiple methods, then you have increased accidental complexity. So the tool will tell you you have improved some arbitrary "code quality" metric, but actually you have decreased maintainability.
Re:Code quality: a concern for businesses, bottom lines, and... by adam_ellsworth on Wednesday October 20, 2021 @03:52AM (#28927953)
> There is no way to measure code quality

I have to disagree with you on this point (and your third point)

I've seen so many examples where developers DID improve Code quality (CQ) from of the numerous automated/personal quality checks available. (Though what follows is from a Frontend dev perspective)

- CI is CQ

- Code Review is CQ

- IDE w/ Linters is a form of CQ

- `tsserver` is an real-time type CQ

- Immutability is a passive CQ

Idk, maybe Frontend-space is a world away from what you're working with every day, but CQ in my domain has both technological and cultural tools available before code ever reaches the end-user.

> So for non-technical leadership, it is hard to know if "extra time" spent on code quality actually improves anything or is a waste of time and money.

This is really interesting to me as a problem statement: how can devs unfold/make known the value of CQ as a critical function in this math? (I don't have an answer, but I think about it a lot). What are we not sharing – or, worse, what methods/language/etc. are we using that don't fully translate between teams?

I feel it's the job of the org to be able to identify this kind of bottleneck. What position within an org is responsible for explicating the properties of this kind of issue? (Again, I don't know)

Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @03:58AM (#28927996)
But how do you know these things actually improves code maintainability long-term? How do you quantify the effect?

Code reviews and linting is just applying some opinions to code. How do you show empirically these opinion are valid?

Re:Code quality: a concern for businesses, bottom lines, and... by adam_ellsworth on Wednesday October 20, 2021 @04:39AM (#28928261)
Ah! Very good questions. Thank you for asking.

> But how do you know these things actually improves code maintainability? How do you quantify it's effect?

Trends. Trends in Client retention, trends in fewer user-submitted bugs. Trends in error rates garnered from logs. Trends in employee retention. Simply stated, Statistics. Imagine: you code a Minimum viable product (MVP) and get to market! Then you're inundated with user-submitted and computer monitor-submitted issues (i.e. AWS alarms) – you have a "shit show" of a product. So, how do you improve this MVP to reduce the Trends of failures? The solution is expressed in the ways I outlined above (but with vigor): CI, Tests, utilizing language linters such as TypeScript's tsserv, etc. (and so much more).

> Code reviews and linting is just applying some opinions to code. How do you prove these opinion are valid?

It's not an "opinions on code", it's a culture which is predetermined by the org (assuming the culture is healthy enough to understand its necessity and/or recognize its deficiency of the same). EVERY org needs to "scale". Orgs asked themselves: how do we effectively "scale" and what is "scale" org-wise? The tenets vary, but the history has painted a portrait of domains: SRE, DevOps, Data Analysts, Frontend, Backend, Product, Systems, Networking, SDET, etc. Each is not encumbered by the need for tests/CI/pre-deploy shtuff (arguable), but is released from "toil" because they recognized scale went beyond "opinions on code."

Validity of code is tests and there are many, many, expressions of tests: End-to-end, Integration, Regression, Smoke tests, Unit, etc.

> How do you prove empirically that immutability is not just a fad like so many others?

I look back on the time before I was cognizant of the concept of Immutability and every larger FE app I wrote feels now indistinguishable from disorder and turmoil. I hope the YC community can expand on the necessity of immutability from a maths perspective (as I cannot), but it's eminently scalable (read: understandable and practicable from an FE dev perspective).

(It's late and I gotta cut off here, hopefully someone can expand and/or redact everything I've said).

Cheers

Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @05:51AM (#28928765)
> I look back on the time before I was cognizant of the concept of Immutability and every larger FE app I wrote feels now indistinguishable from disorder and turmoil.

Good for you, but this is not very objective. People were saying the same things about OO inheritance and and a bunch of other stuff which the industry have later become more skeptical towards. I'm not saying you are wrong about immutability, just that you cant show any solid empirical evidence that immutability improves long-term maintainability.

Re:Code quality: a concern for businesses, bottom lines, and... by hvidgaard on Wednesday October 20, 2021 @10:05AM (#28930802)
On the topic of immutability you can actually trace it back to a point (and languages even) where every variable is a global one. That almost always leads to hard to debug errors and generally poor quality of the final product until you catch all the bugs. The natural "fix" is to have variables that a scoped and cannot be used outside of that scope - I hope I do not have to make the case for why that strictly improves long term maintainability.

Immutability is taking it a step further and provide a mechanism where scope does not matter. If you have an immutable object you can always expect the values to be what they are and not changed by some other path of code. You can freely pass around the immutable objects because they cannot be changed.

In other words, it's a mechanism that you can use to ensure that no matter what is changed, it's not the value of you immutable objects. I'd argue that it lowers the surface of things to consider and with any decent tooling also prevents you from trying.

Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @10:37AM (#28931146)
So you try to convince me that immutability is great. But I did not say I don't believe in the benefits of immutability, I said there is no empirical evidence that it leads to better long term productivity.
Re:Code quality: a concern for businesses, bottom lines, and... by hvidgaard on Monday October 25, 2021 @03:04AM (#28985151)
I'm not in a position where I can give you any empirical evidence because I do not collect it. My teams do see a decrease in bugs that reach production when they start to embrace immutability. But, the catch is that most of those teams are on a general journey of known good practices such as integration tests, static analysis, linting, and to some degree unit tests and reducing cyclomatic complexity. So I cannot in good faith give you any numbers because I do not run controlled experiments for that alone.
Re:Code quality: a concern for businesses, bottom lines, and... by adam_ellsworth on Friday October 22, 2021 @12:32AM (#28953772)
Looking back on my replies a few days later I think I missed every mark I tried to hit. The arc of the "narrative" was about the nascent devops bleed into the frontend space which our team appreciates from now - but failed to make any real sense of it. I'm not a good writer.
Re:Code quality: a concern for businesses, bottom lines, and... by piva00 on Wednesday October 20, 2021 @07:17AM (#28929331)
> People were saying the same things about OO inheritance and and a bunch of other stuff which the industry have later become more skeptical towards.

In my experience this is the usual adoption curve of new practices (not necessarily best practices). They come as a shiny new solution for an annoying problem, it gets absorbed by early adopters that then become evangelists. More people start using these patterns/practices and start encountering the issues and obstacles with it, some get disheartened, frustrated and become outspoken against it.

These practices then evolve with time, becoming more nuanced, having "best applications" and "non-use cases" to better judge its applicability. And then becomes mainstream and a expected practice for modern software development/engineering.

I've seen this with multiple trends: OOP-isation of everything, UML (birth and death, kinda superseded by C4 diagrams these days), NoSQL, microservices/SOA, Kubernetes, Dockerisation, and so on and on.

FP and immutability are getting into the maturing phase of this, I remember a few years ago when it started making inwards on FE development, it was adopted, kinda overused and now I see it trending towards more cautious adoption.

I believe it's all a matter of understanding, all new shiny things will always have early adopters that can cope with the pain points. These are addressed when getting more mainstream and with that comes the knowledge of what actually these pain points are in the real world after years of adoption.

I don't see this pattern changing anytime soon, I've seen it repeat too many times the past 15 years.

Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @07:34AM (#28929457)
Totally agree. I will add that the hype is typically ignited because a technique have shown real benefits in a particular domain. The problem comes when the technique is treated as a panacea and is applied uncritically outside of this domain. This eventually cause a backlash, which may even hurt adoption in the original domain where the technique was successful.
Re:Code quality: a concern for businesses, bottom lines, and... by afandian on Wednesday October 20, 2021 @04:47AM (#28928309)
If the average developer has to be able to maintain (and therefore understand) the code, it stands to reason that the more eyes on it the better it converges on this state.
Re:Code quality: a concern for businesses, bottom lines, and... by ken47 on Wednesday October 20, 2021 @02:13PM (#28933968)
I disagree with the idea that there is no way to measure code quality. As long as one is willing to sacrifice a lot of precision, it is certainly measurable. Just come up with adequately broad, discrete buckets.
Re:Code quality: a concern for businesses, bottom lines, and... by feanaro on Wednesday October 20, 2021 @04:32AM (#28928211)
Sounds to me like the problem lies in the existence of non-technical "management".
Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @01:51PM (#28933672)
Unfortunately technical management have the same problem.
Re:Code quality: a concern for businesses, bottom lines, and... by kodah on Wednesday October 20, 2021 @09:42AM (#28930566)
Personally, I think "measuring code quality" means looking for things you absolutely shouldn't or probably shouldn't be doing.
Re:Code quality: a concern for businesses, bottom lines, and... by marginalia_nu on Wednesday October 20, 2021 @04:02AM (#28928020)
Why do we need to measure code quality?
Re:Code quality: a concern for businesses, bottom lines, and... by goto11 on Wednesday October 20, 2021 @04:36AM (#28928237)
Because a business need to allocate resources rationally if it wants to survive.
Re:Code quality: a concern for businesses, bottom lines, and... by marginalia_nu on Wednesday October 20, 2021 @04:51AM (#28928341)
This seems in conflict with the fact that we, as humans, are subjects -- with no direct access to any sort of objective reality.

The measurements these businesses are looking at are (by definition) disjointed from reality as experienced by their customers and employees.

Re:Code quality: a concern for businesses, bottom lines, and... by ducharmdev on Wednesday October 20, 2021 @10:45AM (#28931256)
Given any entity that yearns for its own survival (a person, a business, an organism etc): does it matter whether it's means of observing the world are imperfect if said means are good enough to ensure it's continued survival?
Re:Code quality: a concern for businesses, bottom lines, and... by marginalia_nu on Wednesday October 20, 2021 @10:59AM (#28931439)
Is good enough all we're striving for? Is treading water the pinnacle of human accomplishment?
Re:Code quality: a concern for businesses, bottom lines, and... by ducharmdev on Wednesday October 20, 2021 @12:59PM (#28933050)
For a lot of businesses, yes - that's exactly what they're striving for.

I think what's confusing to me about this and your previous point, is you mentioned this inability to access objective reality outside our own subjective experience, but now appeal to a shared human experience (i.e., there's a general human accomplishment we should all be working towards that goes beyond our subjective experience). I can understand one or the other, but it seems there's some tension between those 2 views.

Re:Code quality: a concern for businesses, bottom lines, and... by UncleMeat on Wednesday October 20, 2021 @08:06PM (#28938535)
Let's say I see a big problem in the codebase. I want to hire fifteen engineers to solve it. You are the CFO. I tell you "I'm improving code quality." Do you give me the money to hire those fifteen people? All I can tell you is that I am qualitatively improving code quality.