Limitations in Mapping from UML to Java Shakeel Sadiq Computer Science (2002/2003)

Size: px
Start display at page:

Download "Limitations in Mapping from UML to Java Shakeel Sadiq Computer Science (2002/2003)"

Transcription

1 Limitations in Mapping from UML to Java Shakeel Sadiq Computer Science (2002/2003) The candidate confirms that the work submitted is their own and the appropriate credit has been given where reference has been made to the work of others. I understand that failure to attribute material which is obtained from another source may be considered as plagiarism. (Signature of student)

2 SUMMARY Planning is an essential activity in any task to be undertaken. So much so, that without it a task can quite quickly become an utter disarray. Likewise, design is crucial, and a prerequisite, if one is to produce efficient code. It is also easier and cheaper to modify a design model than to make rectifications once implementation is well under way. This report summarises a research based Final Year Undergraduate Project which set out to investigate why it is often the case that the design aspect of software or a system and its actual implementation do not represent the same concepts. The approach taken was to attempt to implement in Java a set of class diagrams created using the UML. The purpose of attempting such mappings was to highlight which constructs were mapped to Java with ease and clarity and which provided problems. The project then analysed these constructs and looked to provide solutions so that the logical gap between the diagram and the code could be diminished. I

3 ACKNOWLEDGEMENTS First and foremost I would like to say that all praise is due to Allah who makes all things happen. I thank him for everything in my life. My parents have helped me through everything and have been there for me through all situations. I respect and appreciated their presence and cannot thank them enough. I would like to thank Eric Atwell and John Davy for his helpful hints at a vital stage of the project. II

4 TABLE OF CONTENTS SUMMARY ACKNOWLEDGEMENTS I II 1. INTRODUCTION 1.1 STATEMENT OF THE PROBLEM 1.2 PROJECT PURPOSE AIM MINIMUM REQUIREMENTS POSSIBLE ENHANCEMENTS SCOPE 1.3 METHODOLOGY BACKGROUND 2.1 RELEVANCE TO DEGREE PROGRAM 2.2 PREVIOUS ATTEMPTS AT THIS OR SIMILAR PROBLEMS 2.3 MOTIVATION 2.4 LITERATURE SEARCH AN INSIGHT INTO UML 3.1 INTRODUCTION 3.2 CLASS DIAGRAMS USES UML CONSTRUCTS AVAILABLE FOR CLASS DIAGRAMS Attributes and Operations Visibility Association Multiplicities Generalization Aggregation and Composition Qualified Associations Derived Associations Association Classes III

5 Interfaces Abstract Classes Constraints Parameterised classes Components and packages Summary EQUIVALENCE IN JAVA 4.1 INTRODUCTION 4.2 CLEARLY CORRESPONDING CODE FOR CONSTRUCTS Classes Packages Interfaces Associations Composition Association Stereotypes Association Qualifiers Inheritance Constraints Summary 4.3 CODE FOR WHICH THERE IS NO CONSTRUCTS 4.4 CONSTRUCTS FOR WHICH CODE IS NOT APPARENT Multiplicity Templates Aggregation Multiple Inheritance Summary ANALYSIS OF UNCLEAR MAPPINGS 5.1 INTRODUCTION 5.2 CLOSER LOOK AT THESE CONSTRUCTS Parameterized classes Multiple inheritance Aggregation IV

6 5.2.4 Multiplicity Summary 5.3 POSSIBLE IMPROVEMENTS TO UML Multiple inheritance Aggregation Summary 5.4 POSSIBLE IMPROVEMENTS TO JAVA Parameterized classes Multiplicity Summary CONCLUSIONS AND FURTHER WORK EVALUATION 7.1 INTRODUCTION 7.2 ROLE OF THE UML 7.3 ROLE OF INDIVIDUALS 7.4 PROJECT MANAGEMENT Initial Plan of Work Amendments to Schedule Summary 7.5 EVALUATION CRITERIA APPENDIX A Dealing with third parties Reflection APPENDIX B 73 APPENDIX C 75 BIBLIOGRAPHY 76 V

7 LIST OF FIGURES Section Description Page Class Model General Association Multiplicities Generalization Multiple Generalization Aggregation Composition Qualified Association Derived Association Association Class Interface Interface Interface with dependency and stereotypes Abstract Class Constraint Parameterized Class Package Class diagram with corresponding Java Code Bi-directional Association Class displaying naming convention A package with an Interface and its corresponding Java implementation An Interface with its Java implementation Unidirectional Link with Java implementation Association Class Implementation of Association shown in Figure Implementation of a Singleton Object Composition and its Java implementation Composition Common Stereotypes An Association Qualifier and its Java Implementation Single Generalization and its implementation Multiplicity and its implementation Aggregation in action Multiplicity in action State changes in deletion and addition of links Multiple Inheritance Converted from Multiple Inheritance 55 VI

8 1 INTRODUCTION 1.1 STATEMENT OF THE PROBLEM There is often a lack of consistency between design and code. In specific, the design as represented by the Unified Modelling Language (UML) and the code as constructed in the Java programming language. This issue can no doubt have negative consequences when one is undertaking the development of a piece of software of any magnitude. Hence, this project shall attempt to diminish this gap between the conceptual design and the implemented code by analysing the process of mapping from a UML class diagram to Java source code. 1.2 PROJECT PURPOSE AIM The aim of the project will be to highlight and analyse what a UML class diagram may contain which could cause potential problems when being mapped to Java. It is essentially attempting to identify the limitations that exist when converting UML constructs or concepts to Java source code. Having identified and analysed these constructs, the aim is to provide solutions to clarify the mapping for those constructs which currently have an unclear mapping to Java MINIMUM REQUIREMENTS To identify primitive constructs in UML To gather a corpus of UML diagrams and corresponding Java implementation For each primitive construct in UML, seek some representative example and some corresponding Java code in my corpus An analysis of the above results POSSIBLE ENHANCEMENTS A possible enhancement could be to produce software that attempts to overcome the issues raised. This would attempt to take the theoretical work a step further and implement a tool which maps UML to Java code in a more accurate fashion than is already done. 1

9 A further enhancement could be to cover other areas of the UML that have not initially planned to deal with in this project, such as Building Web applications with the UML SCOPE The project deals with class diagrams only as opposed to any other diagrams as defined by the UML. Also, not all the available constructs will be considered. The constructs shall be limited to those that are relevant to the discussion at hand and it shall be clearly stated what these constructs are. Furthermore the mapping stage shall be limited to the manual mapping of a construct from the UML to Java. In other words no software, i.e. CASE tool, will be used to perform the mapping and hence the project shall be limited to a paper-based study. 1.3 METHODOLOGY The project utilises a methodology based on a collection of UML class diagrams and corresponding Java code. Such a methodology shall aid in easing the process as well as ensuring efficiency and accuracy of work from start to conclusion. Also, a methodology of this type is ideal for a project of this nature due to it involving the analysis of the collection of diagrams and code obtained. In other words, a diagram representing a certain construct is chosen from the collection and then an attempt is made to find the equivalent piece of code, again from the collection. Therefore, the flow of work is decided by whether or not a clear correspondence is established between the code and the UML; for an unclear correspondence there is a requirement to analyse why this is the case. This also allows for conclusions to be consolidated with real examples. The justification of such an approach is that examples are essential in such a project. It is a lot more efficient and concise to explain the clarity, or lack of clarity, between a UML construct and Java code, if it can be seen both graphically and explained with theoretical explanations. It also allows the reader to relate to the project as they may have come across similar examples. The background reading showed there to be some existing documentation of graphical and theoretical examples of UML constructs and their mapping to Java. Therefore, such information only motivated the use of this methodology further. 2

10 Another possible methodology involves the use of a tool in order to carry out code generation. It begins with a construct, as done in the chosen methodology, and results in Java code, again as done in the chosen methodology. However, this approach was refused as it was felt that many limitations in the mapping would have been clouded by the limitations in the tool itself as opposed to the languages themselves. Previous knowledge on the capabilities of a tool that produces source code led to the belief that such a methodology would not have allowed a progression in the project to the depth desired. 3

