Search Results

Search found 2 results on 1 pages for 'flot2011'.

Page 1/1 | 1 

  • Inheritance vs containment while extending a large legacy project

    - by Flot2011
    I have got a legacy Java project with a lot of code. The code uses MVC pattern and is well structured and well written. It also has a lot of unit tests and it is still actively maintained (bug fixing, minor features adding). Therefore I want to preserve the original structure and code style as much as possible. The new feature I am going to add is a conceptual one, so I have to make my changes all over the code. In order to minimize changes I decided not to extend existing classes but to use containment: class ExistingClass { // .... existing code // my code adding new functionality private ExistingClassExtension extension = new ExistingClassExtension(); public ExistingClassExtension getExtension() {return extension;} } ... // somewhere in code ExistingClass instance = new ExistingClass(); ... // when I need a new functionality instance.getExtension().newMethod1(); All functionality that I am adding is inside a new ExistingClassExtension class. Actually I am adding only these 2 lines to each class that needs to be extended. By doing so I also do not need to instantiate new, extended classes all over the code and I may use existing tests to make sure there is no regression. However my colleagues argue that in this situation doing so isn't a proper OOP approach, and I need to inherit from ExistingClass in order to add a new functionality. What do you think? I am aware of numerous inheritance/containment questions here, but I think my question is different.

    Read the article

  • How do you balance between "do it right" and "do it ASAP" in your daily work?

    - by Flot2011
    I find myself pondering this question times and times again. I want to do things the right way, to write a clean, understandable, correct code that is easy to maintain, but what I really do pretty often is writing a patch upon patch just because there is no time, clients are waiting, a bug should be fixed overnight, the company is losing money on this problem, a manager is pressing hard etc. etc. I know perfectly well that in a long shot I am wasting much more time on these patches, but as this time is spread over months of work, nobody cares. Also, as one of my managers used to say, we don't know if there will be this long shot if we will not fix it now. I am sure I am not the only one entrapped in this endless real/ideal choices. So how you, fellow programmers, are coping with this?

    Read the article

1