• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Design suggestions when working with new requirements but old code

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a newbie to design phase and newbie to the existing working application.
Scenario:
Functionally working code in production, MVC, in house framework since last 10 years
Requirement:
Functionally:
Looks and feel of the few pages has to be changed by using new rich java script library. There is some slight functionality change here and there too but major change is about look and feel.
Design:
It should be reusable code and could be extended for next phase change-which definitely is more changes on to other pages and maybe or maybe not changes to framework (can be struts though not sure)

Question:
Ques1: Java classes: Helper, POJO, Retrieval class : Is it better to modify the existing class or have a new class extend the old class?
My pref: Better to have new class- Large methods in existing class and at some stage the methods can be rewritten ,easy to debug
Ques2: If suggested way is new classes should they reside in a different package hierarchy so as to easily differentiate if one has to move to new framework
Ques3: Are there any recommended books/articles which might help me in understanding designing when working with new and old code better







 
Ranch Hand
Posts: 312
MS IE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe, this is a migration scenario.

Please find below, my attempt to answer to your questions.
1. Write a new class extending the old one
2. Maintaining the new classes in a different package will definitely help when full scale migration is started
3. You may need to search the Internet for topics/books on "J2EE application migration"
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

seena mathew wrote:I am a newbie to design phase and newbie to the existing working application.
Scenario:
Functionally working code in production, MVC, in house framework since last 10 years
Requirement:
Functionally:
Looks and feel of the few pages has to be changed by using new rich java script library. There is some slight functionality change here and there too but major change is about look and feel.
Design:
It should be reusable code and could be extended for next phase change-which definitely is more changes on to other pages and maybe or maybe not changes to framework (can be struts though not sure)

Question:
Ques1: Java classes: Helper, POJO, Retrieval class : Is it better to modify the existing class or have a new class extend the old class?
My pref: Better to have new class- Large methods in existing class and at some stage the methods can be rewritten ,easy to debug
Ques2: If suggested way is new classes should they reside in a different package hierarchy so as to easily differentiate if one has to move to new framework
Ques3: Are there any recommended books/articles which might help me in understanding designing when working with new and old code better



"Prefer composition over inheritance" is an old design principle, but I thing it does apply in this case as well. If you need to implement new functionalities in your objects for your javascript library, you could use the GoF Adapter pattern. In Domain Driven Design, a more elaborate approach is called the 'Anti-Corruption Layer'. See e.g. http://www.infoq.com/minibooks/domain-driven-design-quickly.
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic