6

I'm pretty sure most of us are familiar with the concept of a project's requirements changing after it starts, this becomes more and more of an issue the less the client knows about how things work and the closer you work with them.

How then can I design a system (specifically a website but general advice will probably be best here) so that smallish changes can be made, are there any programming strategies that deal with this issue?

7 Answers 7

12

All the normal oo principles apply here, reduce coupling, increase cohesion, don't repeat yourself etc. This will make sure you have a flexible and extendible code base.

Apart from that don't try to preempt change. Apply YAGNI (You aint gonna need it) everywhere. Only build stuff you know your users need. Dont build stuff you think you're going to need. You're more likely to guess wrong and then you've got a bunch of code that's probably only in the way.

3
  • Good point on YAGI, it can be easy to get "too open" to change :)
    – Rob Cooper
    Sep 25, 2008 at 10:39
  • Yep, YAGNI is super important. It's easy to fall into the trap of over-designing things way too early. If your design is good, you can refactor it if you need to.
    – Blorgbeard
    Sep 25, 2008 at 10:47
  • The irony is that people often make their code less extensible by designing for extensibility. That's where YAGNI comes in :-)
    – Mendelt
    Sep 25, 2008 at 11:16
3

I think the biggest thing is to make sure you have a comprehensive test suite. That way you can make changes confidently when needed and know when it breaks.

2
  • others will have more to add. I notice you specialize in php, etc, i am unfamiliar with it so i dont know if there are frameworks for it that help the issue.
    – mattlant
    Sep 25, 2008 at 10:27
  • That's okay, I may specialise in PHP but I also use Python and may learn RoR
    – Teifion
    Sep 25, 2008 at 10:32
3

Having no experience with PHP, take this with a pinch of salt.

But it's all about knowing change will come. So when you are coding and start wanting to hack things to get them done, stop and think "what if I need to change this again?".

Now, I know php is a scripting language, but you must be able to library off code right? Thats the best thing to do, keep the UI (the web page) as LIGHT as possible, for the most part 1 or two method calls.

If you have fancy rendering logic, library it. Create a nice look that may be common? Look at what might change (colour scheme etc.), library it. You're already putting all your core code into libraries though right? ;)

If you always work on building your library, all you need to then do when the change request comes in is "find the right book for it".. Whats cool about what we do is that if the book is well written, you can easily add annotations to it ;)

This is basically what I am doing at work at the moment, my "project" is to build the platform that future apps will be working on, so this is really my main focus. :)

Update

Mendelt made a good point on applying YAGNI, with all of the above, don't just write stuff to library it but if you think for a second that the sexy little table you just created (because a client wanted it) might be used again, then it's time to think about making it more usable. Some obscure function for a one-off client should be done ad-hoc.

2

Well, I'd try to tackle this problem from the other side:

More communication with the customer/user.

I have been there myself, programming things that were not wanted or not properly communicated and having to redo lots of code. It would have been prevented with more communication or rather: with more of the right communication.

Aside from that: Allow Users to change the color and ask them now and then, where to place a button and the probability, they will be satisfied with this "great level of control" is quite good. And then they won't want you to redo real features. Yes, I am sarcastic about this.

1

I suggest using a tried and tested framework for your language of choice. Most good frameworks will have been designed to accommodate a multitude of scenarios.

1

First, you should identify the aspects that will have a high change probability. These aspects should be 'abstracted out'. A classic example is the style of your website (i.e. through css). But you could even so define a 'presenter' class that lays out the specific elements of a web page.

The hard thing is making a correct estimate of the change probability. But that's up to you :)

0

This is where frameworks come into play.

If all the baseline, background, business-as-usual is in the framework, then your application is the extensions, special-cases and add-ons.

The framework is already designed and built for change. Your stuff is the change that the frame was designed to accept.

When change occurs, you will respond to change with some combination of modifying the framework configuration and rewriting your stuff that plugs into the framework. You cope with change by not focusing on the default, background stuff. Delegate that to someone else -- the framework authors.

Not the answer you're looking for? Browse other questions tagged or ask your own question.