Transcribed TextTranscribed Text

VectorElement name : EString [0..*] vectorelement Group Graphic [0..1] group Figure 1: The file system model, in model/graphics.ecore 1 Pattern Identification This part of the assessment involves identifying a commonly used pattern. Consult the course text-book or online resources as necessary and reference all material you use. 1. Identify one design pattern that has been applied in the model shown in Figure 1. Explain which elements of the model correspond to which elements of the pattern you have identified. 2. Explain the rationale behind using this pattern. Use specific examples how systems that uses the pattern in an domain benefit from the pattern. Ex- ample applications could include a software tool for manipulating graphics or a network protocol for transferring graphics - you should come up with other examples. (1000 words max.) 3. Modify and extend the model to include 'GraphicsFile', "Square', "Circle' and 'Line' classes. Add attributes to these as appropriate. A GraphicsFile should have only ever have a single 'root' element, and this should be made explicit in your model. Explain how the added classes fit as elements of the pattern you have identified. 4. Create a sample GraphicsFile Object that has a number of Groups and Shapes modelled. The objects should represent a simple vector image. 2 Visitor Pattern In this part of the assessment you will build upon the model developed in the previous part to implement the visitor pattern. 1. Adapt the design and apply the visitor design pattern to the Graphics model. Identify which new element(s class(es) or method(s) are required. Provide enough detail in your solution to implement the design. 2. Outline a Visitor that counts the number of graphics elements in a file. Specify the class(es) and method(s) in the model that are needed and where the modifications should reside. Provide enough detail to implement the design, with the algorithms. Your solution should reference the graphics elements added in the previous part. 3. Outline a second Visitor that traverses the model to render the graphics. Specify the class(es) and method(s) in the model that are needed. Assume algorithms to draw the shapes are provided but decide where these methods will be. Your solution should reference the elements added in the previous part. 4. Discuss the potential advantages of applying the visitor pattern to this de- sign, given the different kinds of functionality in the application. (1000 words max.) 3 Pattern Selection In this part you will implement a feature of your own choosing to the model. Examples of features include displaying, counting elements or converting graphics to raster. You are free to develop any feature and pattern (other than visitor) that demonstrates your chosen design pattern. 1. Select an appropriate pattern that could potentially be applied to this model. Describe how the design pattern to supports building the functionality you have chosen. 2. Outline in enough detail to implement the additions and modifications that will apply the design pattern to the application. You should use models to illustrate your solution. 3. Discuss your selected pattern further. Consider alternatives to the pattern you have chosen for the same functionality. Also discuss how the pattern you have chosen combines with other patterns. For example, the visitor pattern from part 2 and one or two different pattern(s) of your choosing. You can use models to illustrate your discussion. (1000 words max.) Figure 2: Geometric tiles in Scalable Vector Graphics SVG (left, 4KB) and Portable Network Graphics 'PNG' (centre, right, 16KB) formats. Try en- larging the vector versions (zoom-in on the pdf).

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

1. Pattern Identification
1. Figure 1 showcases the Composite structural pattern. In the composite pattern, objects are represented as a tree structure, and individual objects can be handled identically to compositions of objects. In this example matching the composite structural pattern, the Component interface is shown to be VectorElement, the Leaf object is Graphic, and the Composite object is Group.
2. The benefit to using this structural pattern is that it allows the software designer to develop complex objects which can be composed of single and groups of other more simple objects.
One example of an application that would benefit heavily from this pattern is a drawing editor. Drawing figures can be grouped to form larger, more complex drawing figures. These can be grouped to form ever more complex figures, allowing for a hierarchy of objects to be able to be assembled from simpler groups of figures. For example, a set of leaf objects from classes representing shapes (Lines, Rectangles, Circles, Texts) could be grouped to make simple figures representing simple shapes. These simple shapes can be grouped with other simple shapes to form more complex shapes. And...

By purchasing this solution you'll be able to access the following files:

for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats