| View previous topic :: View next topic |
| Author |
Message |
Peter Pitt Enthusiastic Coder
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
Hi everyone, I'm having a bit of a design problem and want a bit of advice. A have a class called Product. On that class I have three functions, getById, getByName and getByDate. As the project goes developers keep adding functionality to the class, getByDateAndId() ... etc
Soon the class has loads of functions in it and it's unmaintainable
So what can I do to stop that happening?
Reply with quote
|
| |
|
|
plantino Enthusiastic Coder
Joined: 13 May 2006 Posts: 96
| |
Klimapol Enthusiastic Coder
Joined: 27 May 2006 Posts: 134
| |
Peter Pitt Enthusiastic Coder
Joined: 20 May 2006 Posts: 114 Location: Egypt
| |
Klimapol Enthusiastic Coder
Joined: 27 May 2006 Posts: 134
| |
Peter Pitt Enthusiastic Coder
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
Klimapol, does't matter, I've just realised I'm not that stupid
indeed
Klimapol, they do do that but it would stop a developer adding a new function, thus the classes getting bloated
S/would/wouldn't/
plantino, so basically add a wrapper class which gets bloated but doesn't mess up my original class
Reply with quote
|
| |
|
|
plantino Enthusiastic Coder
Joined: 13 May 2006 Posts: 96
| |
Peter Pitt Enthusiastic Coder
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
what I really want is for new functionality not to make my class unmaintanable
Reply with quote
|
| |
|
|
plantino Enthusiastic Coder
Joined: 13 May 2006 Posts: 96
|
Peter Pitt, unmaintainable ? could you provide more info ?
you can extract interface or use facade ...
Reply with quote
|
| |
|
|
Peter Pitt Enthusiastic Coder
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
Well when I implement Product it'll be clean and short (maintainable). As time goes by my boss is going to as for, say a list of Products order by Date which are red, so the developer that's doing that will create get(colour, 'date')
So that's another function
I'm worried about lots of functions appearing in my class and it becoming 1 million lines long
Thus, unmaintanable
Or am I worrying about nothing?
Reply with quote
|
| |
|
|
| Page 1 of 2 |
Goto page 1, 2 Next |
|