P4: Feature Diagrams
Due: Monday, October 7th, 12noon
A Feature Diagram is a tree. Nodes are called features. Edges are relationships. An edge from a parent feature to its children features can be one of four types: ANDmandatory, ANDoptional, OR, and XOR.
- ANDmandatory and ANDoptional: A child is connected to its AND parent using either ANDoptional or ANDmandatory. Example: The GraphLibrary (below) has 4 child features: EdgeType, Search, Weighted, and Algorithm. GraphLibrary is an AND parent. Edgetype and Algorithm are ANDmandatory (indicated by the solid circle); Search and Weighted are ANDoptional (indicated by the open circle).
- OR: 1 or more of the children of an OR parent can be selected. Example: Algorithm is an OR parent with children Cycle, ShortestPath, MST, and Transpose.
- XOR (exclusive or): precisely one child of an XOR parent is selected. Example: MST is an XOR parent with children Prim and Kruskal. Search is an XOR parent with children BFS and DFS. Note: an XOR parent can have more than 2 children; only one will be selected.
Remember: Given any parent node (feature), all of its children have OR
connections to it, or XOR connections, or ANDmandatory/ANDoptional connections.
No other mixture of edges is allowed.
Here are three feature diagrams:
- To write a Java program that allows you to
construct feature diagrams as cleanly as possible. For
each diagram, define a method for each diagram that will
construct its tree. Your program must have a method that validates
- You must show the correspondence between your
Java program and its class diagram. If your program is
ugly, so too will your class diagram. May I
suggest that you do NOT use methods or constructors that have
- Remember: clarity is important in this project
(as defined subjectively by the Grader).
Hint: all of this should look familiar to you (as it should). I recommend that you proceed in the following way:
- 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.
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 of FeatureModel
- 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.