11 2 BACKGROUND 2.1 RELEVANCE TO DEGREE PROGRAM This project is relevant to my degree program, i.e. Computer Science, due to its content of the Unified Modelling Language and Java. Java is a language that I have studied previously in SO21: Object-Orientated Programming but have a preference to look more closely at some of its concepts and content. Therefore this is an opportunity for me to go over, and more importantly expand, on what has already been taught. Furthermore, The UML is again a language that has been done in SO21: Object-Orientated Programming, though not to the extent that I wished it to be taught. Hence, again this is a chance to expand on existing knowledge in an area of interest covered in my degree program. 2.2 PREVIOUS ATTEMPTS AT THIS OR SIMILAR PROBLEMS This section discusses existing work done in the proposed area of research of this project. This allows for the distinction of how this project extended or differed from work done previously. It also displays the completeness of the existing work, based on what this project wishes to achieve. Hence the sources considered here tackled, in some form or another, the question of mapping from UML to Java. [10] documents a proposed methodology of a tool mapping from UML diagrams to Java. It does not provide any background to the UML nor are there any examples or discussion of the general mapping from UML to Java as this is assumed knowledge. However it was seen as one possible solution to the problem being tackled within this report. This is because it does highlight and concentrate on specific areas in Java where a UML mapping could cause problems or where certain issues could arise. Therefore in the proposed implementation of the tool it has considered and brought up areas that were expand on within this project. Although this paper has been created by employees of IBM and may have a flavour of advertising within it, it is never the less very useful. Chapter 3 of [14] discusses what should be considered when developing a design for Java implementation. It also looks at correspondence between what is in the UML and how it can be implemented in Java. It therefore provided a good platform for the discussion to be pursued in 4

12 this report. It does however lack detail as graphical and theoretical examples are not always provided. Furthermore it does not take the issues further by providing solutions to the limitations it has raised. In any case, as stated, it was a solid base on which the development of this project took place [26] provides graphical examples of UML and the corresponding Java code, hence was no doubt valuable for use in this project. It also provides a brief explanation with each of these mappings, however, as stated; this is only brief and not concise. Also, it fails to take the process further by providing an insight into the unclear mappings. [11] declares that There are several well-known problem areas in the UML (Version 1.3). [11] This sets the tone of the article. However it is not simply a paper stating what problems were identified at the conference, but is more interested in providing constructive criticism. Along with the problem areas identified recommendations are provided in order to improve future versions of the OMG s modelling language [11]. This article was not seen to directly aid in identifying problems in mapping from UML to Java, however it gave weight to the case that problems or issues may be in the definitions or usage of the UML and are magnified when a mapping to a language such as Java takes place. Therefore, it is a piece of work done in a relevant, though only captured one end of the argument. [9] is again a paper which deals with the ambiguities in the UML, however only concentrates on associations. Even though it again captures only one side of the argument, its input is vital as it looks at possible problems in the latest release of UML, UML 1.4, and provides a concise explanation with possible solutions. The above discussion highlights that even though many of the areas proposed to be researched in this project may have been covered separately; they were incomplete in accordance with the aims of this project. They did not cover the complete line of work that was desired, i.e. beginning from a background section, on UML, working through mapping to Java and continuing through to possible solutions in unclear mapping of constructs. Hence, this report intended to collate existing work; however more importantly to expand on areas that were not covered by these existing pieces of work. 5

13 2.3 MOTIVATION An obvious background area, amongst those discussed in section 2.2 would have been the theoretical approach creators of CASE tools take before implementing the tools. Such work should state what aspects of mapping from UML to Java are considered, and so again would have been relevant with respect to the aims of this report. However, it was found that such information either did not exist or was not very well documented. The lack of access to such information only motivated this project further as one single report was to be compiled which contained the bare essential of background knowledge required, as well as graphical and textual examples of mapping from UML to Java. Also, guidelines and solutions were to be provided, depending on whether correspondence between the UML and Java was clear or unclear. Further motivation arose from personal reading and experience, especially a 12 month placement as a software engineer. Such personal experience provided an insight into how it often occurs that there is a gap or discrepancies between design and code. In other words the UML diagrams and the Java code are out of sync. This obviously could be for several reasons, though the research for this project aimed to reduce this element of difference between the languages. Furthermore, as mentioned earlier, the expanding of knowledge on UML and Java was a motivation in itself. By undertaking this project, there was a requirement to dwell into the various constructs and concepts in UML as well as the coding concepts of Java. In order to make the comparisons there was a need to gather and analyse UML class diagrams which represented many aspects of UML. Hand in hand with this was a need to analyse the corresponding Java code. Therefore, several opportunities existed to deepen existing knowledge and interest in these areas. 2.4 LITERATURE SEARCH In order to complete the project, a systematic form of literature gathering was essential. Initial steps were to simply look at the UML. The aim was to gather enough sources dedicated to the UML itself and also that the sources provided both graphical and theoretical explanations. The result was the gathering of information from textbooks, articles and forums. Many examples in the background to UML were taken from [33], with [24] also being used. The reason for extracting examples from text books was that as they exist and are well documented, it was 6

14 pointless to create more. [29], [31] are websites of well recognised companies related to the UML, in one form or the other, and so provided valuable and relevant information. The next stage was to collect information on Java. A sensible starting point was [18] which provided information on the background to the creation of Java; aims and justifications. Also, the reason for researching Java was that when attempting to map a construct from the UML, the Java equivalence must be understood clearly in order to verify whether or not the mapping was successful. Therefore [3] was instrumental in the phase of assembling information on the Java as it deals with not only the syntax of Java, with use of an extensive case study, but also looks at object modelling featuring UML. Also, as modifications to Java were a possibility, [17], [20] were identified in order to keep up to date with such proceedings as modifications or additions to Java. The next logical phase of information gathering was to look at the actual mapping of UML to Java; however this was dealt with in section 2.2. The following steps were to analyse results and to provide possible solutions, which inevitably required the analysis of the UML constructs causing unclear mappings to Java. To undertake these steps, forums were of great importance as they embody the ideas and debates of experienced and knowledgeable individuals. Therefore, [24], [21] were used to gather ideas and views on UML constructs, concepts and limitations. Likewise, [19], [2] were used for the same reason however for Java. Also, in order to provide solutions, [30], [11], [22] played a part. Again, they were read, analysed and only included in the project when agreed with. Furthermore, alternative perspectives were fuelled with sources such as [13], [27], [4]. These were required in order to add depth to the project as solutions were never going be to be as clear as black and white. In other words, conclusions and solutions to the project needed to include a combination of improvements to UML, to Java as well as alternative approaches. Therefore such sections provided the backbone to follow this path of study. This approach to the work allowed for a blend of background knowledge with an in-depth analysis of both languages. 7

15 3 AN INSIGHT INTO UML 3.1 INTRODUCTION "The UML is made of a number of models that together describe the system being designed. Each model comprises one or more diagrams with supporting documentation and descriptions". [14] The relationships between components of a system are easier to understand when some form of graphical representation is used. This has appeared in the form of modelling languages, such as the UML, which not only visualises the artefacts of an object-orientated system under development but also documents the various aspects within it. In terms of a language for communicating decisions The Unified Modeling Language (UML) provides a very robust notation, which grows from analysis into design.[9] The justification of its use is further strengthened by the widespread opinion that it is the industry-standard for the tasks it represents in the development of software systems. Section discusses the part played by class diagrams in the modelling and capturing of the details of a system. Section then looks in detail at the various constructs available for class diagrams, however not all possible construct will be discussed here. The discussion in section will be limited to those constructs that are essential to the study at hand. 3.2 CLASS DIAGRAMS USES The class diagram is just one of nine types of diagrams that comprise the UML however it is the core of the UML notation and of an object-orientated design. The nine diagrams that are defined are class (package), object, use case, sequence, collaboration, statechart, activity, component, and deployment. However, just to reiterate, the focus of this study shall solely be on the class diagram only. The role of the class diagram is that of presenting the static structure of the system, including the properties and methods of each class. Furthermore, the various relationships that can exist between classes, such as an inheritance relationship are also represented. This form of 8

16 diagram is seen to be the most widely used diagrams from the UML specification. One reason for this popularity is the fact that many CASE tools, such as Rational XDE, will auto-generate code in a variety of languages, including Java and C++ from these models. Such tools can provide the synchronization between the models and code and, to some extent, reduce an individual s workload. Furthermore, these tools can also generate class diagrams from the object-oriented code, itself. However, this project shall not be using such tools or be utilising the facilities provided by such tools UML CONSTRUCTS AVAILABLE FOR CLASS DIAGRAMS This section considers those constructs which are available for class diagrams and hence which are within the scope and purpose of this study. For each of these constructs there is a brief explanation and a graphical representation however for further knowledge on the uses and explanations of these constructs, as well as UML and associated diagrams, [33], [14], [24], [29], [31], [1] should be referenced. The corresponding sections in section 4 that discusses the mapping of the construct to Java have also been stated below Attributes and Operations The attributes of a class can be seen as the simple data found within them and their instances. An operation is a representation of the functions that the class and its instances perform. Figure 1 shows a simple class model, with attributes and operations. The attributes can be seen listed in the second, or middle, compartment of the class representation icon and the operations listed in the bottom, or third, compartment. title : String Book copiesonshelf() : Integer borrow(c:copy) Figure 1 pg64 [33] Class Model The discussion of the mapping of classes to Java will be discussed in section

