TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Do Best Practices Matter?

31 pointsby jshchnzabout 1 year ago

10 comments

leptonsabout 1 year ago
Today's "best practices" are tomorrow's "worst practices". I've seen it over and over in the 40+ years I've been writing software. Someone tells you "this is how you need to code", and then 1 or 2 years later, someone else tells you "that's trash, now code like this". Rinse and repeat.
评论 #40089547 未加载
评论 #40090313 未加载
PUSH_AXabout 1 year ago
I agree with the takeaways here. Juniors, intermediates and more seniors than should, have a complete inability to zoom out and appreciate where their software fits in to the business. Hyper focused on minutia. Eager to debate in a PR.<p>Once I learned how to zoom out I found it really difficult to work with a large number of engineers. I feel like I’m really overdue to step out of a hands on role nowadays.
评论 #40091196 未加载
评论 #40092421 未加载
greymalikabout 1 year ago
&gt; The best practices we followed often felt like cargo cult programming.<p>Best practices <i>are</i> cargo culting if they aren&#x27;t adapted to the local context.
评论 #40089828 未加载
satisficeabout 1 year ago
There are no best practices. “Best practices” is a marketing phrase, not an engineering one.<p>There are practices I like. There are practices YOU like. There are practices that are demonstrably good in certain ways for certain situations.<p>Instead of best practices, seek responsible practice. Develop your heuristics. Try things and learn your craft.
preommrabout 1 year ago
&gt; This was a revelation to me and got me thinking: what is OOP actually trying to solve?<p>This is the problem in a nutshell.<p>Someone comes up with sensible advice, and like a bad game of telephone it gets stripped down to some brain-dead phrase that gets parroted around by reflex. And it&#x27;s everywhere in software. It was always things like &quot;prefer composition over inheritance when possible&quot; - people chose to ignore it, and go ham with sprawling inheritance trees and design patterns for different languages because of a superficial understanding of software because we optimize for all the wrong things. There&#x27;s interview questions where they&#x27;ll ask what are the four pillars of oop or some nonesense, and one of them will be inheritance or something and so if you&#x27;re not doing it that way, it&#x27;s bad practice.
Const-meabout 1 year ago
I agree with most of that article, but the answer to the question in the title is “it depends on the practices”. Some of software engineering best practices are universally applicable, and they really matter. Using version control for source code. Writing functional specs in some form (at least very high level in half page of text) before writing code. Using meaningful names for variables instead of a, b, c, d. Commenting the source code when necessary.<p>The part I disagree is about the OOP. It’s not the best to write software, but very often the best way to design software which has to deal with complicated mutable state.<p>FinTech system running on servers probably doesn’t need mutable state much or at all: things are immutable, transactions are appended to append-only ledgers, and the mutable state is only present in external systems like SQL databases. However, it’s borderline impossible to make a videogame, rich text editor, a file system, GUI framework, or an XML DOM without some form of OOP.
JohnMakinabout 1 year ago
OOP is a blight upon our industry that I can&#x27;t wait until people eventually figure out. Sorry, I know this is a hot take, and that it can be useful (one of my first primary languages was Java), but its potential for misuse and sprawling, spaghetti&#x27;d codebases is far too dangerous.<p>I remember the first time I took a high-level programming theory course and ran into procedural languages and to that point I&#x27;d genuinely not even considered that another paradigm existed, I&#x27;d had OOP rammed down my throat in the form of C++&#x2F;Java for 3 years straight.
评论 #40091232 未加载
评论 #40090544 未加载
al_borlandabout 1 year ago
I think this is a complicated issue. While I think it’s important to maintain focus on the actual point of software (delivering something useful to people), it’s important to not completely ignore the shoulders of the giants who came before us, to avoid learning old lessons the hardest, and avoid solving already solved problems.<p>I think Tesla is guilty of this when it comes to their manufacturing. Elon wants to do everything from first principles to remove waste, meanwhile the “old guys” designed and rolled out competitive products to mass production, while Tesla struggled for years. Experience matters, but doesn’t mean anything if the playbook keeps getting thrown out.
评论 #40089333 未加载
mrkeenabout 1 year ago
&gt; In the OOP world I would have expected to see a Loan class with methods like create, get_offers, and make_payment.<p>Rookie mistake! I&#x27;m usually very critical of OO, but this ain&#x27;t it. Good OO is about <i>delegation of behaviour</i>. The <i>Loan</i> is not the <i>payer</i>, so no make_payment() method please. Same with create and get_offers (unless we&#x27;re just talking about constructors&#x2F;getters here, but I don&#x27;t think that was the intent). If a Loan did have a make_payment, and get_offers: why stop there? It&#x27;s also going to need calculate_interest(), persist_in_db(), renegotiate(), compare(), calculate_amortisation(), get_currency(), get_minimum_repayment(), forgive(), calculate_late_fee(), alert_late_customer(), and a hundred others to be figured out along the way. So it&#x27;s good OO for a Loan to just be struct-ish (There&#x27;s even a dumb word for it - &quot;POJO&quot;). Or, even better, just a UUID!<p>You can apply some SOLID cargo-culting to the above. If you put so much behaviour into Loan, you&#x27;ll be forever changing it, updating it, and risking unrelated breakages, violating the Single-responsibility principle (&quot;one reason for a class to change&quot;). I&#x27;m not a huge fan of that particular principle (it&#x27;s vague and doesn&#x27;t tell you how to fix it!) but I am a fan of Dependency Inversion (which does!).<p>A Loan is <i>abstract</i>, we both know what we&#x27;re describing - even though we have completely different tech stacks. If a Loan has get_offers(), those offers will need to come from somewhere, whether you&#x27;re talking about other classes (OfferService? DiscountService?) or over http or via a database or something. And those are <i>concrete</i> (Java! JSON! Rest Calls! DB Tables!) DI says to flip the design around so that the concrete things instead know about the abstract Loan, and the Loan becomes sufficiently dumb. Then when it comes time to change interest calculations, you change only the InterestService, likewise with CurrencyConversionService, OfferService, etc. You&#x27;re back to single responsibilites!<p>&gt; It turns out the command structure checks all of these boxes. It&#x27;s dead simple to understand. There&#x27;s no layer of indirection trying to piece together OOP hierarchies. It encapsulates the business logic developers actually want to run in a single place, you don&#x27;t have to figure out how to wire together a bunch of objects on your own. And testing is dead simple, it&#x27;s just a function with easy to understand inputs and outputs.<p>If you skip the indirection and just test all your logic in a single place, you&#x27;re bound to be tripped up by your dependencies. You can probably test 80% of `calculate_interest.rb` with just inputs, functions and outputs, but `make_loan_payment.rb`? There&#x27;s going to be dependencies that you shouldn&#x27;t invoke in a test scenario. The indirection &amp; wiring is how you organise the code so that you can put test-doubles in the right places, and control exactly what you want to test for.
评论 #40092703 未加载
mouzoguabout 1 year ago
when i started my career, being a lazy dev was seen as a positive trope. it was understood as someone who is pragmatic in their choices.<p>we all spoke the same language.<p>now say you are lazy and your &quot;resume&quot; will get immediately trashed.<p>different culture and people.
评论 #40093150 未加载