Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm about to improve my skills in all that is related to designing applications from scratch using proper OOD principles, involving MVC pattern and using TDD approach to do it.

I have a project for that. I also finished reading a book by Matt Zandstra: PHP Objects, Patterns and Practice

And my question is still left unanswered...

How do I start designing from scratch? Should I start using TDD immediately? It doesn't feels comfortable when u have nothing implemented yet. Should I use code spaghetti just to build working prototype first, understand the scope and needs and only then rewrite all using proper OOD and TDD?

I'd love to get any advice, how to work towards something considered "RIGHT TO DO", or any book that will actually lay down things of how to build the applications form scratch, or design an architecture and dependencies, rather than just throwing lifeless implementation sample codes of Design patterns like Zandstra did.


UPD: Basically, my question is: Is it a good idea to immediately start new project from using TDD and proper OOD, or first write something that works using the most horrible and fastest ways and then refactor everything or rewrite from scratch after you got some idea of how you want your application to look like?

share|improve this question

marked as duplicate by Tamás Szelei, Alex Feinman, GlenH7, gnat, Kilian Foth Aug 2 '13 at 7:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. – gnat Aug 1 '13 at 12:54

There's a course out there where the person giving the course says "when you sit in the front of a code editor, look at the blinking cursor and think now what do I do? the answer always is step away from the code and pick paper and pencil". He says that for a good reason: you can't develop something without understanding first what do you need to develop and how you are going to implement things.

In your question it seems that what you are doing is exactly go straight to the code editor and trying to use OOP without doing first what is called object oriented analysis and design (I've said it seems because I don't really know if you did this process before or not). The idea is that before trying to code something you must know what to code.

So there's a five steps approach that you can follow:

  • Gather the requirements
  • Describe the application
  • Identify the main objects
  • Describe the interactions
  • Create a class diagram

Once you did this, in the end you'll have a good class diagram that will point to you what to develop. Look that this will give you a notion of what the application looks like without having to develop a prototype first in another programing paradigm. Now, when developing each method, I recommend that you use TDD.

So, programming first in another paradigm and then changing later to OOP will be much more painful than starting the right way with OOP. There are good books on object oriented analysis and design out there and there's also this course. Obviously the books and the course are paid but it's worth to purchase this kind of material, since can help a lot in cases like that.

share|improve this answer
Thanks a lot. Could you just give me the name of that course? I can't find it. – Fratyr Aug 1 '13 at 15:28
Sorry, I forgot to tell you. The course is called "Foundations of Programming: Object Oriented Design". See if you can find it now. – user1620696 Aug 1 '13 at 17:40
Yeah, great help. Thank you! – Fratyr Aug 1 '13 at 21:32

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