17 Visibility It is often the case that a class has operations or attributes that are not available to every client of the class. The UML uses the + sign to show it is public, the # sign to show it is protected and the sign to distinguish it from being private. The discussion of the mapping of visibility to Java will be discussed in section Association An association is a concept that shows there is a meaningful relationship between objects. As classes correspond to nouns, associations correspond to verbs. Two classes, class A and class B can be said to be associated if: "an object of class A sends a message to an object of class B an object of class A creates an object of class B an object of class A has an attribute whose values are objects of class B or collections of objects of class B an object of class A receives a message with an object of class B as an argument" [33] The UML for a general association is shown in Figure 2. Copy is a copy of Book Figure 2 pg62 [33] General Association As stated this is a general association, as associations may have direction, name, and should show multiplicities. The discussion of the mapping of the association relationship to Java will be discussed in section

18 Multiplicities Multiplicities show how many, if any, of a class is associated with another class. There are various possibilities that can be represented. It could be an exact number, or it could be a range of numbers or it could be an unspecified number. The UML to represent these cases is as follows: Employee * worksfor Company Secretary * 1..* supervisor Manager Company BoardOfDirecto Office allocatedto * 0..1 Employee Person 0,3..8 * boardmember BoardOfDirecto Figure 3 pg 157 [24] Multiplicities Figure 3 shows how to label an association, the varying types of multiplicities and also how to represent direction in order to make the reading of the association clearer. The discussion of the mapping of multiplicities to Java will be discussed in section

19 Generalization Generalization can be seen as another important relationship which may exist between classes. It can be seen to represent the "is a" conceptual relationship. For example, a LibraryMember is a generalization of MemberOfStaff as conceptually every MemberOfStaff is a LibraryMember. The UML for a generalization is shown in Figure 4. LibraryMember MemberOfStaff Figure 4 pg 67 [33] Generalization UML allows this to be taken further whereby you can have multiple subclasses. Figure 5 illustrates a possible use of multiple generalization. In the example, the Animal class is called a superclass, and the classes Cat, Dog and Raccoon are referred to as subclasses of the Animal class. Animal Cat Dog Racoon Figure 5 Multiple Generalization The discussion of the mapping of generalization to Java will be discussed in section and the discussion of the mapping of multiple generalization will be discussed in

20 Aggregation and Composition These are being discussed together as they are both kinds of association however show greater detail of what kind of association exists between classes. Essentially, they both are stating that an object of one class "is part of" and object of another class. An aggregation is the representation of a "part-whole" relationship where the whole side of the relationship is often called the assembly or the aggregate. Often there is a source of confusion in when in to use aggregation. However, as a rule, aggregation should be used when: "You can state that the parts 'are part of' the aggregate, or the aggregate 'is composed of' the parts. When something owns or controls the aggregate, then they also own or control the parts." [24] Figure 6 illustrates aggregation with the diamond at the end of the whole part: HonoursCourse 1..* 6..* Module Figure 6 pg 75 [33] Aggregation The discussion of the mapping of aggregation to Java will be discussed in section Composition is seen as a stronger form of aggregation as it imposes further restrictions. If the aggregate is destroyed then the individual parts are destroyed as well hence the whole strongly owns it parts. In terms of use, the multiplicity at the whole end of the composition must be either 1 or 0..1, as a part cannot be part of more than whole by composition. Figure 7 illustrates composition from which it can be seen that the notation is similar to aggregation however the diamond is filled in: Board Square Figure 7 pg 75 [33] Composition The discussion of the mapping of composition to Java will be discussed in section

21 Qualified Associations When a designer wishes to give finer details about an association there is the possibility of utilizing a qualified association. This allows for placing extra information that will make the association clearer and allow for a more accurate implementation. Figure 8 shows a qualified association. This particular example allows the designer to state that the nine squares on a board are realised by providing the nine pairs of values to the two attributes row and column. Board Row:{1,2,3} Column: {1,2,3} 1 1 Square Figure 8 pg 79 [33] Qualified Association The discussion of the mapping of qualified associations to Java will be discussed in section Derived Associations This is a form of association where a designer implements two associations and a third one will exist automatically. Hence, the designer need not worry about the implementation of this association as ultimately the existence of this third association can be deduced from the existence of the other two. Figure 9 shows a derived association, which is represented by a slash in front of its name. The association between Lecturer and Student, named teaches student, can be seen as the derived association as logically if a student is taking module X and lecturer Y teaches module X, then lecture Y will be teaching that student. 14

22 Student Module /teaches student teaches course Lecturer Figure 9 pg 80 [33] Derived Association The discussion of the mapping of derived associations to Java will be discussed in section Association classes Associations have been discussed however often, the way in which two objects are associated is just as important as the objects themselves [33] Figure 10 will clarify this brief definition: Student 1..* is taking 6 Module is taking mark : int Figure 10 pg 84 [33] Association Class In this scenario there is an association between student and module, as discussed earlier. However the question is where one would store a record of student s marks on this course. This is why and where an association class is utilised. Each instance of this class can now connect a student with a module and record the results as required. There would also be operations to retrieve and set these results accordingly. The discussion of the mapping of association classes to Java will be discussed in section

23 Interfaces An interface is a collection of operations that specifies a particular service of a model element, i.e. a class or a component. It need not specify all the operations that the element supports, therefore the same element could match several different interfaces. For instance lists, stacks and trees an interface in the form of an iterator which allows other classes to identify what elements are contained with them. Figures 11 and 12 show both ways to specify interfaces in UML: Person <<interface>> Cashier withdraw deposit Machine Employee ATM Figure 11 pg 172 [24] Interface Person Machine Cashier Cashier Employee ATM Figure 12 pg 172 [24] Interface In Figure 11 the interface is represented via a class rectangle using the expression <<interface>> and also, as an option, a list of operations supported by the interface. Though the notation is similar to generalisation there is a key difference in meaning and that being that the relationship between the implementing class and the interface is one of can-be-seen-as, as opposed to is a. Therefore it is a weak form of inheritance as the classes realising or supporting the interface must provide their own implementation. Also note that there is no attribute compartment for the reason that interfaces cannot have attributes. 16

24 Figure 13 clarifies a few more important points. The diagram again shows an interface and its use; however here the focus is on dependency and stereotypes. <<interface>> Stringifiable Module Stringify() : String <<uses>> prints stringify() : String Stringifiable Printer Figure 13 pg 87 [33] Interface with dependency and stereotypes In this example the class Printer depends on the interface Stringifiable only, as shown by the dependency arrow from Printer to the circle representing the interface Stringifiable. This is an extra piece of useful information in this example as it states that as long as a class provides the method stringify, Printer does not care about other features. Therefore, following on from this, any changes made in the Module class that do not affect the stringify method can be made without any changes having to be made to Printer. The other point to be made is the use of a stereotype, namely <<uses>>. A stereotype is UML s way of attaching extra classification to model items; its one of the ways that UML is made extensible. [33] In this example it is simply stating that Printer depends on the interface Stringifiable. The discussion of the mapping of interfaces to Java will be discussed in section The discussion of mapping a stereotype to Java shall be undertaken in section

25 Abstract classes A related idea to the previous one of interfaces is abstract classes. This form of class may have implementations defined for some of its operations however it is abstract in the sense that at least on of these operations will not have an implementation defined Again, UML uses a stereotype for representing an abstract class, this time it is <<abstract>>, as shown in Figure 14. <<abstract>> Shape Draw() Erase() Circle Square Figure 14 Abstract Class The discussion of the mapping of abstract classes to Java will be discussed in section Constraints The issue of constraints can be discussed in two sections, one being the facilities provided by UML itself and the other being those facilities provided by a language such as the Object constrain Language (OCL) used in conjunction with UML. However, the aim of both is to add additional information to a UML diagram. The constraint can be seen as a condition that must be fulfilled by an implementation that is to be deemed correct according to the design. 18

