Workshop 8 Review of Module MCT 619 (Workshop 8)

Slides:



Advertisements
Similar presentations
Object Oriented Programming
Advertisements

OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
Inheritance Inheritance Reserved word protected Reserved word super
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
Chapter 10 Classes Continued
Chapter 7 - Generalization/Specialization and Inheritance1 Chapter 7 Generalization/Specialization and Inheritance.
Copyright © 2003 ProsoftTraining. All rights reserved. Sun Certified Java Programmer Exam Preparation Guide.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
CISC6795: Spring Object-Oriented Programming: Polymorphism.
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
An Object-Oriented Approach to Programming Logic and Design
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
CSE 301 Exam Revision Lecture
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
Data Structures Using Java1 Chapter 2 Inheritance and Exception Handling.
Object Oriented Software Development
 All calls to method toString and earnings are resolved at execution time, based on the type of the object to which currentEmployee refers.  Known as.
8. Inheritance “Is-a” Relationship. Topics Creating Subclasses Overriding Methods Class Hierarchies Abstract Class Inheritance and GUIs The Timer Class.
Object Oriented Programming
Introduction to Object-Oriented Programming Lesson 2.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
Notices Assn 2 is due tomorrow, 7pm. Moodle quiz next week – written in the lab as before. Everything up to and including today’s lecture: Big Topics are.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
JAVA TRAINING IN NOIDA. JAVA Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Java Thread Programming
Object Oriented Programming in
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Modern Programming Tools And Techniques-I
Object Oriented Programming
INF230 Basics in C# Programming
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
Objects as a programming concept
Object-Oriented Analysis and Design
EE2E1. JAVA Programming Revision Lecture.
Chapter 11 Object-Oriented Design
Java Programming Language
Lecture 30 Revision Lecture 1
About the Presentations
Object-Orientated Programming
Week 4 Object-Oriented Programming (1): Inheritance
Chap 7. Building Java Graphical User Interfaces
CS360 Windows Programming
Inheritance Often, software encapsulates multiple concepts for which some attributes/behaviors overlap E.g. A computer (role-playing) game has: Monsters:
Inheritance B.Ramamurthy 11/7/2018 B.Ramamurthy.
Lecture 23 Polymorphism Richard Gesick.
CISC124 Assignment 4 on Inheritance due next Monday, the 12th at 7pm.
Programming in Java Text Books :
Java Programming Language
Advanced Programming Behnam Hatami Fall 2017.
More Object-Oriented Programming
Class Diagrams.
Overriding Methods & Class Hierarchies
Abstract Classes and Interfaces
Basic OOP Concepts and Terms
Introducing Java.
UML  UML stands for Unified Modeling Language. It is a standard which is mainly used for creating object- oriented, meaningful documentation models for.
Presentation transcript:

Workshop 8 Review of Module MCT 619 (Workshop 8) This is the final presentation of the Object Oriented Programming module. In it, we will review some of the main points that were covered in each week of the module. Please note, however, that this review is not (and cannot be) comprehensive. For a thorough appreciation of what you are expected to have achieved in your studies of this module, you should refer to the overall module learning objectives and the individual workshop learning objectives as laid out in the Module Handbook. Naturally, you should also review the presentations from each week and study all of the sample programs again. Review of Module MCT 619 (Workshop 8) MCT 619: Object Oriented Programming MScSED

Workshop 1 Part 1: Overview of OOP Classes and objects are the defining features of OOP: More high-level than procedures/functions Greater intellectual manageability Improve software quality and design We have studied Java, a popular OOP language Developed by Sun in mid 1990s; popularised by Web Have discussed its principal characteristics The JVM provides platform independence Write once, run anywhere There are three Java Editions: Micro, Standard, Enterprise For development of different types of application. In the first lecture, we took a high-level look at the general features of OOP languages and Java in particular.

