Tutorials

OO PHP Part 3: UML, Classes and Relations

by John Kleijn on Jun 21, 2008 7:09:14 AM

1. Introduction

1.1 What are class diagrams?

Class diagrams are representations of entities and their relations. These entities most commonly represent a class or interface like they exist in your code, but can also refer to an entity in a more abstract sense, even a type of data.

These are all static entities. A class diagram doesn’t reflect the state an entity is in. A class diagram featuring object instances is commonly referred to as an Object Diagram.

1.2 Class Diagrams: OOA versus OOD

At this stage, I don’t want to get too much into the details of either Object Orientated Analysis or Object Orientated Design, but, I will give a brief insight into how these concepts relate to Class Diagrams.

Three perspectives have been defined to look at Class Diagrams:

  1. Conceptual Perspective
  2. Specification Perspective
  3. Implementation perspective

The conceptual perspective is used to gain insight into the needed functions and properties in a system. These are not necessarily the actual properties of the eventual system. The entities in the diagrams are conceptual; they may or may not represent the eventual entities in the system. This perspective is used for analysis (OOA), and is commonly the next step after a basic Requirement Analysis.

The (rarely used) specification perspective presents a solution, a design (OOD), but doesn’t yet commit to a specific language implementation.

The implementation perspective gets into the nitty gritty details of the design, accounting for language specifics. This design can eventually be translated into a code skeleton (many UML editors offer a code generation feature).

In practice you may find diagrams that have properties of more than one perspective.

Comments

For starters, I absolute love these tutorials. They go beyond just OO syntax to best practices and application design.
On a different note, you mentioned you would provide a list of free UML editor, but I haven't found this list.

1. judahtanthony on Jun 27, 2008 1:23:04 PM

Thanks. I forgot about that. Will rectify, later.

2. John Kleijn on Jun 28, 2008 11:50:41 AM

This is nice work. As a newcomer to PHP, this is easy for me to assimilate. Thanks.

3. loydster on Jun 30, 2008 2:04:53 PM

I'm glad you guys like it. I will be doing one more about Design Patterns before taking a break to work on a different project, after launch of that I will continue with part 5+ :)

4. John Kleijn on Jun 30, 2008 3:57:32 PM

Very well explained. Hope u'll write on the Observer pattern. How can we use that kind of pattern in php ?

5. abouchoud on Aug 21, 2008 8:56:38 AM
Login or register to post a comment.