26 Figure 15 is an example of a constraint provided by UML itself: Copy 1..* 0..1 is a copy of Book 1..* (or) 0..1 Journal Figure 15 pg 81 [33] Constraint The discussion of the mapping of Constraints to Java will be discussed in section Parameterised classes Though the name may suggest, these are not actually classes. They can be more accurately thought of as functions that take classes an return classes, as opposed to the norm of taking a value and returning a value. Such classes are also known as templates or generic classes. Figure 16 is an example displaying a parameterized class and its uses. In this scenario we have a list of students and a list of games, which though are different, will also have a lot in common. For example, adding and deleting elements from the list. Therefore, as the parameterized class will take a class and in return will describe the objects of the class, it can be defined once and used twice. Hence time shall be saved in development and maintenance of the lists. 19

27 List add(t:t, pos:int) get(i:int) : T T List<Game> <<bind>>(student) StudentList Figure 16 pg 90 [33] Parameterized Class In Figure 16 only one dependency is shown however not the other, i.e. the dependency of List<Game> on List<T>. The reason is simply that this is obvious from the name. The discussion of the mapping of Parameterized classes to Java will be discussed in section Components and packages A relationship mentioned earlier is dependency. This is most commonly used in UML between packages. A package can be seen as a collection of related model elements, such as classes and their relationships, which then defines a namespace for these elements. There are several reasons for wanting to use packages and the recommended books will provide this knowledge. Also, visibility and hierarchies of packages are key issues, however again these will not be explained in the context of this project. Figure 17 gives the UML graphically view of the notation, with a package represented as a rectangle with a tab on its edge: 20

28 P R C B A foo:?? Figure 17 pg 162 [33] Package The discussion of the mapping of packages to Java will be discussed in section Summary Within this section definitions have been given, using graphical examples where appropriate, of relevant constructs used in conjunction with class diagrams. This background knowledge shall be useful as section 4 will consider whether these constructs can or can not be mapped to Java. As stated earlier, in accordance with the scope of the project, only certain constructs have been discussed here. These, and also the constructs not mentioned here, are well documented elsewhere. References for these have been provided. 21

29 4 EQUIVALENCE IN JAVA 4.1 INTRODUCTION It is within this section that a search for a correspondence in Java for the UML constructs identified in section shall be undertaken. Three categories have been identified. The first section is section 4.2 and those constructs that provide a direct equivalence in Java shall be considered. Certain guidelines may also be provided with this section in order to avoid potential issues. Then a brief subsection shall be dedicated to certain aspects of an implementation language that are not represented by the UML. This aspect is discussed further in section 4.3. Finally, though probably of greatest importance, are the UML constructs that provide problems when being mapped to Java. Each of these, in some form or another, will require analysis and proposed solutions, which shall be dealt with later. Within section 4.4 these constructs are identified. 4.2 CLEARLY CORRESPONDING CODE FOR CONSTRUCTS This section shall discuss those constructs in UML for which the equivalent code in Java exists. For further information on the UML constructs section 3 should be referenced and the relevant sections under each sub-section has been provided below. Here the theory shall be combined with practical examples in order to provide further evidence of the usage of the constructs within Java. There may, however, be instances where the corresponding Java code is evident but care must be taken when performing the actual implementation; this shall be expanded on if and when required Classes The definition of classes, including attributes, operations and visibility, was given in section Here the mapping shall be discussed. The mapping of classes is a straightforward process and can be seen as a one-to-one relationship. Figure 18 shows a class in UML, with instance variables and operations, and a corresponding implementation in Java: 22

30 Figure 18 [26] Class Diagram with corresponding Java code In this example it is evident that the class name, its attributes and its operations have been mapped to the java source code. Furthermore, the types and visibility of both attributes and operations and parameters and return types of the operation have also been implemented though there are several issues that may hinder this clear mapping. From a design perspective, it is important to note that the UML offers four levels of visibility; public, protected, private and package. The last of these visibilities was introduced in version 1.4 of the standard and so brings the UML closer to the Java implementation as the Java programming language supports these four visibilities. [8] discusses, however, that the definition of this new package visibility in the UML seems to contain an element of ambiguity. This is because an association could be declared between classifiers from two different packages. Therefore it could be questioned, to which package does the association declaration actually belong to? An immediate solution is provided which is a modification to the UML explanation of the package visibility. This being the inclusion of the following sentence to the existing explanation, The association end is declared in the same package as the opposite source class(that is, the class that owns the association end) [9] [9] also discusses the possible issues with visibility as a whole. It agrees that the mapping of the visibility of an association is clear, however only for unidirectional associations. It goes on to state that when bidirectional associations are considered this mapping is faced with several problems. The problems discussed seem logical and realistic and so shall an example shall be provided here in order to clarify the point being made by [9]. Figure 19 displays a bidirectional association, namely Lecturer-Subject, with both public and private visibility. 23

31 Figure 19 Bi-directional Association The potential problem revolves around the idea of lecturer being public, hence usable by any other class and also able to have indirect access to the private association end, and subject being private, which means it has direct access to itself. Thus far the explanation is simply based on definitions however it is these very definitions that can cause an issue. This is because the association end with the private rolename subject is only known to lecturer hence this means that the Subject class realises it is associated with the Lecturer class. However it does not know that the Lecturer class is associated with it also. This raises the question of whether this really is a bidirectional association. [9] states that such a scenario can occur as Visibility in UML is not specified for associations but for association ends and that the solution is that We need in UML a definition of visibility that fits better with the concept of bidirectional association. Further, as a general rule of thumb for visibility, it is usually better to be as restrictive as possible when setting the visibility of a method. In other words, if a method does not have to be public, then make it protected. If it does not have to be protected, then make it private. Also, use default visibility only when it is meant and document the reasoning for applying that visibility in the method header documentation if it is not clear why it has been applied. With respect to using types, the UML will allow the use of, almost, any type. However, only valid Java types should be used. This is the case for the attributes as well as for the operations, which are implemented as Java methods. In the case of the operations, it is the parameter list as well as the return type usage in the UML that must be concentrated on. In Java the difference between the static methods and attributes and non-static, or instance methods and attributes is significant. However, when representing them in UML, it may be possible to lose their significance when carrying out an implementation. This is because on a class diagram a static method or attribute is represented only by a small symbol, i.e. it is underlined, and an instance method or attribute is left non-underlined. This minor criticism does not demand a change in the notation of the UML however has been pointed out just as form guideline which if not followed could be the cause of several problems. 24

32 Furthermore, Design Class Diagrams should reflect language naming conventions. Design class models define the structure of the object source code, and therefore should reflect the naming conventions for the implementation language being used. For example, in Figure 20 the design version of the Order class uses names that conform to common Java programming conventions such as placementdate and calculatetaxes(). Figure 20 pg 29 [1] Class displaying naming conventions A final point is that the UML does not explicitly distinguish between operations and constructors. To make it more explicit which are the constructors, an approach is to use the convention of the language being used to implement the design model. In the case of Java the new operator is used to invoke the method, i.e. the constructor, and so operations in the model that are named new shall be distinguished as constructors Packages The definition of packages was given in section Here the mapping shall be discussed. Though there is a direct mapping from UML packages to Java packages, there are some issues in what they represent in either language. A Java package can be seen as a collection of classes and interfaces stored in the same area or directory and maintained using scoping rules. By acting as namespaces, they allow situations such as classes having the same name, as long as they reside in different packages. The UML, however, takes this definition further and packages in the UML are hence somewhat more than this. The first issue is concerned with the fact that the UML packages have similarities to 25

33 aggregation whereas Java packages do not. [14] discusses this difference in meaning of packages, If a package owns it s content it is composed aggregation, but if it refers to its contents (i.e. imports elements from other packages) it is shared aggregation. Don t be confused here with Java imports, which merely make classes or interfaces in other packages visible to the current package there is no aggregation happening with Java Further issues are that UML packages may have visibility, whereas this concept does not hold in Java. Also, inheritance of packages exists in UML however Java does not entertain this idea and its use only complicates the process of translating designs into Java further. Though there is no direct concept of a Package Interfaces in Java, it is usually a good idea to make use of it. Figure 21, taken from [14], is both the UML for a package with an interface and a possible implementation in Java. package vehicles; public interface Drives { public boolean drives (String dest); } vehicles public class VehicleFactory { public static Drives getvehicle( ) { return new car ( ) ; } } drives public class Car implements Drives { public Boolean drive(string dest) { } } Figure 21 [14] A Package with an Interface and its corresponding Java implementation Interfaces The definition of interfaces was given in section Here the mapping shall be discussed. There is a direct mapping from UML interfaces to Java interfaces. Figure 22 shows such a mapping with the UML diagram and the corresponding Java code. 26

