I Was Wrong About Single Responsibility Principle | Prime Reacts

I Was Wrong About Single Responsibility Principle | Prime Reacts

ThePrimeTime

7 месяцев назад

83,084 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@DizzyThermal
@DizzyThermal - 11.01.2024 15:57

Prototyping helps me make a bunch of mistakes up-front, which sometimes can help me understand how to optimize what I'm creating. If everything I'm writing against is well documented, I may not need the prototype, but that may not always be the case.. I do agree that a lot of projects and companies ignore their technical debt until it's too late though, that's a fact!

Ответить
@alexandervasylevskyi1332
@alexandervasylevskyi1332 - 11.01.2024 12:35

Can't agree more that you need those thousands failures. I had couple of great teachers which knew all the software architecture concepts and explained them like they've created them. But one day they've decided to start coding. And boy it took long time for them to apply their knowledge

Ответить
@mattiasmartens9972
@mattiasmartens9972 - 10.01.2024 22:42

Per Wikipedia Robert Martin went on to rephrase SRP with a much clearer (and arguably quite different) meaning:
"Gather together the things that change for the same reasons. Separate those things that change for different reasons."

I like this. It's a good answer to DRY. For example if you are building an API for finance to view your sales, and an API for data analytics to view your sales, it is tempting to have them be the same API because at a small scale the difference between the two use cases are trivial to paper over.

But at some point finance will start talking about bounced payments and fiscal years, and analytics will start talking about correlation IDs and shopping carts, and that's gonna lead to a sad time where you'll wish you'd duplicated most of that code from the jump.

Ответить
@chandlercoates7637
@chandlercoates7637 - 10.01.2024 21:25

well I disagree with you disagreeing

Ответить
@GrzegorzNyga
@GrzegorzNyga - 10.01.2024 16:01

Where can I watch VODs from this live streams?

Ответить
@sirJ0rd4n
@sirJ0rd4n - 10.01.2024 15:38

Dreamt you were baby sitting my sister. And you refused to acknowledge your online presence.v strange.

Ответить
@nickr753
@nickr753 - 10.01.2024 15:30

"There should be only one reason to change it" is better understood as there being only a single person or role within the organization who would be responsible for a decision to change the class. For example, if the class is an implementation of a business process defined by the org's director of finance, then only a decision by the DoF to change that business process should result in a change to the class. This is related to Conway's Law (no relation to the Game of Life) -- "Organizations, who design systems, are constrained to produce designs which are copies of the communication structures of these organizations."

Ответить
@Archheret1c
@Archheret1c - 10.01.2024 15:07

"Get a working copy then refine it"
I´ve worked on too many such projects, the truth is that they never get refined.

Ответить
@andrewdunbar828
@andrewdunbar828 - 10.01.2024 10:47

this is a very abstute comment

Ответить
@SewsAndCodes
@SewsAndCodes - 10.01.2024 10:25

Hi! I wrote the article you're reading 👋🏻. Very interesting analysis, I think you're correct that a lot of software engineering knowledge is tacit and is gained by individual experience, but I don't necessarily think that that's the only way to do it. For example, Pete McBreen in Software Craftsmanship suggested a guild-like model where apprentices learn from masters; the point of that approach is that the master chooses the tasks for the apprenticeship that model all of the learning points.

Ответить
@dickheadrecs
@dickheadrecs - 10.01.2024 08:20

“Uncle Bob, this is Enrique”

Ответить
@theodorealenas3171
@theodorealenas3171 - 10.01.2024 07:55

Why is it like most of the comments came from people who didn't watch the video? They're talking about the first part of the video, that says the misconceptions about SRP and not the second part of the video that untangles it

Ответить
@TheBestNameEverMade
@TheBestNameEverMade - 10.01.2024 07:25

Excessive optimization is going to lead down a rabbit hole, I have seen it too many times. Often, also what one thinks is fast is actually slower than the simpler option because of cache and branch predictions.

Do you think Unreal Engine would have even existed today if the first thing they did was Nanite. No, that was incrementally built, and with the rest of the engine done, it was easy to test it against the old version.

I think you are talking about premature pessimization. These are things you know are going to be slow, and it's near zero effort to use the faster version so do those things. Premature optimization is more about optimizing something you don't either know will be slow, you don't know if you will need to feature, its going to take multiple times the effort or maybe in the grand scheme it does not matter. Read Herb Sutter's C++ coding standards book on that.

