|
DaTroof posted:the controller class is a good example. ime inheritance works better if it's shallow, even if it's wide; e.g., a handful of classes that directly extend a single superclass. if your inheritance tree is ten levels deep, it's probably fragile Yes to all this. Interface implementation is not inheritance. Aramoro posted:Composition is superior depending on the design pattern being used, and it being superior in no way makes inheritance bad. They are in fact both good depending what it is you're trying to do. They're also both bad if you implement them badly. I disagree. Anywhere that you think Inheritance is good, it's probably actually really bad. Inheritance is literally the worst way to extend class behavior and no one should ever do it. There are scenarios outside of class extension where it makes sense, but probably not then either. Like, you can inherit from ControllerBase for .Net core MVC, but that's a very specific use case based on the conventions of MVC.
|
# ? Jan 25, 2019 20:10 |
|
|
# ? Sep 9, 2024 15:41 |
|
if you have ever written a subclass, you are a piece of poo poo
|
# ? Jan 25, 2019 20:56 |
|
carry on then posted:if you have ever written a subclass, you are a piece of poo poo class You(Butt)
|
# ? Jan 25, 2019 20:59 |
|
oh boy does using reflection feel dirty
|
# ? Jan 25, 2019 21:31 |
|
Powerful Two-Hander posted:oh boy does using reflection feel dirty yeah it owns
|
# ? Jan 25, 2019 21:38 |
|
Powerful Two-Hander posted:oh boy does using reflection feel dirty yeah
|
# ? Jan 25, 2019 21:51 |
|
Finster Dexter posted:Yes to all this. gently caress you, i'm adding another layer of inheritance to all my class hierarchies to own the .libs
|
# ? Jan 25, 2019 22:12 |
|
Soricidus posted:gently caress you, i'm adding another layer of inheritance to all my class hierarchies to own the .libs
|
# ? Jan 25, 2019 22:16 |
|
inheritance is bad, composition is good, be gay, do crimes, hail satan
|
# ? Jan 25, 2019 22:25 |
|
uncurable mlady posted:inheritance is bad, composition is good, be gay, do crimes, hail satan can i pick & choose?
|
# ? Jan 25, 2019 22:26 |
|
today i looked at two classes that implemented the same interface and did the same thing to two different kinds of data, and observed a large amount of code copy-pasted between them making it difficult to see the actual differences and introducing a bunch of fragility if changes weren't performed in both places. so i moved all the shared code into a new abstract superclass and now there's no repetition and each class does exactly as much as it needs to with minimal boilerplate i'm a monster
|
# ? Jan 25, 2019 22:32 |
|
Soricidus posted:gently caress you, i'm adding another layer of inheritance to all my class hierarchies to own the .libs Terrible programming: Adding layers of inheritance to own the .libs Edit* I have a personal idiom of never EVER going more than 1 layer of inheritance. Usually a base class with several variants stemming from that base class. IE: OCPP base class, then OCPP1.5, 1.6, and 2.0 classes that inherit the base class. I think that's perfectly fine and acceptable.
|
# ? Jan 25, 2019 22:53 |
|
Soricidus posted:today i looked at two classes that implemented the same interface and did the same thing to two different kinds of data, and observed a large amount of code copy-pasted between them making it difficult to see the actual differences and introducing a bunch of fragility if changes weren't performed in both places. so i moved all the shared code into a new abstract superclass and now there's no repetition and each class does exactly as much as it needs to with minimal boilerplate lmao yeah because now when someone needs to update code in the abstract class that adds a feature or fixes a bug for subtype A, there's a high chance they will gently caress up something in subtype B without even realizing it. You better have 100% test coverage or else this code will be turbofucked in no time flat
|
# ? Jan 25, 2019 23:10 |
|
Finster Dexter posted:lmao yeah because now when someone needs to update code in the abstract class that adds a feature or fixes a bug for subtype A, there's a high chance they will gently caress up something in subtype B without even realizing it. now it sounds like you're arguing against code reuse period i mean i'll grant you the world would be a better place if nobody ever reused my code but that's a different story
|
# ? Jan 25, 2019 23:53 |
|
ratbert90 posted:Terrible programming: Adding layers of inheritance to own the .libs you down with OCPP? yeah you know me and you know me and you know me and you know me and you ERROR NOT IMPLEMENTED
|
# ? Jan 26, 2019 00:09 |
|
Finster Dexter posted:You better have 100% test coverage or else this code will be turbofucked in no time flat Why would you not have test coverage for something like that? I mean sure if you're a terrible programmer your usage of inheritance is going to suck, but then so is your composition. Someone breaking subtype B fixing a bug in Subtype A without even testing it is awful and will gently caress up your codebase no matter what you do. Both pale in comparison to reflection in your ability to gently caress things up horribly but it's still got a place. Aramoro fucked around with this message at 00:32 on Jan 26, 2019 |
# ? Jan 26, 2019 00:14 |
|
Aramoro posted:I mean sure if you're a terrible programmer buddy have I got news for you
|
# ? Jan 26, 2019 01:21 |
|
Aramoro posted:Why would you not have test coverage for something like that? I mean sure if you're a terrible programmer your usage of inheritance is going to suck, but then so is your composition. Someone breaking subtype B fixing a bug in Subtype A without even testing it is awful and will gently caress up your codebase no matter what you do. i feel like inheritance is ultimately more destructive. i mean, yeah, i've seem reflection used to horrific ends, but most people are aware of this and avoid it. inheritance is bad because most people think it's a good idea when in fact it's a bad idea. although honestly most up-to-date programmers seem to be getting the message these days.
|
# ? Jan 26, 2019 01:23 |
|
inheritance is not the problem, implied subtyping due to inheritance is the problem
|
# ? Jan 26, 2019 01:24 |
|
DELETE CASCADE posted:inheritance is not the problem, implied subtyping due to inheritance is the problem that's an interesting idea but without implied subtyping is inheritance really worth talking about?
|
# ? Jan 26, 2019 01:28 |
|
there are languages which use structural subtyping instead of nominal, it's just pretty rare
|
# ? Jan 26, 2019 01:29 |
|
DELETE CASCADE posted:inheritance is not the problem, implied subtyping due to inheritance is the problem OK, perhaps I'm a fool, but this a safe space so would you mind explaining the distinction between inheritance and subtyping? I thought they were the same thing.
|
# ? Jan 26, 2019 01:50 |
|
Doom Mathematic posted:OK, perhaps I'm a fool, but this a safe space so would you mind explaining the distinction between inheritance and subtyping? I thought they were the same thing. I think what DELETE CASCADE is on here is that subtyping implies liskov substitution but inheritance does not
|
# ? Jan 26, 2019 01:59 |
|
Aramoro posted:Why would you not have test coverage for something like that? I mean sure if you're a terrible programmer your usage of inheritance is going to suck, but then so is your composition. Someone breaking subtype B fixing a bug in Subtype A without even testing it is awful and will gently caress up your codebase no matter what you do. i don't wanna call anyone out because maybe what i inferred is not what they meant, but in a very general sense, some people seem to think type safety precludes testing, and HOLY poo poo are they wrong
|
# ? Jan 26, 2019 03:17 |
|
DaTroof posted:i don't wanna call anyone out because maybe what i inferred is not what they meant, but in a very general sense, some people seem to think type safety precludes testing, and HOLY poo poo are they wrong "if it compiles it works" ~ literally one of my coworkers
|
# ? Jan 26, 2019 03:21 |
|
at my first job people would tell junior developers that writing unit tests was unnecessary because the only way you can have a bug that the scala typechecker can't handle is if you have side effects, which are bad, so
|
# ? Jan 26, 2019 03:31 |
|
I always felt like some staticlangers tend to trust the type system way too much but that's just ridiculous
|
# ? Jan 26, 2019 03:34 |
|
if you don't wanna write tests, that's fine, sometimes it's not worth it. but jesus don't make up bullshit like that.
|
# ? Jan 26, 2019 03:35 |
|
types dont guard against npe
|
# ? Jan 26, 2019 03:47 |
|
as someone who learns by example are there demo pages or whatever that have demo code and tests for it, with explanation of how the tests were chosen and why the test runs the way it does I understand the purpose of testing and I've done some, but I always draw blanks on what to do when I'm actually in the thick of it.
|
# ? Jan 26, 2019 04:23 |
|
mod saas posted:as someone who learns by example are there demo pages or whatever that have demo code and tests for it, with explanation of how the tests were chosen and why the test runs the way it does jeez, it took me years before i got used to writing test suites. nowadays it's my sop, but i still feel like i learned it by ear one thing i can suggest, look for anything written/presented by sandi metz. a lot of her stuff is specific to ruby, but she knows the poo poo out of oop and tdd
|
# ? Jan 26, 2019 04:37 |
|
uncurable mlady posted:types dont guard against npe why would you write in a language which allows null pointers
|
# ? Jan 26, 2019 04:38 |
|
Oneiros posted:"if it compiles it works" said frequently by the owner of the last company i worked at
|
# ? Jan 26, 2019 04:38 |
|
Beamed posted:why would you write in a language which allows null pointers because languages that don't allow null pointers* don't exist *or an equivalent they don't call "null"
|
# ? Jan 26, 2019 04:41 |
|
https://www.nytimes.com/2019/01/24/technology/computer-science-courses-college.html no you fools its a trap
|
# ? Jan 26, 2019 06:58 |
|
is there a good comparison/overview of the pros/cons of the various nltk tokenizers? their docs are autogenerated and pretty barebones.. https://www.nltk.org/api/nltk.tokenize.html
|
# ? Jan 26, 2019 07:52 |
|
aardvaard posted:javascript, apis, and markup but that type of development has been deprecated since mid-2008, when the App Store was introduced the only worthwhile development is native development and backend development supporting native development
|
# ? Jan 26, 2019 07:59 |
|
uncurable mlady posted:types dont guard against npe Here is a penny, buy yourself a real language.
|
# ? Jan 26, 2019 08:37 |
|
eschaton posted:but that type of development has been deprecated since mid-2008, when the App Store was introduced I might give you poo poo sometimes, but I love this gimmick.
|
# ? Jan 26, 2019 08:38 |
|
|
# ? Sep 9, 2024 15:41 |
|
wtf just wrote this:code:
i guess my mind missed 'def' but my fingers still formatted the line as if i didnt e: also probably says a lot about how my brain processes language Carthag Tuek fucked around with this message at 10:23 on Jan 26, 2019 |
# ? Jan 26, 2019 09:17 |