views:

215

answers:

7

Hi,

I'm currently reading Head First's Object Oriented Analysis and Design. The book states that to write great software (i.e. software that is well-designed, well-coded, easy to maintain, reuse, and extend) you need to do three things:

  1. Firstly, make sure the software does everything the customer wants it to do
  2. Once step 1 is completed, apply Object Oriented principles and techniques to eliminate any duplicate code that might have slipped in
  3. Once steps 1 and 2 are complete, then apply design patterns to make sure the software is maintainable and reusable for years to come.

My question is, do you follow these steps, and in this order, when developing great software? If not, what steps do you usually follow inorder to ensure it's well designed, well-coded, easy to maintain, reuse and extend?

+2  A: 

I disagree with #1 because most great software needs several major iterations to become truly great. The only other way to actually achieve #1 (on the first try) is to copy some other already-great software. But to come up with something new and unique (like I did with ClipMate in 1991), you make your best effort, then release it to the world to see what customers have to say about it. Through repeated cycles of re-assessing the product as a result of customer input and interaction, you eventually achieve great software.

Chris Thornton
Doesn't mean that you shouldn't invest the most effort into it. I think the point of the list is that many engineers spend too much time on making their code purty rather than addressing the problem it's written to solve.
DeadMG
Wait, you're saying the *only* way to get software to do what the customer needs it to do is to copy some other piece of great software? Logically, this would suggest that great software has *never* existed (and I'm not saying you're wrong there), since great software can't be created without copying already-great software.
MusiGenesis
@DeadMG, certainly, I agree. My point is to not put too much stock in what the customers want, or rather, think they want.
Chris Thornton
@MusicGenesis - No, you mis-interpreted, and I was unclear. I will edit. What I meant was "on the first try". i.e. without an iterative approach, you're not going to meet the customer's needs on the first try unless you copy somethign else, or have a very simle problem to solve, or you're exceedingly lucky.
Chris Thornton
+1 Thanks for your reply DeadMG. Although Head First did not explicitly mention models like Waterfall or Spiral, they did say the app should satisfy all of the customer wants (by getting good requirements and analysis) before moving onto steps 2 and 3. But what struck me is that according to them, the app should be fully functional in step 1 before trying to improve it with steps 2 and 3. Although the book is aimed at beginners like myself, and its very helpful so far, I couldn't help but feel there is a more efficient way to write this code. Or is that for more experienced programmers?
01010011
@Chris You had better put some stock in it. If they want an FX trading system and you provide them with a cool Windows utility instead, they are liable to cut up rough.
anon
@Neil, agreed. But my point is that the users say they want things and they don't really understand. What if the stock traders wanted options to automatically sell at certain levels, and if the stock goes lower, sell more, but faster? And if the trading is halted, start selling on another market? OTOH, programmers in a vacuum without user input would be even worse. That's why I'm proposing that it takes many iterations to achieve truly great sofware.
Chris Thornton
Ultimately, you need a healthy balance of 1, 2, and 3 to get anywhere, and using any one of them too much will result in a failed project.
DeadMG
@DeadMG Great point, thanks
01010011
+8  A: 

Object orientation is not something you bolt on as an afterthought - you start with OO analysis and design and proceed to an OO implementation. I suspect you may have misread or misinterpreted the book. Similarly with design patterns - they are not add-ons.

anon
+1 Always start from a solid theoretical base - this _always_ produces the best concrete results.
Andrew Hare
That's what I thought. I've never read the Head Start book, but I can't believe they advocate throwing whatever out there, *then* making it object-oriented, and *then* making the OOP stuff conform to design patterns.
MusiGenesis
+1 Thanks for the reply Neil. I should have mentioned that I just started reading chapter 1 and that this is my first time reading any of Head First books. However, after rereading the 3 steps mentioned above, I could not help but post this question because, I could not imagine writing a program that meets all of a customers requirements first, after which I would alter the code to improve it by including appropriate design patterns afterwards! Now to be fair, as I've said, I'm only on chapter 1, and the book is aimed at beginners, so I suspect later on in the book they may revise these steps.
01010011
+1  A: 

I'd normally start with an object-orientated design. It would have to be a pretty quick dirty/hack not to need #2 and #3. The trouble is, not to overdose on them.

DeadMG
+1 From what I've read so far, the book's focus is OOD. HOwever I guess as beginners they expect us to produce duplicate code here and there, thats where stage 2 comes in I guess.
01010011
+1  A: 

If I'm interpreting it correctly, it sounds a little ridgid. But perhaps the intent is correct - 1) can be paraphrased as "stay focused", in particular focusing on the business needs. That doesn't mean ignore all coding needs, but getting the balance right. There are many code changes and refactorings that no doubt improve the quality of the code, but these have to be weighted up against the time taken, risks, and delays caused to the project. As a developer, it's all too easy to (over)priorize code changes above business needs.

Applying OO principles later sounds impractical - if you haven't used OO principles, how was the software that does what the customer wants built in the first place? Perhaps it's hinting to continual refactoring, KISS, and reducing up-front design in favor of an iterative development cycle.

There is an element of truth in 3) - recognising patterns after the software is built and refactoring to isolate common repeated elements, but I think of this as a natrual consequence of an iterative development cycle.

mdma
+1 Yes, they definitely meant to focus on what the customer wants first and foremost and deliver on everything he/she wants, otherwise the software would not be "great". But I must admit, leaving the design pattern for step 3 worried me, but to be fair I'm only on chapter 1 and I suspect improvements will be made to this list for the readers benefit as the reader proceeds through to chapter 10.
01010011
+1  A: 

First and foremost great software must do everything the customer needs it to do and at least most of what the customer wants it to do. These are not the same thing. Also it is better to start off with something small and simple, and evolve it rather than trying to build everything in one ginormous app.

As for the other two points, they seem a bit confused. Avoiding duplication is a design principle, but only one of many. Why single it out for special consideration? Rather than (say) Programming to interfaces? Or Tell don't ask? Or Avoid broken windows?

Hmmmm...

When I started typing this response I intended to say I don't think you can retrofit OO techniques or design patterns. But having thought about it some more it has occured to me that this is not the case. It is quite common in TDD practice for the initial implementation - the simplest thing which gets the code to pass the test - to be quite procedural. But once the code passes its tests there is a cycle of refactoring which applies design patterns and produces a more objected-oriented implementation.

APC
Why would an OO solution not be the simplest thing?
anon
+1 Thanks for the helpful reply APC. The book is aimed at beginners to OOAD but I suspect later on they would revise this as a learning experience for the reader, but I can't know for sure until I finish it
01010011
+1  A: 

Great Software is based on good design and clean programmation with approving design pattern ( MVC, process component..).

Amirouche Douda
+1  A: 

I've read this book. I think there is some mis interpretation everywhere.

  1. Firstly, make sure the software does everything the customer wants it to do

    The book is saying to make sure you understand the customer requirements before starting a design.

  2. Once step 1 is completed, apply Object Oriented principles and techniques to eliminate any duplicate code that might have slipped in

    The book says to design with O-O principles

  3. Once steps 1 and 2 are complete, then apply design patterns to make sure the software is maintainable and reusable for years to come.

    Use design pattern.

jrm82
+1 Thanks very much for your reply jrm82. Your step one above makes more sense to me, but in chapter 1 page 14, the book says "Once your software works, you can look for any duplicate code that might have slipped in, and make sure you're using good OO programming techniques". I assumed when they said "software works" they meant that literally, meaning, compiled and running. Secondly, shouldn't step 3 come before 2? I mean should you do the OO within the pattern?
01010011