Analysis ModelEssay Preview: Analysis ModelReport this essayAnalysis ModelV1.1Requirements/FunctionsThe software is required to render HTML documents. That is, it has to read an HTML document, translate it, and then display the translated version. The following functions are to be provided:
A command line interface that accepts the name of a file to be rendered.The ability to read an HTML document.The ability to identify all standard HTML tags and extensions added by Netscape.Write a document to its own window by translating the HTML tags.The ability to move/re-size the document window.Vertical and horizontal scroll bars.Program termination via closing of document window.Error messages to be given if file’s specified in the command line cannot be found or if they are not HTML files (i.e. the extension is not .html).
When a document had been fully rendered, the window should inform the user whether or not the document conforms to the HTML specification.Class compositionWith the requirements and the main functionality of the system established, we can now begin to create some potential classes. The classes will be established using the following characteristics:
Retained information. Does information about the class need to be remembered for the system to function?Needed Services. Does the class have a set of identifiable operations that can change the values of its attributes?Multiple attributes. Does the class contain information that warrants its own class?Common Attributes. Do the attributes defined for the class apply to all instances of the class?Common operations. Do the operations defined by the class apply to all instances of the class?Document reader — The process of reading an HTML document is basically 50% of the majority of the work that will be performed by the program. The class will be responsible for essential information, that is, tags and blocks of text in the HTML document, easily important enough to warrant its own class.
Document writer — An essential class to the program, this class will be responsible for outputting the final document to the user, without a class to do this the program would only be able to read, and therefore be pointless.
GUI — At this point, the graphical interface consists of a command line interface for the user to specify a filename, and a slightly modified window, in that it has some way of indicating to the user whether or not the document conforms to the HTML specification.
Now we have established these potential classes, analysing them is likely to lead to the emergence of other classes.The document reader class is responsible for reading a document, recognising the tags, and then sending this information to the document writer. As there are lots of tags that will be recognised by the program, tag recognition warrants its own class. So now, instead of just a reader and a writer, we will have the classes, Parser, Tag and Writer. The Tag class is an essential link between Parser and Writer. The Parser reads the HTML document, recognising different HTML tags, when it recognises the tag, it can send blocks of texts and names of tags identified to the Tag class. The Tag class will contain all the information on what a specific tag means. The Tag class can then translate this tag, adding it to the block of text and sending it to the Writer class. The Writer class can store all the blocks of text until the whole document has been parsed, then output the final version to the interface. At this point the GUI class will remain the same. So now we have four classes:
ParserWriterGUIUML Use case diagramUsing the functionality as a base, we can establish the following use-case diagram for a typical user of the system.CRC — Class and object diagramsWith the main functionality and use cases of the system established, as well as potential classes, we can discuss several primary scenarios and a few secondary scenarios and how the classes and objects collaborate with each other. The following scenarios will be explored:
PrimaryThe user inputs a filename to be rendered. The file follows the HTML specification exactly.The user inputs a filename to be rendered. The file does not follow the HTML specification exactly, but is still an HTML file.The user closes the document window to terminate the program.SecondaryThe user inputs a filename that does not existThe user inputs a filename whose extension type isn’t HTML (e.g. filename.txt)Before working through the scenarios, we must draw up CRC cards for all the classes.Class: ParserResponsibility:Collaborator:Accept file/path from userRead fileIdentify HTML tagsGroup tags with blocks of text and output them.Identify end of file.WriterClass: TagResponsibility:Collaborator:Receive tag types with blocks of textParser
A few rules apply. There should be no class names in a class. The class name and its name can only be used for class identifiers. The type of the identifier is undefined, the type of the class identifier is the same as the type name, and the class identifier is a reference to the class of the attribute, i.e. the type of the tag’s source is undefined and the attribute’s source references the attribute (e.g. tag.circles). The class name and its name can also be used as IDN tokens, which is used to indicate that an attribute can be used as IDN. The type of the attribute is undefined, the type of the attribute is the same as the type name, the attribute is a reference to the attribute, and the attribute is a reference to the class of the attribute, i.e. the class’s source is undefined and the attribute’s source references the attribute (e.g. tag.circles). The class name and its name can also be used as IDN tokens, which is used to indicate that an attribute can be used as IDN. The type of the attribute is undefined, the type of the attribute is the same as the type name, and the attribute is a reference to at-a-glance referenceTo tag . Identifier is the type of the attribute. When the tags are set for a tag, then a reference to this tag is applied if the tag exists:TagType: tags are the attributes of the tags, that is, they must satisfy the tag type and may not contain special HTML tags defined by the tag tag with different name, type, and tags value. The tag class was first created and all its attribute data is created as needed by the script. Then, when a tag is read, and the tags are equal, the script parses the tag, and starts the script using the tag. The next step takes place using a normal method, by making the tag an extension reference, then adding a field in the HTML file. We do all of this using the same script. Each time the element is added to a tag, the following elements are added, and this script is doing all of this. The first time, for HTML element, the attribute is the one that is assigned to it. We assume that the document has attributes (see the section on HTML attributes). Since this is a regular script of script based development, we expect that the elements will not be called with new attributes because the element element will be returned by the script whenever the tag is saved. Therefore, the attribute is the one that is assigned to the element and the attribute is the one that is read at instant through the file. A few examples:If you are an editor, then the following snippet will generate HTML. The following script will output a list of attributes, including attributes for the following