Also, I am a game dev. Optimized many projects and seen a ton of premature optimization in my time sucking up project time and then been thrown away.

Ответить
@wildbuffalo1712
@wildbuffalo1712 - 10.01.2024 06:30

My favorite programming paradigm is where I can create what I imagine.

Ответить
@jeffreybritton3338
@jeffreybritton3338 - 10.01.2024 06:09

After reading the SRP article on Wikipedia, my conclusion is the term is ill defined. Apparently everyone misunderstood the original definition and the clarification didn’t help matters any.

Ответить
@dehb1ue
@dehb1ue - 10.01.2024 04:39

So SRP is a corollary of Conway’s Law?

Ответить
@Bozebo
@Bozebo - 10.01.2024 03:29

In other words, should is a different word from must.

Ответить
@yessopie
@yessopie - 10.01.2024 02:44

My rule is, "don't follow a rule that you don't agree with". If you don't agree with the rule, then either: 1) it's a stupid rule; 2) you don't understand the rule; or 3) you don't understand what following the rule is supposed to accomplish. SRP was never supposed to be about having only a single "change point". When they saw this, they should have thought, "Do I agree that a module should only have a single change point? I need to be convinced before I do this." But now we're at a point where new programmers are just blindly following (and misunderstanding) the advice of previous generations of programmers instead of reasoning from first principles.

Ответить
@potato9832
@potato9832 - 10.01.2024 02:41

The problem with software "engineering" is everyone thinks their farts smell like roses and everyone else's farts smell like gut rot. Design never gets better than my opinion vs your opinion. Nobody is correct and everyone is correct. It's an endless circle of nitpicking other people's nitpicks.

Ответить
@meiliyinhua7486
@meiliyinhua7486 - 10.01.2024 02:29

Honest question: do most codebases have any sort of documentation with some sort of scale of "don't fuck with this unless you really need to" in there?
Like so if you were going to maintain a dependency of some sort, you would see where it is on the scale relative to downstream and upstream packages, and make an informed decision about whether maintaining that dependency is better than rewriting (or copying over with bug fixes and/or new features, and using that for your new dependeency chain?

Ответить
@chickenmonkey88
@chickenmonkey88 - 10.01.2024 02:11

People need to stop wasting their time trying to decipher the prophecies of Uncle Fraud.

Ответить
@michaelcombs5287
@michaelcombs5287 - 10.01.2024 02:00

You call it brain rot, we call it: "no ... u"

Ответить
@mathboy8188
@mathboy8188 - 10.01.2024 01:46

Isn't the concern about upfront performance considerations the worry that you'll be locked into architectural structures that will never be sufficiently performant? Conceptually, I try to consider that, but don't initially worry about performance in the lower level small details that can be relatively easily changed... for those I'm all in on
Make it work; Make it pretty; Make it fast
(I'd add don't even try to make it fast at these lower levels until it's established that you need to... pretty is more important until it's proven that faster is necessary.)

I try to think about big picture inflexible performance at the start, but mostly ignore performance in the details, provided those are details where you could relatively easily swap out doing it another way. At that level, it's often fairly straightforward to go from clean to performant if necessary. But the converse in my experience is not true... if you try to write the smaller non-architectural details as performant from the start, then it's going to be ugly and inflexible, and almost certainly will remain ugly and inflexible forever, and thus forever will be harder to understand and maintain. And very likely, that choice wasn't even necessary! There's a reason no one codes in assembly unless it's absolutely necessary. In other words, for these smaller bits, my view is that you don't want to make a mess in the name of optimization until it's demonstrated that necessity demands that you accept a mess in the name of optimization.

Pretty is more important than blazing performance "in general" (programmer salaries are the main cost of software dev),
and pretty to perfomant is a one-way street.

Ответить
@khatdubell
@khatdubell - 10.01.2024 01:26

The problem is people are dumb.
Most people are dumb.
If fact, you could say about half of the people out there are below average intelligence.
Its not a high average, either.

Ответить
@ElvenSpellmaker
@ElvenSpellmaker - 10.01.2024 01:22

I believe we've been trying to idiot-ify development for ages.

I agree readable is often a good thing.

Buuuuut, hot take here:
I wrote a system for pagination with filtering in PHP and the code wasn't nice to look at. It even used goto at one part, but it did well, and as fast as PHP basically could given the framework (Falcon) and SQL layer provided.

It got merged but much gritting of teeth was done, and Devs said it wasn't all that readable or extensible.

The devs who merged it clearly didn't quite understand some of the stuff I did but it worked.

Anyway go forwards a few months, we got this new dev in, he picked it up and extended it within his first sprint there. Bam, no problems whatsoever, it just took a dev worth his salt and someone who could reason code.

Ответить
@Yupppi
@Yupppi - 10.01.2024 01:05

I've been thinking: is software engineering all about trauma handling and self-help, because everyone seems to tweet and write blog posts that are aiming to be insightful life-coaching (or ranting about social aspects) or perhaps philosophical paths. It feels fundamentally different to any other engineering to me (or I haven't been exposed to this side of other engineering fields).