34 Figure 22 [26] An Interface with its Java implementation However, when mapping to Java a method specification and public static final constant must also be provided. The reasoning is that, as Java provides no direct support for multiple inheritance one can implement functionality similar to multiple inheritance by using interfaces in Java. Therefore, Java interfaces provide object method descriptions but contain no implementations Associations The relevant sections for definitions related to this section are sections , and Here the mappings of such relationships shall be discussed. There are many possibilities when it comes to mapping associations from UML to Java. Each shall be discussed here, along with its pros and cons. The simplest approach is simply to use an instance variable in one object to reference another object. This, however, leads to several limitations and can be seen as too simplistic in terms of what relationship it is attempting to represent. The main problem lies in the notion that it is usually almost impossible to use this technique to represent anything other than a single unidirectional link. However, in most cases we are interested in either a bi-directional link or multiple objects referenced by the link, and you may even require a key to determine which link to follow. [14] Furthermore, it may be the case that associations have their own attributes, which would again decrease the use of this approach as a single variable reference could not provide such flexibility. Figure 23 is an example of a representation using this approach. Evidently, Phone holds a reference to Button and this can be coded in Java as shown to the right of the UML representation. However, as discussed, one can be limited to a single unidirectional link. 27

35 Figure 23 [14] Unidirectional Link with Java implementation Another option is to use a separate class that represents the association itself. This class will reside in between the two classes that are being associated. Figure 24 shows two classes being associated, Developer and Project, and an association class, namely Link and figure 25 is one possible implementation of the association. Developer Link Project Figure 24 [14] Association Class This approach overcomes the limitations encountered before in that the link may be unidirectional or bi-directional. Also, due to the fact that the link object now represents the association, and not a reference as before, the association can have attributes and operations like any other object does. Hence, again, increases its flexibility and behaviour capabilities. Another issue is that of singleton objects. These objects exist when there will only ever be one instance of a class within the system. It should be possible for this object to be referenced by other objects and so an easy implementation of such associations must exist. With regards to the implementation of singletons, [14] discusses the use of both class-side attributes and operations and instance-side attributes and operations. The issue with the class-side approach is that, though it is easier to access the class, information on the class-side is never inherited in Java. This would cause certain limitations in the future development of the system as there would be no possibility of subclassing the class to create a different type of singleton object. 28

36 public class Developer { private Link link; public void addlink(link 1) { link = 1; } } public class Project { private Link link; public void addlink(link 1) { link = 1; } } public class Link { private Project project; private Developer developer; public Link(Project project, Developer developer) { addtolink(project, developer); } addtolink(project project, Developer developer) { this.project = project; project.addlink(this); this.developer = developer; developer.addlink(this); } } Figure 25 [14] Implementation of Association shown in figure 24 The alternative approach overcomes the issue of inheritance however it creates further potential obstacles. The main concern is how other objects will access the instance. A possibility is to create a reference to the instance and then pass it to other objects; however this can soon lead to cluttered coding if several objects wish to reference the singleton. The other option is to create an instance of the object as soon as the class is loaded. This instance can then be maintained within a class-side public final attribute. This attribute can then be accessed wherever the class is imported, but it is an instance that is then obtained. [14] A coded example of the latter approach can be seen in Figure

Software Design Models, Tools & Processes. Lecture 3: Addendum Cecilia Mascolo

Software Design Models, Tools & Processes. Lecture 3: Addendum Cecilia Mascolo Software Design Models, Tools & Processes Lecture 3: Addendum Cecilia Mascolo Example object diagram Taken from [Booch 1999] Notation for objects an object icon Object name Class name Name compartment

More information

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models CS 494 Object-Oriented Analysis & Design UML Class Models Overview How class models are used? Perspectives Classes: attributes and operations Associations Multiplicity Generalization and Inheritance Aggregation

More information

Object-Oriented Software Engineering Practical Software Development using UML and Java

Object-Oriented Software Engineering Practical Software Development using UML and Java Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes Lecture 5 5.1 What is UML? The Unified Modelling Language is a standard graphical

More information

UML class diagrams. Nigel Goddard. School of Informatics University of Edinburgh

UML class diagrams. Nigel Goddard. School of Informatics University of Edinburgh UML class diagrams Nigel Goddard School of Informatics University of Edinburgh A class Book A class as design entity is an example of a model element: the rectangle and text form an example of a corresponding

More information

Class diagrams and architectural design

Class diagrams and architectural design Class diagrams and architectural design Perdita Stevens School of Informatics University of Edinburgh More unified modelling language We saw use case diagrams, which are part of UML, the Unified Modelling

More information

SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay. Lecture #10 Process Modelling DFD, Function Decomp (Part 2)

SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay. Lecture #10 Process Modelling DFD, Function Decomp (Part 2) SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay Lecture #10 Process Modelling DFD, Function Decomp (Part 2) Let us continue with the data modeling topic. So far we have seen

More information

administrivia today UML start design patterns Tuesday, September 28, 2010

administrivia today UML start design patterns Tuesday, September 28, 2010 administrivia Assignment 2? promise to get past assignment 1 back soon exam on monday review slides are posted your responsibility to review covers through last week today UML start design patterns 1 Unified

More information

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class CS112 Lecture: Defining Classes Last revised 2/3/06 Objectives: 1. To describe the process of defining an instantiable class Materials: 1. BlueJ SavingsAccount example project 2. Handout of code for SavingsAccount

More information

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes 5.1 What is UML? The Unified Modelling Language is a standard graphical language

More information

Unified Modeling Language

Unified Modeling Language Unified Modeling Language Modeling Applications using Language Mappings Programmer s Reference Manual How to use this Reference Card: The consists of a set of fundamental modeling elements which appear

More information

OBJECT ORİENTATİON ENCAPSULATİON

OBJECT ORİENTATİON ENCAPSULATİON OBJECT ORİENTATİON Software development can be seen as a modeling activity. The first step in the software development is the modeling of the problem we are trying to solve and building the conceptual

More information

Credit where Credit is Due. Lecture 4: Fundamentals of Object Technology. Goals for this Lecture. Real-World Objects

Credit where Credit is Due. Lecture 4: Fundamentals of Object Technology. Goals for this Lecture. Real-World Objects Lecture 4: Fundamentals of Object Technology Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Credit where Credit is Due Some material presented in this lecture

More information

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch Class diagrams Modeling with UML Chapter 2, part 2 CS 4354 Summer II 2015 Jill Seaman Used to describe the internal structure of the system. Also used to describe the application domain. They describe

More information

CS112 Lecture: Defining Instantiable Classes

CS112 Lecture: Defining Instantiable Classes CS112 Lecture: Defining Instantiable Classes Last revised 2/3/05 Objectives: 1. To describe the process of defining an instantiable class 2. To discuss public and private visibility modifiers. Materials:

More information

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin Chapter 10 Object-Oriented Analysis and Modeling Using the UML McGraw-Hill/Irwin Copyright 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Objectives 10-2 Define object modeling and explain

More information

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING Wednesady 23 rd March 2016 Afternoon Answer any FOUR questions out of SIX. All

More information

Principles of Software Construction: Objects, Design and Concurrency. Just enough UML. toad

Principles of Software Construction: Objects, Design and Concurrency. Just enough UML. toad Principles of Software Construction: Objects, Design and Concurrency Just enough UML 15-214 toad Christian Kästner Charlie Garrod School of Computer Science With slides from Klaus Ostermann Learning Goals

More information

LABORATORY 1 REVISION

LABORATORY 1 REVISION UTCN Computer Science Department Software Design 2012/2013 LABORATORY 1 REVISION ================================================================== I. UML Revision This section focuses on reviewing the

More information

SOFTWARE DESIGN COSC 4353 / Dr. Raj Singh

SOFTWARE DESIGN COSC 4353 / Dr. Raj Singh SOFTWARE DESIGN COSC 4353 / 6353 Dr. Raj Singh UML - History 2 The Unified Modeling Language (UML) is a general purpose modeling language designed to provide a standard way to visualize the design of a

More information

Object-Oriented and Classical Software Engineering

