▲ 771 ▼ Senior devs... (thelemmy.club) submitted 7 months ago by cm0002@suppo.fi to c/programmer_humor@programming.dev 88 comments fedilink hide all child comments
[–] RedFrank24@piefed.social 18 points 7 months ago (11 children) Always favor composition over inheritance if you can. permalink fedilink source hideshow 11 child comments replies: [–] logi@lemmy.world 8 points 7 months ago (3 children) All absolute statements are false. permalink fedilink source parent hideshow 3 child comments replies: [–] RedFrank24@piefed.social 4 points 7 months ago (2 children) all of them? permalink fedilink source parent hideshow 2 child comments replies: [–] Buddahriffic@lemmy.world 4 points 7 months ago Yes. They just introduced a paradox to our logic, therefore everything is true. But also no, because that contradiction also implies everything is false. permalink fedilink source parent [–] logi@lemmy.world 3 points 7 months ago Seems perfectly cromulent to me! permalink fedilink source parent [–] aaaaaaaaargh@feddit.org 0 points 7 months ago (6 children) Works in frontend I guess but backend is a whole different story. permalink fedilink source parent hideshow 6 child comments replies: [–] RedFrank24@piefed.social 3 points 7 months ago (5 children) I'm not sure what you mean? Doing composition over inheritance is considered good practice across the board, regardless of whether it's frontend or backend. permalink fedilink source parent hideshow 5 child comments replies: [–] aaaaaaaaargh@feddit.org 1 point 7 months ago (4 children) True but due to the framework in use it's more or less applicable and I can't think of a single commonly used backend stack that's relying on composition whereas I know a bunch of frontend stacks. I guess composition is handy for widget trees so that's why you see it more often in frontend apps. permalink fedilink source parent hideshow 4 child comments replies: [–] RedFrank24@piefed.social 2 points 7 months ago (3 children) If you've used Dependency Injection before, you've used the principle of composition over inheritance. So, if you've ever used .Net (C#), Spring Boot (Java) or Laravel (PHP), you've likely used it. Modern C++ also has the DI pattern. Rust and Go force you to use composition and don't support inheritance at all, so if you've used either of those languages, you've followed the practice, though Go doesn't support DI out of the box. Functional languages like Haskell also use composition over inheritance. permalink fedilink source parent hideshow 3 child comments replies: [–] aaaaaaaaargh@feddit.org 2 points 7 months ago (2 children) I think you're confusing composition with aggregation. DI can't be composition because the injected object is shared/borrowed, strong composition on the other hand requires the object to be owned. A composed child does not exist without its parent. permalink fedilink source parent hideshow 2 child comments replies: [–] RedFrank24@piefed.social 1 point 7 months ago* (1 child) Only if you're going by the strict UML definition of composition, which doesn't really apply here, since the industry has moved on a bit since UML was king. Either way, you can use DI to do composition in the strictest UML way, provided every single dependency is transient and creates a new instance every single time. Even then though, when most devs talk about composition, they aren't referring to the strict UML definition. permalink fedilink source parent hideshow 1 child comment replies: [–] aaaaaaaaargh@feddit.org 1 point 7 months ago Yeah but I was talking about the opposite. I can clearly spot composition in many frontend framework such as react or flutter but e.g. spring DI is a different thing to me. permalink fedilink source parent
[–] logi@lemmy.world 8 points 7 months ago (3 children) All absolute statements are false. permalink fedilink source parent hideshow 3 child comments replies: [–] RedFrank24@piefed.social 4 points 7 months ago (2 children) all of them? permalink fedilink source parent hideshow 2 child comments replies: [–] Buddahriffic@lemmy.world 4 points 7 months ago Yes. They just introduced a paradox to our logic, therefore everything is true. But also no, because that contradiction also implies everything is false. permalink fedilink source parent [–] logi@lemmy.world 3 points 7 months ago Seems perfectly cromulent to me! permalink fedilink source parent
[–] RedFrank24@piefed.social 4 points 7 months ago (2 children) all of them? permalink fedilink source parent hideshow 2 child comments replies: [–] Buddahriffic@lemmy.world 4 points 7 months ago Yes. They just introduced a paradox to our logic, therefore everything is true. But also no, because that contradiction also implies everything is false. permalink fedilink source parent [–] logi@lemmy.world 3 points 7 months ago Seems perfectly cromulent to me! permalink fedilink source parent
[–] Buddahriffic@lemmy.world 4 points 7 months ago Yes. They just introduced a paradox to our logic, therefore everything is true. But also no, because that contradiction also implies everything is false. permalink fedilink source parent
[–] logi@lemmy.world 3 points 7 months ago Seems perfectly cromulent to me! permalink fedilink source parent
[–] aaaaaaaaargh@feddit.org 0 points 7 months ago (6 children) Works in frontend I guess but backend is a whole different story. permalink fedilink source parent hideshow 6 child comments replies: [–] RedFrank24@piefed.social 3 points 7 months ago (5 children) I'm not sure what you mean? Doing composition over inheritance is considered good practice across the board, regardless of whether it's frontend or backend. permalink fedilink source parent hideshow 5 child comments replies: [–] aaaaaaaaargh@feddit.org 1 point 7 months ago (4 children) True but due to the framework in use it's more or less applicable and I can't think of a single commonly used backend stack that's relying on composition whereas I know a bunch of frontend stacks. I guess composition is handy for widget trees so that's why you see it more often in frontend apps. permalink fedilink source parent hideshow 4 child comments replies: [–] RedFrank24@piefed.social 2 points 7 months ago (3 children) If you've used Dependency Injection before, you've used the principle of composition over inheritance. So, if you've ever used .Net (C#), Spring Boot (Java) or Laravel (PHP), you've likely used it. Modern C++ also has the DI pattern. Rust and Go force you to use composition and don't support inheritance at all, so if you've used either of those languages, you've followed the practice, though Go doesn't support DI out of the box. Functional languages like Haskell also use composition over inheritance. permalink fedilink source parent hideshow 3 child comments replies: [–] aaaaaaaaargh@feddit.org 2 points 7 months ago (2 children) I think you're confusing composition with aggregation. DI can't be composition because the injected object is shared/borrowed, strong composition on the other hand requires the object to be owned. A composed child does not exist without its parent. permalink fedilink source parent hideshow 2 child comments replies: [–] RedFrank24@piefed.social 1 point 7 months ago* (1 child) Only if you're going by the strict UML definition of composition, which doesn't really apply here, since the industry has moved on a bit since UML was king. Either way, you can use DI to do composition in the strictest UML way, provided every single dependency is transient and creates a new instance every single time. Even then though, when most devs talk about composition, they aren't referring to the strict UML definition. permalink fedilink source parent hideshow 1 child comment replies: [–] aaaaaaaaargh@feddit.org 1 point 7 months ago Yeah but I was talking about the opposite. I can clearly spot composition in many frontend framework such as react or flutter but e.g. spring DI is a different thing to me. permalink fedilink source parent
[–] RedFrank24@piefed.social 3 points 7 months ago (5 children) I'm not sure what you mean? Doing composition over inheritance is considered good practice across the board, regardless of whether it's frontend or backend. permalink fedilink source parent hideshow 5 child comments replies: [–] aaaaaaaaargh@feddit.org 1 point 7 months ago (4 children) True but due to the framework in use it's more or less applicable and I can't think of a single commonly used backend stack that's relying on composition whereas I know a bunch of frontend stacks. I guess composition is handy for widget trees so that's why you see it more often in frontend apps. permalink fedilink source parent hideshow 4 child comments replies: [–] RedFrank24@piefed.social 2 points 7 months ago (3 children) If you've used Dependency Injection before, you've used the principle of composition over inheritance. So, if you've ever used .Net (C#), Spring Boot (Java) or Laravel (PHP), you've likely used it. Modern C++ also has the DI pattern. Rust and Go force you to use composition and don't support inheritance at all, so if you've used either of those languages, you've followed the practice, though Go doesn't support DI out of the box. Functional languages like Haskell also use composition over inheritance. permalink fedilink source parent hideshow 3 child comments replies: [–] aaaaaaaaargh@feddit.org 2 points 7 months ago (2 children) I think you're confusing composition with aggregation. DI can't be composition because the injected object is shared/borrowed, strong composition on the other hand requires the object to be owned. A composed child does not exist without its parent. permalink fedilink source parent hideshow 2 child comments replies: [–] RedFrank24@piefed.social 1 point 7 months ago* (1 child) Only if you're going by the strict UML definition of composition, which doesn't really apply here, since the industry has moved on a bit since UML was king. Either way, you can use DI to do composition in the strictest UML way, provided every single dependency is transient and creates a new instance every single time. Even then though, when most devs talk about composition, they aren't referring to the strict UML definition. permalink fedilink source parent hideshow 1 child comment replies: [–] aaaaaaaaargh@feddit.org 1 point 7 months ago Yeah but I was talking about the opposite. I can clearly spot composition in many frontend framework such as react or flutter but e.g. spring DI is a different thing to me. permalink fedilink source parent
[–] aaaaaaaaargh@feddit.org 1 point 7 months ago (4 children) True but due to the framework in use it's more or less applicable and I can't think of a single commonly used backend stack that's relying on composition whereas I know a bunch of frontend stacks. I guess composition is handy for widget trees so that's why you see it more often in frontend apps. permalink fedilink source parent hideshow 4 child comments replies: [–] RedFrank24@piefed.social 2 points 7 months ago (3 children) If you've used Dependency Injection before, you've used the principle of composition over inheritance. So, if you've ever used .Net (C#), Spring Boot (Java) or Laravel (PHP), you've likely used it. Modern C++ also has the DI pattern. Rust and Go force you to use composition and don't support inheritance at all, so if you've used either of those languages, you've followed the practice, though Go doesn't support DI out of the box. Functional languages like Haskell also use composition over inheritance. permalink fedilink source parent hideshow 3 child comments replies: [–] aaaaaaaaargh@feddit.org 2 points 7 months ago (2 children) I think you're confusing composition with aggregation. DI can't be composition because the injected object is shared/borrowed, strong composition on the other hand requires the object to be owned. A composed child does not exist without its parent. permalink fedilink source parent hideshow 2 child comments replies: [–] RedFrank24@piefed.social 1 point 7 months ago* (1 child) Only if you're going by the strict UML definition of composition, which doesn't really apply here, since the industry has moved on a bit since UML was king. Either way, you can use DI to do composition in the strictest UML way, provided every single dependency is transient and creates a new instance every single time. Even then though, when most devs talk about composition, they aren't referring to the strict UML definition. permalink fedilink source parent hideshow 1 child comment replies: [–] aaaaaaaaargh@feddit.org 1 point 7 months ago Yeah but I was talking about the opposite. I can clearly spot composition in many frontend framework such as react or flutter but e.g. spring DI is a different thing to me. permalink fedilink source parent
[–] RedFrank24@piefed.social 2 points 7 months ago (3 children) If you've used Dependency Injection before, you've used the principle of composition over inheritance. So, if you've ever used .Net (C#), Spring Boot (Java) or Laravel (PHP), you've likely used it. Modern C++ also has the DI pattern. Rust and Go force you to use composition and don't support inheritance at all, so if you've used either of those languages, you've followed the practice, though Go doesn't support DI out of the box. Functional languages like Haskell also use composition over inheritance. permalink fedilink source parent hideshow 3 child comments replies: [–] aaaaaaaaargh@feddit.org 2 points 7 months ago (2 children) I think you're confusing composition with aggregation. DI can't be composition because the injected object is shared/borrowed, strong composition on the other hand requires the object to be owned. A composed child does not exist without its parent. permalink fedilink source parent hideshow 2 child comments replies: [–] RedFrank24@piefed.social 1 point 7 months ago* (1 child) Only if you're going by the strict UML definition of composition, which doesn't really apply here, since the industry has moved on a bit since UML was king. Either way, you can use DI to do composition in the strictest UML way, provided every single dependency is transient and creates a new instance every single time. Even then though, when most devs talk about composition, they aren't referring to the strict UML definition. permalink fedilink source parent hideshow 1 child comment replies: [–] aaaaaaaaargh@feddit.org 1 point 7 months ago Yeah but I was talking about the opposite. I can clearly spot composition in many frontend framework such as react or flutter but e.g. spring DI is a different thing to me. permalink fedilink source parent
[–] aaaaaaaaargh@feddit.org 2 points 7 months ago (2 children) I think you're confusing composition with aggregation. DI can't be composition because the injected object is shared/borrowed, strong composition on the other hand requires the object to be owned. A composed child does not exist without its parent. permalink fedilink source parent hideshow 2 child comments replies: [–] RedFrank24@piefed.social 1 point 7 months ago* (1 child) Only if you're going by the strict UML definition of composition, which doesn't really apply here, since the industry has moved on a bit since UML was king. Either way, you can use DI to do composition in the strictest UML way, provided every single dependency is transient and creates a new instance every single time. Even then though, when most devs talk about composition, they aren't referring to the strict UML definition. permalink fedilink source parent hideshow 1 child comment replies: [–] aaaaaaaaargh@feddit.org 1 point 7 months ago Yeah but I was talking about the opposite. I can clearly spot composition in many frontend framework such as react or flutter but e.g. spring DI is a different thing to me. permalink fedilink source parent
[–] RedFrank24@piefed.social 1 point 7 months ago* (1 child) Only if you're going by the strict UML definition of composition, which doesn't really apply here, since the industry has moved on a bit since UML was king. Either way, you can use DI to do composition in the strictest UML way, provided every single dependency is transient and creates a new instance every single time. Even then though, when most devs talk about composition, they aren't referring to the strict UML definition. permalink fedilink source parent hideshow 1 child comment replies: [–] aaaaaaaaargh@feddit.org 1 point 7 months ago Yeah but I was talking about the opposite. I can clearly spot composition in many frontend framework such as react or flutter but e.g. spring DI is a different thing to me. permalink fedilink source parent
[–] aaaaaaaaargh@feddit.org 1 point 7 months ago Yeah but I was talking about the opposite. I can clearly spot composition in many frontend framework such as react or flutter but e.g. spring DI is a different thing to me. permalink fedilink source parent