Workshop 1 Part 2: Beginning Java Programming We learned about: What the basic structure of a Java program is How to write elementary Java programs The fundamentals of using the Eclipse IDE What debugging is about The fundamentals of debugging in Eclipse In Workshop 1 Part 2, we considered the practicalities of writing, compiling and running simple Java programs.

Workshop 1 Part 3: Fundamentals of Java Syntax Details of Java’s syntax and how it relates to that of C: Fundamental data types Literal and Named constants Type conversion between numeric types and between Strings and numeric types Scope of variables Operators: arithmetic, relational, Boolean, assignment and some others In Workshop 1 Part 3, we examined the details of Java syntax, along the way noting the similarities and differences with C.

Workshop 2 Part 1: Control Structures We learned about: Decisions: if/else, switch Repetition: for, while, do-while, break, continue Methods must be defined within a class In Workshop 2 Part 1, we studied how to construct decisions, repetition and methods in Java.

Workshop 2 Part 2: Object-Based Programming We discussed: How OOP relates to how we think about the real world What classes, objects and references are How to display the design of classes and objects graphically using UML How to define classes in Java, create objects of those classes and work with references to them What the differences are between public and non- public classes How to define one or more constructors for a class, which are used to initialise objects’ properties In Workshop 2 Part 2, we began our study of object-oriented programming, starting with how to define classes and create objects of those classes.

Workshop 2 Part 2: Object-Based Programming continued.. Java has four visibility modifiers: public, protected, ‘friendly’, private It is a common programming convention to write getters and setters where the class design requires access/modification of properties Static member variables represent class-wide properties, and static member methods are needed to work with them We also examined a substantial example of object- based programming, defining a Time class We studied the fundamentals of defining classes and working with them.

Workshop 3 Part 1: Applets We learned: The distinction between applications and applets, as well as the main characteristics of applets How to develop simple graphical applets How to write HTML code to load an applet How to run an applet in a browser or appletviewer How to pass attribute values from a HTML file to an applet In Workshop 3 Part 1, we discussed the characteristics of Applets and how to develop them.

Workshop 3 Part 2: Graphical User Interfaces (GUI) We learned that: There are swing classes for all standard GUI components In an applet, components are typically created as private class members and then added to the content pane When the user interacts with a component, an Event object is created and an appropriate EventListener associated with the component can respond to it GUI builders greatly simplify the contsruction of event-driven applets and applications JavaBeans are reusable software components that can be visually composed into applications and other types of program In Workshop 3 Part 2, we learned about how to develop graphical user interfaces in Java and the basics of event-driven programming.

Workshop 4 Part 1: Classes as Building-Blocks I We learned that: Modularity is achieved in Java through the use of methods, classes and packages Encapsulation allows us to view objects in terms of their behaviours, not their internal structure We can derive subclasses from parent classes using inheritance, which is a powerful form of code re-use Subclasses can provide method definitions that override those in the parent class that have identical method signatures In the two parts of Workshop 4, we moved onto more high-level OOP topics. You learned about the concepts of modularity and encapsulation, and also how to re-use existing classes to construct new classes, using the mechanisms of inheritance and composition. Finally, we discussed the basic principles of object oriented design.

Workshop 4 Part 2: Classes as Building-Blocks II The Substitutability Principle is a good way of determining whether your design makes appropriate use of inheritance Java has a single-rooted class hierarchy, with Object at the root; Object defines specific methods that all classes inherit Composition involves defining a class with members that themselves are classes Inheritance implies an IS-A relationship between classes; composition implies a HAS-A relationship Java has automatic garbage collection Good object-oriented design requires domain knowledge, careful thought and experience Part 2 continued directly from Part 1.