Ответить
@NihongoWakannai
@NihongoWakannai - 10.01.2024 00:58

I completely 100% disagree on "we can't teach people, they just need experience"

Software engineering is not some completely unique special field separate from every other one where you can only learn through experience.

Just like EVERY OTHER job and field in the world, good software engineering can be taught. Sure, you need experience as well because you can never be good with just studying, but to say that bad software engineering teaching "can't be fixed because people just need experience" is categorically false.

Ответить
@traee7047
@traee7047 - 10.01.2024 00:57

I feel like loosely coupled code is way better at explaining how you should approach single responsibility. It shouldnt be over engineering just so you dont have to make a change in 2 places either.

Ответить
@drygordspellweaver8761
@drygordspellweaver8761 - 10.01.2024 00:35

Down with OOP and tunnel digging pedogogues

Ответить
@v2ike6udik
@v2ike6udik - 10.01.2024 00:30

Excel :'D Heheh. _ Minus 25 years..._

... back in 1999, when net was not yet "human right" and we had FLOPPYS etc, "as nonmillionaire" kiddo, i wrote fantastic static megaweb builder in Excel :D (Config, component instance data, content page data, image metainfo, TABLES, TABLES WERE AWSOME etc).

Javascript to handle huge ultrafast ultra nice expandable menus. Everything was a component. {x:table=table_blaah_id} {x:image=id|popup|right|theme=blaah|etc}). Fantasic. Awsome in-excel tools to manage it all.

I had few sites with 10000+ pages. You guise know how fast one can enter data into excel? ULTRAFAST. Export to disk was almost INSTANTANEOUS (second or two). gzip and upload.

486DX100MHz 8MB RAM with 480MB Conner took the that fast penetration like professional ho. :)

A bit later a discovered that I also reinvented the wheel i mean MVC or smth. :'D The stuff curious kids can do. Insane. PS! I should rewrite it and spice it up with JQuery. Dont beat me. :D

There are no impossible things - just incapable minds or lack of money! ;) VBS thought me how to transmute pain to gain through pain.
--
PS! DONT TAKE THE CHICKS-CHICKS-CHICKS-DJABBELJUICE! (You will be here forever. Lissin, Linda. It´s a long time.) IF ONE DAY YOU FIND, YOU ARE DÖD, DO NOT REINCARNATE! NO SUBBMISSION TO GUILT TRIPPING! DO NOT TRUST PPL UPTHERE WHO MAY LOOK SOMEONE YOU KNOW OR LOOK LIKE JEEBUS! GO TO THE VOID! THIS PLACE IS A TRAP! IM DÖD SERIOUS. :|

Ответить
@SibDesign
@SibDesign - 10.01.2024 00:18

Can you please increase the volumne of your voice in the future videos?

Ответить
@msc8382
@msc8382 - 10.01.2024 00:18

This scares me. I see a lot of comments saying engineers with opinions exist. This is very dubious. Engineering is about identifying a problem without opinionation in a systemic/predictable way where every step produces the means to relate part of the solution to a problem, and then apply the smallest solution that solves the problem.

Developers who don't apply engineering principles do the work based on opinion. And as quality assurance lead with 10 years of multi diplinary language experience, those people cause me the most work and consistently too.

If you can't do your work without opinion, you're not engineering. If you disagree, please elaborate how. I'm very open to be shown different perspectives.

Ответить
@rogergalindo7318
@rogergalindo7318 - 10.01.2024 00:04

