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
best [ November 29, 2003: Message edited by: damu liu ]
Damu, 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) Dushy
SJCP, SCBCD, SJCD, SCDJWS, SCEA (Part I)
Joined: Feb 26, 2003
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? Best, Damu
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
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? Best, Damu [ December 01, 2003: Message edited by: damu liu ]