A feature diagram is a tree. Nodes are called features. Edges are containment relationships. Nodes can be one of four types: AND, OR, XOR, and LEAF.
Look at the Car feature diagram (a) below. The notations for AND,
OR, and XOR nodes are illustrated. AND, OR, and XOR must have 2
or more children nodes. LEAF nodes (obviously) have no children.
- AND: A child is connected to its AND parent using either ANDoptional or ANDmandatory.
Example: Car is an AND node. It has one ANDOptional node (Cruise)
and three ANDMandatory nodes (Engine, Transmission, and CarBody).
An AND node has 2 or more children nodes, any or all of which could be
- OR: Example: Engine is an OR node with 2 children, Gasoline and Electric.
- XOR: Example: Transmission is an XOR node with 2 children, Manual and Automatic.
Remember: Given any parent node (feature), all of its children have OR
connections to it, or XOR connections, or ANDmandatory/ANDoptional connections.
No other combinations of edges is allowed.
Here are three feature diagrams:
- Draw a class diagram metamodel of your program where all three of
the above models conform. In English, explain the constraints that you
think are essential to validate.
- Write a Java program to implement your metamodel so that you can
construct feature diagrams. Your goal is that your code to create
feature diagrams should be as elegant as possible. For each
diagram, define a method construct its tree. Further, your
program must have a method that validates a tree, and that after
constructing each tree, you invoke this validation method.
You must show the correspondence between your
Java program and each of the above feature diagrams. If your program is
ugly, so too will be your class diagram. May I
suggest that you do NOT use methods or constructors that have
set-valued arguments.Remember: clarity is important in this project
(as defined subjectively by the Grader).
is another name for evaluating metamodel constraints. You will be
writing your validation constraints in Java, NOT Prolog.
Hint: all of this should look familiar to you (as it should). I give you the following hints:
- Create a UML class diagram that captures the above relationships.
- Implement this diagram (each UML class corresponds to a Java class, etc.).
once you see the connection between UML class diagrams and actual code,
you may want to revise your class diagram and your code so that they
are in sync. This is important -- you can adjust your class diagram.
will find that there should be a 1:1 correspondence with entering rows
of a table and creating objects. Just as you might expect the
code for inserting rows into a table is clear, so too should be your
code for creating FMs.
What to Submit
critical part of this assignment is for me to see that you see the
connection between our prior work on models and your Java code. "Style"
points will be given (or taken away) depending on how clean your code
A zip file with all source code. The zip file must unzip into <yourName>/<YourFilesAndDirectories>.
will create two Java packages: one will be called FeatureModel, which
contains the code that creates feature models. The other package
will contain 3 programs, one for each of the class diagrams above.
These programs will call methods of FeatureModel to create their
Your class diagram + constraints for your metamodel of feature diagrams.
- A README file that explains what you have done.
critical part of any design is clarity and
understandability. Hence, you will be graded on the clarity
of your project and its ability to work correctly. Sloppy code,
documentation, or anything that makes grading or understanding your
program difficult will cost you points! Beware, some of these
"beauty" points are subjective.
No late assignments/submissions will be accepted.