To Integrate or not to Integrate
-
We are working on a project to simulate soccer players. The template provided dictated that the main class instantiates the brain of a player (we also pass parameters to the main class). In order to make our players as diverse as possible we developed two approaches in parallel. The first being an XML state machine (done by yours truly) and a Bayesian decision network done by "x". The time came where we had to integrate both logics in our team. "x" wanted to rewrite the brain class to incorporate both logics but I was against that because they are totally different! and bashed him for his OOD skills So he asked me then HTF Mr. genius will you do it? (think about it or skip to answer below) So I told him the requirement dictated that the brain be instantiated from the main class right? yes, But there was no constraint on how many brains we use correct? yes, therefore, we simply keep both logics and pass in a parameter to the main class that switch instantiates whichever logic we specify! Simple eh, yup :)
-
We are working on a project to simulate soccer players. The template provided dictated that the main class instantiates the brain of a player (we also pass parameters to the main class). In order to make our players as diverse as possible we developed two approaches in parallel. The first being an XML state machine (done by yours truly) and a Bayesian decision network done by "x". The time came where we had to integrate both logics in our team. "x" wanted to rewrite the brain class to incorporate both logics but I was against that because they are totally different! and bashed him for his OOD skills So he asked me then HTF Mr. genius will you do it? (think about it or skip to answer below) So I told him the requirement dictated that the brain be instantiated from the main class right? yes, But there was no constraint on how many brains we use correct? yes, therefore, we simply keep both logics and pass in a parameter to the main class that switch instantiates whichever logic we specify! Simple eh, yup :)
So, you've used a bad design practice to justify a dodgy decision. A better approach would have been to use an interface to define the contract the brain follows, and then use something like Dependency Injection to pick an appropriate implementation. In my experience, most football players don't show evidence of using one brain, let alone two.
I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be
Forgive your enemies - it messes with their heads
-
We are working on a project to simulate soccer players. The template provided dictated that the main class instantiates the brain of a player (we also pass parameters to the main class). In order to make our players as diverse as possible we developed two approaches in parallel. The first being an XML state machine (done by yours truly) and a Bayesian decision network done by "x". The time came where we had to integrate both logics in our team. "x" wanted to rewrite the brain class to incorporate both logics but I was against that because they are totally different! and bashed him for his OOD skills So he asked me then HTF Mr. genius will you do it? (think about it or skip to answer below) So I told him the requirement dictated that the brain be instantiated from the main class right? yes, But there was no constraint on how many brains we use correct? yes, therefore, we simply keep both logics and pass in a parameter to the main class that switch instantiates whichever logic we specify! Simple eh, yup :)
Sounds like a disconnect between the left and right brain. ;) Marc
-
We are working on a project to simulate soccer players. The template provided dictated that the main class instantiates the brain of a player (we also pass parameters to the main class). In order to make our players as diverse as possible we developed two approaches in parallel. The first being an XML state machine (done by yours truly) and a Bayesian decision network done by "x". The time came where we had to integrate both logics in our team. "x" wanted to rewrite the brain class to incorporate both logics but I was against that because they are totally different! and bashed him for his OOD skills So he asked me then HTF Mr. genius will you do it? (think about it or skip to answer below) So I told him the requirement dictated that the brain be instantiated from the main class right? yes, But there was no constraint on how many brains we use correct? yes, therefore, we simply keep both logics and pass in a parameter to the main class that switch instantiates whichever logic we specify! Simple eh, yup :)
Scrap the whole thing, and re-architect. Footballers with brains, indeed. You might as well design a motorbike sim with open hearth, chimney, and roof classes.
I wanna be a eunuchs developer! Pass me a bread knife!