Live data from Hacker News

Are software engineering “best practices” just developer preferences?

floverfelt.org

281–290 of 369 posts

Re: Are software engineering “best practices” just developer preferences?

#281
A lot of "best practices" are developers who make code complex in order to attain some level of architectural purity for its own sake.

An example of this I recently experienced was trying to understand and debug what should have been a simple integration app, but where a ton of injected commands and queries were used to implement the functionality. Following the logic was painful as the code was completely atomized for no particular reason. Worse, real-world concerns, like proper logging, were ignored.

I hate to call this an "autism tax", but perhaps there's something to the term: many intelligent developers, especially left unsupervised, tend to pursue highly abstract solutions, to what should be straightforward problems in order to satisfy a compulsion for order and symmetry.

Re: Are software engineering “best practices” just developer preferences?

#282

The biggest issue I saw with "best practices" in my career is the failure to take into account who it claiming it to be a best practice, and in what context . I saw too many junior developers read a rando blog article, then get a non-technical / semi-technical manager excited about something that made their life easier, even though it was by no means a good practice for the context at hand. Or alternatively, believe…

Managers excited about a new tech idea are probably the most destructive thing in the industry.

Re: Are software engineering “best practices” just developer preferences?

#283
post #282

The biggest issue I saw with "best practices" in my career is the failure to take into account who it claiming it to be a best practice, and in what context . I saw too many junior developers read a rando blog article, then get a non-technical / semi-technical manager excited about something that made their life easier, even though it was by no means a good practice for the context at hand. Or alternatively, believe…

Managers excited about a new tech idea are probably the most destructive thing in the industry.

As are managers that conform to archaic tech when better options exist.

Re: Are software engineering “best practices” just developer preferences?

#284
post #216

Earlier quoted context omitted.

What of those who graduated from engineering programs taught at engineer colleges? Lots of people in other engineering disciplines build stuff with less rigor than is used to build software. Maybe load test it in Fusion 360 before sending the file to be milled. And lots of software companies test their stuff quite rigorously. People who write software have imposter syndrome. Other disciplines are not building things…

> What of those who graduated from engineering programs taught at engineer colleges? We are the actual Engineers. For US-Based IT workers, that means a degree from an ABET [1] backed institution with a traditional undergrad and graduate programs. Anyone else calling themselves an "engineer" while doing IT work are not. In addition: Readers need to remember this isn't reddit and downvoting comments with facts you do n…

[deleted]

Re: Are software engineering “best practices” just developer preferences?

#285
post #252

Earlier quoted context omitted.

Each of these things prevents isolated testing of dependent components. For that reason alone they are nonstarters.

globalvar = new NopImpl() works fine for testing. If you squint, you can even think of dependency injection frameworks like Dagger as a lot of boilerplate around a global database of instantiations.

Until you try to run two tests at once, one which requires NopImpl and one which requires the real impl.

Re: Are software engineering “best practices” just developer preferences?

#286
post #216

Earlier quoted context omitted.

What of those who graduated from engineering programs taught at engineer colleges? Lots of people in other engineering disciplines build stuff with less rigor than is used to build software. Maybe load test it in Fusion 360 before sending the file to be milled. And lots of software companies test their stuff quite rigorously. People who write software have imposter syndrome. Other disciplines are not building things…

> What of those who graduated from engineering programs taught at engineer colleges? We are the actual Engineers. For US-Based IT workers, that means a degree from an ABET [1] backed institution with a traditional undergrad and graduate programs. Anyone else calling themselves an "engineer" while doing IT work are not. In addition: Readers need to remember this isn't reddit and downvoting comments with facts you do n…

Just because a private organization says they have monopoly on the word “engineer” doesn’t mean they actually do.

Re: Are software engineering “best practices” just developer preferences?

#288
post #236

Earlier quoted context omitted.

People also bash singletons, so you can't really win. You can get issues with a singleton being accessed for the first time from multiple threads at once, for example, so you end up with more than one instance being created or a situation where one thread triggers the creation and another accesses before it has been fully initialized, depending on the code.

If you expect that sort of thing to occur, then your get method should be synchronized to prevent it.

These days in both Java and Swift you can just lazily reference a static class field/property set to an instance of the singleton (in java the field must be on a dedicated private class) and the Runtime will lazily initialize it exactly once in a thread-safe manner the first time it is referenced.

Re: Are software engineering “best practices” just developer preferences?

#289
post #110

Eh, kinda. Calling something a "best practice" is basically an appeal to authority. It means, "this is the right way to do things, for reasons I don't have time to explain." There are times when that's appropriate. But really, "best" and "right" are highly situational. Any rule of thumb, even the most basic and uncontroversial, has a situation where it doesn't apply. I was part of a discussion on a mailing list years…

One thought to add here - when you appeal to an authority, which one is it? In the OP example, it seems the senior dev is saying “on my authority”. And sometimes that is enough, especially if the senior dev can give examples of when not following this practice bit them. But sometimes there is a higher authority, such as “it’s what is recommended in Google’s SRE book”, which is probably good advice if you are building…

“Best practices” smells like such a marketing term it should be tossed in the bin.

It’s poetic language that has nothing to do with specific problems.

What people usually mean when it comes to engineering is “be safe, reliable, and correct.”

Security best practices to be safe.

Developer best practices for reliability.

Etc etc

“Best practices” is hand wave-y fluff for “do a good job” and doesn’t need a technical definition.

Make sure you’re secure, reliable, and correct given the engineering context, and odds are you result in a system that also has a lot of specific best practices in place.

Re: Are software engineering “best practices” just developer preferences?

#290

Earlier quoted context omitted.

Singletons come to mind as being a better alternative in languages that can do that sort of thing.

Singletons are globals, aren't they?

Kinda depends. Single instance things are usually globally referenced, but as long as you're referencing an instance and not a static thing they're not hard to convert to an "injected" dependency if you need to provide a test impl to some thing being tested. The real problem is static things that can't be swapped out because you're actually calling static methods on some class rather than sharing an instance and calling instance methods.
Post reply on HN