totally unrelated, but you should definitely watch this video, is great, by the guy of “this is my favorite linux command”

I Spread Dangerous Misinformation (Apology Video)

Ответить
@kyoai
@kyoai - 10.01.2024 00:00

SRP in software is like building a house where every room is only responsible for one thing : one room for sleeping, one room for storing clothes, one room for eating, one room for watching tv, one room for storing food, one room for storing drinks, one room for storing dishes, one room for washing dishes, etc. A good idea in theory, but often it makes sense to merge things together.

Ответить
@clachdhearg2109
@clachdhearg2109 - 09.01.2024 23:59

a lot of the wisdom from old se heads comes from careers working in large corps where you had to manage org complexity as much as software complexity esp w/ change management pre-standardized source control.. its worth understanding but good chance it doesnt apply anymore we have different paradigms now

Ответить
@rickwoods5274
@rickwoods5274 - 09.01.2024 23:55

"Build a working copy, then refine" -- no. Prototype a working copy, then scrap it and build it right is great.

Ответить
@petercfraedrich
@petercfraedrich - 09.01.2024 23:28

I think the fundamental disagreement about the work/pretty/fast thing is that you shouldn't commit your code after the "work" stage, only after the "fast" stage.

Ответить
@ollydix
@ollydix - 09.01.2024 23:23

In my day the hot take was 'everything singletons' and you'll be ok.

Ответить
@-Jason-L
@-Jason-L - 09.01.2024 23:13

SRP is responsible "to", not responsible "for".

Ответить
@carlynghrafnsson4221
@carlynghrafnsson4221 - 09.01.2024 23:04

This guy here.... he wants one input and multiplex outputs. You have to take it with a grain of salt, otherwise you walk into oop land without realizing. I wouldn't get hung up on it without a concrete example that frustrates him. SRP wasn't created for higher level, like oop or microservices. It wasn't envisioned like that, as if there were ancient prophets that knew what was coming. It was about the smallest unit.

Ответить
@BlazingMagpie
@BlazingMagpie - 09.01.2024 22:51

I understand single responsibility as a way to reduce context overload. Having to keep a lot of context in head is the devil. My little brain starts to leak when I write more than 20 lines of code, so I write simple classes and functions that know little and do little, then compose them to do a little more.

Ответить
@ifstatementifstatement2704
@ifstatementifstatement2704 - 09.01.2024 22:47

It’s all arbitrary. That’s what people in software refuse to accept. It justifies their shitty behaviour towards others, so they will never accept.

Ответить
@c4tubo
@c4tubo - 09.01.2024 22:43

No one can explain SRP because it is unexplainable. IMO, SRP and SOLID were invented as rationalisations after we all witnessed OO failing to deliver on any of its promises. I state this with confidence because I drank the Kool-Aid for so long and was a guilty party along with the high priests of OO selling its snake oil.

Ответить
@csabaczcsomps7655
@csabaczcsomps7655 - 09.01.2024 21:59

SRP is complete when any programer read the code say "this is funny".

Ответить
@jonludwig1632
@jonludwig1632 - 09.01.2024 21:42

As a tech artist working with performance optimization for games, the pitfalls of "make it work, make it pretty, make it fast" is something I am constantly on about.

Ответить
@adambickford8720
@adambickford8720 - 09.01.2024 21:41

I remember working on a java thick client and there was more effort around if it was 'real mvc' than solving the users problem. Don't lose sight of the actual goal.

Ответить
@chudchadanstud
@chudchadanstud - 09.01.2024 21:40

"Make it work, Make it pretty, make it fast" is how you keep your job and grow your business. On the top of my head I have not heard of a single successful company that has succeeded by optimising first. The mantra applies in all fields of engineering. The first cars were ugly and slow, but they worked.

Ответить
@ryanseipp6944
@ryanseipp6944 - 09.01.2024 21:37

I'm with you on the line of prime. That being said, I also prefer building infrastructure. Lower level things will be built upon to the point where every behavior will be depended upon. In that case, if you don't design with performance in mind, you'll never reach the optimum.

On the other hand, Theo is more interested in getting products in front of users, all else be damned. Especially in a startup where the future is uncertain, that makes a lot of sense. The rewrite will suck, and you'll certainly pay for the mistakes later, but having revenue is the thing being optimized for

Ответить