Object-Oriented and Classical Software Engineering Slide 16.1 Object-Oriented and Classical Software Engineering Seventh Edition, WCB/McGraw-Hill, 2007 Stephen R. Schach srs@vuse.vanderbilt.edu CHAPTER 16 Slide 16.2 MORE ON UML 1 Chapter Overview Slide

More information

Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page:

Lecturer: Sebastian Coope Ashton Building, Room G.18   COMP 201 web-page: Lecturer: Sebastian Coope Ashton Building, Room G.18 E-mail: coopes@liverpool.ac.uk COMP 201 web-page: http://www.csc.liv.ac.uk/~coopes/comp201 Lecture 19 Essentials of Class Models 1 On Naming classes

More information

Basic Structural Modeling. Copyright Joey Paquet,

Basic Structural Modeling. Copyright Joey Paquet, Basic Structural Modeling Copyright Joey Paquet, 2000 1 Part I Classes Copyright Joey Paquet, 2000 2 Classes Description of a set of objects sharing the same attributes, operations and semantics Abstraction

More information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Lecture 14: Design Workflow Department of Computer Engineering Sharif University of Technology 1 UP iterations and workflow Workflows Requirements Analysis Phases Inception Elaboration

More information

Unified Modeling Language (UML)

Unified Modeling Language (UML) Appendix H Unified Modeling Language (UML) Preview The Unified Modeling Language (UML) is an object-oriented modeling language sponsored by the Object Management Group (OMG) and published as a standard

More information

Understanding and Exploring Memory Hierarchies

Understanding and Exploring Memory Hierarchies Understanding and Exploring Memory Hierarchies Issued : Thursday 27th January 2011 Due : Friday 11th March 2011 at 4.00pm (at the ITO) This assignment represents the total practical component of the Computer

More information

SOME TYPES AND USES OF DATA MODELS

SOME TYPES AND USES OF DATA MODELS 3 SOME TYPES AND USES OF DATA MODELS CHAPTER OUTLINE 3.1 Different Types of Data Models 23 3.1.1 Physical Data Model 24 3.1.2 Logical Data Model 24 3.1.3 Conceptual Data Model 25 3.1.4 Canonical Data Model

More information

CSE 403: Software Engineering, Spring courses.cs.washington.edu/courses/cse403/15sp/ UML Class Diagrams. Emina Torlak

CSE 403: Software Engineering, Spring courses.cs.washington.edu/courses/cse403/15sp/ UML Class Diagrams. Emina Torlak CSE 403: Software Engineering, Spring 2015 courses.cs.washington.edu/courses/cse403/15sp/ UML Class Diagrams Emina Torlak emina@cs.washington.edu Outline Designing classes Overview of UML UML class diagrams

More information

Chapter 2: The Object-Oriented Design Process

Chapter 2: The Object-Oriented Design Process Chapter 2: The Object-Oriented Design Process In this chapter, we will learn the development of software based on object-oriented design methodology. Chapter Topics From Problem to Code The Object and

More information

Object Oriented Software Development CIS Today: Object Oriented Analysis

Object Oriented Software Development CIS Today: Object Oriented Analysis Object Oriented Software Development CIS 50-3 Marc Conrad D104 (Park Square Building) Marc.Conrad@luton.ac.uk Today: Object Oriented Analysis The most single important ability in object oriented analysis

More information

The Essence of Object Oriented Programming with Java and UML. Chapter 2. The Essence of Objects. What Is an Object-Oriented System?

The Essence of Object Oriented Programming with Java and UML. Chapter 2. The Essence of Objects. What Is an Object-Oriented System? Page 1 of 21 Page 2 of 21 and identity. Objects are members of a class, and the attributes and behavior of an object are defined by the class definition. The Essence of Object Oriented Programming with

More information

Chapter No. 2 Class modeling CO:-Sketch Class,object models using fundamental relationships Contents 2.1 Object and Class Concepts (12M) Objects,

Chapter No. 2 Class modeling CO:-Sketch Class,object models using fundamental relationships Contents 2.1 Object and Class Concepts (12M) Objects, Chapter No. 2 Class modeling CO:-Sketch Class,object models using fundamental relationships Contents 2.1 Object and Class Concepts (12M) Objects, Classes, Class Diagrams Values and Attributes Operations

More information

LECTURE 3: SOFTWARE DESIGN. Software Engineering Mike Wooldridge

LECTURE 3: SOFTWARE DESIGN. Software Engineering Mike Wooldridge LECTURE 3: SOFTWARE DESIGN Mike Wooldridge 1 Design Computer systems are not monolithic: they are usually composed of multiple, interacting modules. Modularity has long been seen as a key to cheap, high

More information

S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A

S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A G R A M S ) WHAT IS CLASS DIAGRAM? A class diagram

More information

Safety Case Composition Using Contracts - Refinements based on Feedback from an Industrial Case Study

Safety Case Composition Using Contracts - Refinements based on Feedback from an Industrial Case Study Safety Case Composition Using Contracts - Refinements based on Feedback from an Industrial Case Study Jane Fenn and Richard Hawkins BAE SYSTEMS, Brough, UK Phil Williams General Dynamics (United Kingdom)

More information

M301: Software Systems & their Development. Unit 4: Inheritance, Composition and Polymorphism

M301: Software Systems & their Development. Unit 4: Inheritance, Composition and Polymorphism Block 1: Introduction to Java Unit 4: Inheritance, Composition and Polymorphism Aims of the unit: Study and use the Java mechanisms that support reuse, in particular, inheritance and composition; Analyze

More information

Software Service Engineering

Software Service Engineering Software Service Engineering Lecture 4: Unified Modeling Language Doctor Guangyu Gao Some contents and notes selected from Fowler, M. UML Distilled, 3rd edition. Addison-Wesley Unified Modeling Language

More information

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch Class diagrams Modeling with UML Chapter 2, part 2 CS 4354 Summer II 2014 Jill Seaman Used to describe the internal structure of the system. Also used to describe the application domain. They describe

More information

Unified Modeling Language (UML) Class Diagram

Unified Modeling Language (UML) Class Diagram 1 / 10 Unified Modeling Language (UML) Class Diagram Miaoqing Huang University of Arkansas Spring 2010 2 / 10 Outline 1 2 3 / 10 Class Diagram Class diagrams show the static structure of the classes that

More information

1: Introduction to Object (1)

1: Introduction to Object (1) 1: Introduction to Object (1) 김동원 2003.01.20 Overview (1) The progress of abstraction Smalltalk Class & Object Interface The hidden implementation Reusing the implementation Inheritance: Reusing the interface

More information

SE 1: Software Requirements Specification and Analysis

SE 1: Software Requirements Specification and Analysis SE 1: Software Requirements Specification and Analysis Lecture 9: UML Class (Concept), Object, Communication Diagrams Nancy Day, Davor Svetinović http://www.student.cs.uwaterloo.ca/ cs445/winter2006 uw.cs.cs445

More information

Software Engineering I (02161)

Software Engineering I (02161) Software Engineering I (02161) Week 2: Class diagrams part 1 Hubert Baumeister Informatics and Mathematical Modelling Technical University of Denmark Spring 2010 c 2010 H. Baumeister (IMM) Software Engineering

More information

UML & OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 3 08/30/2011

UML & OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 3 08/30/2011 UML & OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 3 08/30/2011 1 Goals of the Lecture Review the material in Chapter 2 of the Textbook Cover key parts of the UML notation

More information

UML Tutorial. Unified Modeling Language UML Tutorial

UML Tutorial. Unified Modeling Language UML Tutorial UML Tutorial Unified Modeling Language UML Tutorial A Unified Modeling Language is a language for specifying, constructing, visualizing and documenting the software system and its components. UML is a

More information

EINDHOVEN UNIVERSITY OF TECHNOLOGY

EINDHOVEN UNIVERSITY OF TECHNOLOGY EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics & Computer Science Exam Programming Methods, 2IP15, Wednesday 17 April 2013, 09:00 12:00 TU/e THIS IS THE EXAMINER S COPY WITH (POSSIBLY INCOMPLETE)

More information

A4 Explain how the Visitor design pattern works (4 marks)

A4 Explain how the Visitor design pattern works (4 marks) COMP61532 exam Performance feedback Original marking scheme in bold, additional comments in bold italic. Section A In general the level of English was poor, spelling and grammar was a problem in most cases.

More information

Class modelling (part 2)

Class modelling (part 2) Class modelling (part 2) Fabrizio Maria Maggi Institute of Computer Science (these slides are derived from the book Object-oriented modeling and design with UML ) Qualified Associations What is the meaning

