File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes how to maintain a application? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "how to maintain a application?" Watch "how to maintain a application?" New topic

how to maintain a application?

Bigwood Liu
Ranch Hand

Joined: Feb 26, 2003
Posts: 240
Hi, friends,
How to maintain a application? By changing it, or by extending it.
For example, how to change a controllor in mvc, extend a former one or change the former one?
If change the former one, I can set most of the methods private, If extend it I have to leave them protected

[ November 29, 2003: Message edited by: damu liu ]
Dushy Inguva
Ranch Hand

Joined: Jun 24, 2003
Posts: 264
I don't mean to be sarcastic, but the direct answer to this question would be like finding The Silver Bullet.
The degree of extensibility or changeability of an application/module is directly proportional to the quality of design.
Without going into OOD and Software engineering concepts for answer, I'll try to put it short. Even before you are designing a module (class/interface/a functional module), often you have to decide how much change you would allow in the module you are writing.
In my opinion, the behaviour of a module can be divided into
1. Private behaviour (definite candidate for private members)
2. Customizable behaviour (protected et al)
Unfortunately, I endup giving pretty convoluted answers all the time. Lemme know if you need clarification/resources for this (if this made sense @ all)

Bigwood Liu
Ranch Hand

Joined: Feb 26, 2003
Posts: 240
Thank you, Dushy
I want to know if you want to add some new function to the GUI, what will you do, change it or extend it?
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11778

Hi Damu,
My answer: yes.
Whether to modify or extend any class is dependant on a number of things. Some of them might be:
  • Will modifying it break any existing classes that use it?
  • Are there any classes that might want only the old functionality?
  • Will modifying it change it's "one responsibility"?
  • Do I have complete ownership of the class to modify it?
  • Will there be any benefit in having original code in one class, and my code in a separate class?

  • That is all just from the top of my head. There are no doubt other things that you might want to consider. But that gives you some ideas of the things I would consider before I could decide whether to modify or subclass code.
    Is this related to your SCJD assignment?
    Regards, Andrew

    The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
    Bigwood Liu
    Ranch Hand

    Joined: Feb 26, 2003
    Posts: 240
    Thank you Andrew,
    My answer: yes.
    I am wondering what access limit should the m-v-c members have. If there are some new functions would be added to GUI, we have to consider this question. Extends it or cahnges it. If extends it, we have to give the members more loose access limit thus the subclass can access it, or if change it, we can give the members more strict access limit.
    If the answer is yes , we have to value it carefully. How do you think?
    [ December 01, 2003: Message edited by: damu liu ]
    I agree. Here's the link:
    subject: how to maintain a application?
    It's not a secret anymore!