« first day (3739 days earlier)      last day (1271 days later) » 

4:49 PM
What is a good guideline for interface usage ? There was a time where i literally created one interface for each of my components... and currently i try to avoid them in component based environments... So either i overuse them, which generates messy code... or i dont use them at all :p
 
from a regular developer pov: use interfaces where you expect to have multiple implementations. Interfaces define a contract that must be adhered to
E.g. my components have an interface that defines methods to check if they're dirty
 
user92578
Personally I've transitioned totally away from interfaces in favor of static polymorphism, but that's more of an experimentation of mine instead of something I'd perhaps recommend
 
and another that forces them to implement a method to clone the component
 
Thanks ! Well i often code my components in a... extendable way using callbacks, events and other techniques ( Was that called SRP ? )... so i dont see that many options to implement those.
 
user92578
I've definitely been liking static polymorphism over inheritance though, allows me to avoid heap memory allocations too, plus it feels to fit in nicely with a more data oriented approach
 
4:56 PM
Thats a technique i have never heard of :D
Sounds like Utility methods ^^ Or extensions
 
user92578
I'm not sure how easy it is to do in other languages as at least I heavily depend on C++'s std::variant to implement it
 
Hmm... i took a quick look at them, they look completly different :o but kinda interessting
 
Correct me if I'm wrong, but another name for it would be 'Method Overloading'
 
user92578
Function overloading can be the implementation part of it, but for common operations it's also possible to use a generic function that can operate on all of the data
 
user92578
I like it because I can have the specific logic implementations for the types inside where the logic is executed from
 

« first day (3739 days earlier)      last day (1271 days later) »