More information

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects. Class Diagrams UML Class Diagram Classes consist of the class name written in BOLD features attributes and methods user-defined constraints Note that class diagrams contain only classes, not objects. Class

More information

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT. Object Oriented Programming

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT. Object Oriented Programming BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT Object Oriented Programming Examiner s Report March 2017 A1. a) Explain what is meant by the following terms:

More information

Introducing the UML Eng. Mohammed T. Abo Alroos

Introducing the UML Eng. Mohammed T. Abo Alroos Introducing the UML Eng. Mohammed T. Abo Alroos Islamic University of Gaza Introduction to the UML: The UML stands for Unified Modeling Language. It was released in 1997 as a method to diagram software

More information

Chapter 6 Introduction to Defining Classes

Chapter 6 Introduction to Defining Classes Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of

More information

CPS122 Lecture: Detailed Design and Implementation

CPS122 Lecture: Detailed Design and Implementation CPS122 Lecture: Detailed Design and Implementation Objectives: Last revised March 3, 2017 1. To introduce the use of a complete UML class box to document the name, attributes, and methods of a class 2.

More information

High Performance Computing Prof. Matthew Jacob Department of Computer Science and Automation Indian Institute of Science, Bangalore

High Performance Computing Prof. Matthew Jacob Department of Computer Science and Automation Indian Institute of Science, Bangalore High Performance Computing Prof. Matthew Jacob Department of Computer Science and Automation Indian Institute of Science, Bangalore Module No # 09 Lecture No # 40 This is lecture forty of the course on

More information

CAMERA User s Guide. They are most easily launched from the main menu application. To do this, all the class files must reside in the same directory.

CAMERA User s Guide. They are most easily launched from the main menu application. To do this, all the class files must reside in the same directory. CAMERA User s Guide 1 Quick Start CAMERA is a collection of concise, intuitive and visually inspiring workbenches for cache mapping schemes and virtual memory. The CAMERA workbenches are standalone applications

More information

Cmpt 135 Assignment 2: Solutions and Marking Rubric Feb 22 nd 2016 Due: Mar 4th 11:59pm

Cmpt 135 Assignment 2: Solutions and Marking Rubric Feb 22 nd 2016 Due: Mar 4th 11:59pm Assignment 2 Solutions This document contains solutions to assignment 2. It is also the Marking Rubric for Assignment 2 used by the TA as a guideline. The TA also uses his own judgment and discretion during

More information

Class modelling (part 2)

Class modelling (part 2) Class modelling (part 2) Fabrizio Maria Maggi Institute of Computer Science (these slides are derived from the book Object-oriented modeling and design with UML ) Qualified Associations What is the meaning

More information

Question Sheet There are a number of criticisms to UML. List a number of these criticisms.

Question Sheet There are a number of criticisms to UML. List a number of these criticisms. Question Sheet 1 Name: ID: These questions do not have a formal, definitive answer. They are meant to be food for thoughts. Feel free to seek answers on browsing the Internet, talking to other software

More information

CPS221 Lecture: Threads

CPS221 Lecture: Threads Objectives CPS221 Lecture: Threads 1. To introduce threads in the context of processes 2. To introduce UML Activity Diagrams last revised 9/5/12 Materials: 1. Diagram showing state of memory for a process

More information

UNIT 5 - UML STATE DIAGRAMS AND MODELING

UNIT 5 - UML STATE DIAGRAMS AND MODELING UNIT 5 - UML STATE DIAGRAMS AND MODELING UML state diagrams and modeling - Operation contracts- Mapping design to code UML deployment and component diagrams UML state diagrams: State diagrams are used

More information

What is a Class Diagram? A diagram that shows a set of classes, interfaces, and collaborations and their relationships

What is a Class Diagram? A diagram that shows a set of classes, interfaces, and collaborations and their relationships Class Diagram What is a Class Diagram? A diagram that shows a set of classes, interfaces, and collaborations and their relationships Why do we need Class Diagram? Focus on the conceptual and specification

More information

What is a Class Diagram? Class Diagram. Why do we need Class Diagram? Class - Notation. Class - Semantic 04/11/51

What is a Class Diagram? Class Diagram. Why do we need Class Diagram? Class - Notation. Class - Semantic 04/11/51 What is a Class Diagram? Class Diagram A diagram that shows a set of classes, interfaces, and collaborations and their relationships Why do we need Class Diagram? Focus on the conceptual and specification

More information

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects. Class Diagrams UML Class Diagram Classes consist of the class name written in BOLD features attributes and methods user defined constraints Note that class diagrams contain only classes, not objects. Class

More information

Object-Oriented Systems Analysis and Design Using UML

Object-Oriented Systems Analysis and Design Using UML 10 Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design, 8e Kendall & Kendall Copyright 2011 Pearson Education, Inc. Publishing as Prentice Hall Learning Objectives Understand

More information

E-R Model. Hi! Here in this lecture we are going to discuss about the E-R Model.

E-R Model. Hi! Here in this lecture we are going to discuss about the E-R Model. E-R Model Hi! Here in this lecture we are going to discuss about the E-R Model. What is Entity-Relationship Model? The entity-relationship model is useful because, as we will soon see, it facilitates communication

More information

The goal of the Pangaea project, as we stated it in the introduction, was to show that

The goal of the Pangaea project, as we stated it in the introduction, was to show that Chapter 5 Conclusions This chapter serves two purposes. We will summarize and critically evaluate the achievements of the Pangaea project in section 5.1. Based on this, we will then open up our perspective

More information

ACS-3913 Ron McFadyen 1. UML Notation for Class diagrams Object diagrams

ACS-3913 Ron McFadyen 1. UML Notation for Class diagrams Object diagrams ACS-3913 Ron McFadyen 1 UML Notation for Class diagrams Object diagrams Class Diagram ACS-3913 Ron McFadyen 2 A class diagram begins as a conceptual or analysis class model and evolves to a design class

More information

MSO Analysis & UML. Hans Philippi (based on the course slides of Wouter Swierstra) August 24, Analysis & UML 1 / 56

MSO Analysis & UML. Hans Philippi (based on the course slides of Wouter Swierstra) August 24, Analysis & UML 1 / 56 MSO Analysis & UML Hans Philippi (based on the course slides of Wouter Swierstra) August 24, 2018 Analysis & UML 1 / 56 Recap: Last lectures How can I manage the process of constructing complex software?

More information

Alignment of Business and IT - ArchiMate. Dr. Barbara Re

Alignment of Business and IT - ArchiMate. Dr. Barbara Re Alignment of Business and IT - ArchiMate Dr. Barbara Re What is ArchiMate? ArchiMate is a modelling technique ("language") for describing enterprise architectures. It presents a clear set of concepts within

More information

Recalling the definition of design as set of models let's consider the modeling of some real software.

Recalling the definition of design as set of models let's consider the modeling of some real software. Software Design and Architectures SE-2 / SE426 / CS446 / ECE426 Lecture 3 : Modeling Software Software uniquely combines abstract, purely mathematical stuff with physical representation. There are numerous

More information

Lecture 34 SDLC Phases and UML Diagrams

Lecture 34 SDLC Phases and UML Diagrams That Object-Oriented Analysis and Design Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology-Kharagpur Lecture 34 SDLC Phases and UML Diagrams Welcome

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

More information

4.1 Introduction Programming preliminaries Constructors Destructors An example... 3

4.1 Introduction Programming preliminaries Constructors Destructors An example... 3 Department of Computer Science Tackling Design Patterns Chapter 4: Factory Method design pattern Copyright c 2016 by Linda Marshall and Vreda Pieterse. All rights reserved. Contents 4.1 Introduction.................................

More information

6.001 Notes: Section 6.1