Workshop 5 Part 1: Polymorphism and Worked Example We discussed how: Polymorphism permits related classes having consistent programming interfaces but producing different behaviours specific to themselves Polymorphism is enabled through dynamic binding of methods You may not create instances of an abstract class; it represents the commonality between derived concrete classes There are specific rules for casting references An interface specifies a list of pure abstract methods that any class implementing it must define; a class can implement multiple interfaces instanceOf, getClass and getName are for run-time type identification In Workshop 5 Part 1, you learned about Polymorphism, along with the related concepts of abstract classes and interfaces. We then moved on to studying a substantial worked example (the Payroll system) that demonstrates many of the concepts we have seen in this and the past two workshops.

Workshop 5 Part 2: Worked Example Cont'd; Exceptions In the Payroll example, you saw how to: Define a hierarchy of classes, some abstract Define constructors and override methods Use super to call parent's constructor and other methods Work polymorphically with objects in hierarchy In Exception Handling, you learned about: How exceptions can be used to handle recoverable errors How to catch or declare to respond to exceptions How to write try/catch/finally blocks What the difference is between checked and unchecked exceptions How to define your own Exception classes In Part 2, we concluded the Payroll example and then moved on to studying exception handling.

Workshop 6 Part 1: Arrays and Collections We learned that: An array is an ordered list of variables/ references, with fixed length, indexed from 0 Created using new keyword; square brackets [ ] to reference elements An array name is a reference like an object reference; its length is given by length property May be multi-dimensional and ragged; can use a sub-array reference to refer to section of full array Class java.util.Arrays has static methods for sorting, searching, comparing, etc. The Collections Framework is for managing many types of collection (including sets, lists and maps); it is comprised of Interfaces, Implementations and Algorithms The ArrayList class is the Collections class with features most similar to an ordinary array In this workshop, we learned about arrays. While the syntax is similar to that of C, many details of array creation and handling are different from C. As well as the standard array mechanism, the Java API includes an extensive Collections Framework, which provides much more sophisticated management and handling of collections such as arrays, lists and sets. The Collections Framework is a large topic; we looked only at an overview of it, and then we studied ArrayList, one of the popularly used collection classes in the Framework.

Workshop 6 Part 2: Files and Streams We discussed how: Java's procedures for file I/O are completely different from those of C There are several classes which may be daisy-chained for text I/O, and variations such as Formatter/Scanner Exception handling is important as many of the methods throw checked exceptions Object Serialisation is used for object storage and transfer Lightweight object persistence requires very little coding, but you can implement custom object serialisation if you wish The RandomAccessFile class has methods seek, skipBytes and getFilePointer The File class supports platform-independent file & folder operations In this lecture, we covered how to use Java's extensive input/output framework. As well as learning the basics of file reading and writing, you learned about how to serialise objects to and from files, how to work with random access files, and how to manage files and folders.

Workshop 7 Part 1: Multi-Threaded Programming I We learned that: Java achieves concurrency by supporting multiple threads of execution; threads are like 'lightweight processes‘ There are two ways to create a thread: implement Runnable or extend Thread The life-cycle of a thread involves five main states: new, runnable, waiting, timed waiting and terminated Multi-threaded programs may be used for many purposes, including responsive GUIs and applets with animation In this workshop (Parts 1 and 2), you learned how to develop programs with concurrency, which is the ability of a program to do more than one thing at a time and is an essential aspect of modern programming. As you found out, concurrency is achieved by having multiple threads of execution in our programs. We also discussed the distinction between processes and threads, what the life-cycle of a thread is, how to implement multi-threaded programs in Java, what synchronisation is, and what deadlocks are and how to avoid them.

Workshop 7 Part 2: Multi-Threaded Programming II Multiple threads often require synchronisation to ensure they do not try to read/change the same data in memory simultaneously Improper use of synchronisation can lead to deadlocks, as illustrated by the Dining Philosophers The producer/consumer problem demonstrates how bad synchronisation can result in deadlocks or race conditions Methods wait and notify are used to temporarily release locks so as to avoid deadlocks Workshop 7 Part 2 continued on directly from Part 1.

The End! This concludes this workshop and this module. Thank you for your attention and good luck with the final exam!