I'm currently reading up on OO before I embark upon my next major project. To give you some quick background, I'm a PHP developer, working on web applications.
One area that particularly interests me is the User Interface; specifically how to build this and connect it to my OO "model".
I've been doing some reading on this area. One of my favourites is this:
Building user interfaces for object-oriented systems
"All objects must provide their own UI"
Thinking about my problem, I can see this working well. I build my "user" object to represent someone who has logged into my website, for example. One of my methods is then "display_yourself" or similar. I can use this throughout my code. Perhaps to start with this will just be their name. Later, if I need to adjust to show their name+small avatar, I can just update this one method and hey-presto, my app is updated. Or if I need to make their name a link to their profile, hey-presto I can update again easily from one place.
In terms of an OO system; I think this approach works well. Looking on other StackOverflow threads, I found this under "Separation of Concerns":
Soc
"In computer science, separation of
concerns (SoC) is the process of
breaking a computer program into
distinct features that overlap in
functionality as little as possible. A
concern is any piece of interest or
focus in a program. Typically,
concerns are synonymous with features
or behaviors. Progress towards SoC is
traditionally achieved through
modularity and encapsulation, with the
help of information hiding."
To my mind I have achieved this. My user object hides all it's information. I don't have any places in my code where I say $user->get_user_name() before I display it.
However, this seems to go against what other people seem to think of as "best practice".
To quote the "selected" (green one) answer from the same question:
"The separation of concerns is keeping
the code for each of these concerns
separate. Changing the interface
should not require changing the
business logic code, and vice versa.
Model-View-Controller (MVC) design
pattern is an excellent example of
separating these concerns for better
software maintainability."
Why does this make for better software maintainability? Surely with MVC, my View has to know an awful lot about the Model? Read the JavaWorld article for a detailed discussion on this point:
Building user interfaces for object-oriented systems
Anyway... getting to the actual point, finally!
1. Can anyone recommend any books that discuss this in detail? I don't want an MVC book; I'm not sold on MVC. I want a book that discusses OO / UI, the potential issues, potential solutuions etc.. (maybe including MVC)
Arthur Riel's Object-Oriented Design Heuristics
touches on it (and is an excellent book as well!), but I want something that goes into more detail.
2. Can anyone put forward an argument that is as well-explained as Allen Holub's JavaWorld article that explains why MVC is a good idea?
Many thanks for anyone who can help me reach a conclusion on this.
See Question&Answers more detail:
os