6.001 Notes: Section 6.1 6.001 Notes: Section 6.1 Slide 6.1.1 When we first starting talking about Scheme expressions, you may recall we said that (almost) every Scheme expression had three components, a syntax (legal ways of

More information

OBJECT ORIENTED SYSTEM DEVELOPMENT Software Development Dynamic System Development Information system solution Steps in System Development Analysis

OBJECT ORIENTED SYSTEM DEVELOPMENT Software Development Dynamic System Development Information system solution Steps in System Development Analysis UNIT I INTRODUCTION OBJECT ORIENTED SYSTEM DEVELOPMENT Software Development Dynamic System Development Information system solution Steps in System Development Analysis Design Implementation Testing Maintenance

More information

Design Engineering. Dr. Marouane Kessentini Department of Computer Science

Design Engineering. Dr. Marouane Kessentini Department of Computer Science Design Engineering Dr. Marouane Kessentini Department of Computer Science 1 Design Starts mostly from/with requirements (evolving mostly from functionalities and other non functional characteristics) How

More information

Practical UML - A Hands-On Introduction for Developers

Practical UML - A Hands-On Introduction for Developers Practical UML - A Hands-On Introduction for Developers By: Randy Miller (http://gp.codegear.com/authors/edit/661.aspx) Abstract: This tutorial provides a quick introduction to the Unified Modeling Language

More information

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD TM : ,

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD TM : , Course Code : MCS-032 Course Title : Object Oriented Analysis and Design Assignment Number : MCA (3)/032/Assign/2014-15 Assignment Marks : 100 Weightage : 25% Last Dates for Submission : 15th October,

More information

Domain Engineering And Variability In The Reuse-Driven Software Engineering Business.

Domain Engineering And Variability In The Reuse-Driven Software Engineering Business. OBM 7 -draft 09/02/00 1 Domain Engineering And Variability In The Reuse-Driven Software Engineering Business. Martin L. Griss, Laboratory Scientist, Hewlett-Packard Laboratories, Palo Alto, CA. Effective

More information

OO is considered to be supported in three points which are usually symbolized as the three vertexes of a triangle: Encapsulació i ocultació

OO is considered to be supported in three points which are usually symbolized as the three vertexes of a triangle: Encapsulació i ocultació Object Orientation Its origin is placed at the beginning of the 70 s in a friendly environment project that Xerox Company developed in Palo lto with a team made up of lan Kay, dele Goldberg and Dan Ingalls.

More information

Authors: Andrei Kapustin, Vadim Chirikov, Marina Farr Cybernetic Intelligence GmbH, Zug, Switzerland Requirement analysis: Methodology

Authors: Andrei Kapustin, Vadim Chirikov, Marina Farr Cybernetic Intelligence GmbH, Zug, Switzerland Requirement analysis: Methodology Authors: Andrei Kapustin, Vadim Chirikov, Marina Farr Cybernetic Intelligence GmbH, Zug, Switzerland Requirement analysis: Methodology P-RAM-2002-10-1-0 September 10, 2002 Contents CONTENTS...2 1 OVERVIEW...4

More information

The UML Extension Mechanisms

The UML Extension Mechanisms Jasmine Farhad Dept of Computer Science University College London 13-Dec-02 The UML Extension Mechanisms Introduction There is an important need for organisations to evolve in today s market. This has

More information

An Integrated Approach to Documenting Requirements with the Rational Tool Suite

An Integrated Approach to Documenting Requirements with the Rational Tool Suite Copyright Rational Software 2002 http://www.therationaledge.com/content/dec_02/t_documentreqs_kd.jsp An Integrated Approach to Documenting Requirements with the Rational Tool Suite by Kirsten Denney Advisor

More information

Heuristic Evaluation of Covalence

Heuristic Evaluation of Covalence Heuristic Evaluation of Covalence Evaluator #A: Selina Her Evaluator #B: Ben-han Sung Evaluator #C: Giordano Jacuzzi 1. Problem Covalence is a concept-mapping tool that links images, text, and ideas to

More information

Computer Aided Draughting and Design: Graded Unit 1

Computer Aided Draughting and Design: Graded Unit 1 Higher National Graded Unit Specification General Information for Centres This Graded Unit has been validated as part of the HNC Computer Aided Draughting and Design (CADD) award. Centres are required

More information

1 OBJECT-ORIENTED ANALYSIS

1 OBJECT-ORIENTED ANALYSIS UML and Patterns.book Page 3 Sunday, August 9, 200 2:50 PM Chapter OBJECT-ORIENTED ANALYSIS AND DESIGN The shift of focus (to patterns) will have a profound and enduring effect on the way we write programs.

More information

A Java Execution Simulator

A Java Execution Simulator A Java Execution Simulator Steven Robbins Department of Computer Science University of Texas at San Antonio srobbins@cs.utsa.edu ABSTRACT This paper describes JES, a Java Execution Simulator that allows

More information

The first program: Little Crab

The first program: Little Crab Chapter 2 The first program: Little Crab topics: concepts: writing code: movement, turning, reacting to the screen edges source code, method call, parameter, sequence, if-statement In the previous chapter,

More information

Chapter 1: Principles of Programming and Software Engineering

Chapter 1: Principles of Programming and Software Engineering Chapter 1: Principles of Programming and Software Engineering Data Abstraction & Problem Solving with C++ Fifth Edition by Frank M. Carrano Software Engineering and Object-Oriented Design Coding without

More information

Software Engineering Lab Manual

Software Engineering Lab Manual Kingdom of Saudi Arabia Ministry Education Prince Sattam Bin Abdulaziz University College of Computer Engineering and Sciences Department of Computer Science Software Engineering Lab Manual 1 Background:-

More information

Chapter 9. Software Testing

Chapter 9. Software Testing Chapter 9. Software Testing Table of Contents Objectives... 1 Introduction to software testing... 1 The testers... 2 The developers... 2 An independent testing team... 2 The customer... 2 Principles of

More information

CSSE2002/7023 The University of Queensland

CSSE2002/7023 The University of Queensland CSSE2002 / CSSE7023 Semester 1, 2016 Assignment 1 Goal: The goal of this assignment is to gain practical experience with data abstraction, unit testing and using the Java class libraries (the Java 8 SE

More information

UML REFERENCE SHEETS. 2013, 2014 Michael Marking; all rights reserved, including moral rights. Web site:

UML REFERENCE SHEETS. 2013, 2014 Michael Marking; all rights reserved, including moral rights. Web site: UML Reference Sheets 2013, 2014 Michael Marking; all rights reserved, including moral rights. Web site: http://www.tatanka.com/ Revision Information This document was last revised 2014.03.02. The current

More information

UNIT II Requirements Analysis and Specification & Software Design

UNIT II Requirements Analysis and Specification & Software Design UNIT II Requirements Analysis and Specification & Software Design Requirements Analysis and Specification Many projects fail: because they start implementing the system: without determining whether they

More information

Notation Part 1. Object Orientated Analysis and Design. Benjamin Kenwright

Notation Part 1. Object Orientated Analysis and Design. Benjamin Kenwright Notation Part 1 Object Orientated Analysis and Design Benjamin Kenwright Version Control Example Team Princess 3 Members 3 Github Users e.g., Elva1997, michelle0924hhx, KimJaeHwang Each user can join and

More information

Software Paradigms (Lesson 3) Object-Oriented Paradigm (2)

Software Paradigms (Lesson 3) Object-Oriented Paradigm (2) Software Paradigms (Lesson 3) Object-Oriented Paradigm (2) Table of Contents 1 Reusing Classes... 2 1.1 Composition... 2 1.2 Inheritance... 4 1.2.1 Extending Classes... 5 1.2.2 Method Overriding... 7 1.2.3

More information

CSCU9T4: Managing Information

CSCU9T4: Managing Information CSCU9T4: Managing Information CSCU9T4 Spring 2016 1 The Module Module co-ordinator: Dr Gabriela Ochoa Lectures by: Prof Leslie Smith (l.s.smith@cs.stir.ac.uk) and Dr Nadarajen Veerapen (nve@cs.stir.ac.uk)

More information

Inheritance and Substitution (Budd chapter 8, 10)

Inheritance and Substitution (Budd chapter 8, 10) Inheritance and Substitution (Budd chapter 8, 10) 1 2 Plan The meaning of inheritance The syntax used to describe inheritance and overriding The idea of substitution of a child class for a parent The various

More information

C++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace

C++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace C++ Style Guide 1.0 General The purpose of the style guide is not to restrict your programming, but rather to establish a consistent format for your programs. This will help you debug and maintain your

More information

COSC 3351 Software Design. An Introduction to UML (I)

COSC 3351 Software Design. An Introduction to UML (I) COSC 3351 Software Design An Introduction to UML (I) This lecture contains material from: http://wps.prenhall.com/esm_pfleeger_softengtp_2 http://sunset.usc.edu/classes/cs577a_2000/lectures/05/ec-05.ppt

More information

Design First ITS Instructor Tool

Design First ITS Instructor Tool Design First ITS Instructor Tool The Instructor Tool allows instructors to enter problems into Design First ITS through a process that creates a solution for a textual problem description and allows for

More information