Lecture 1 Introduction to Software Construction

Slides:



Advertisements
Similar presentations
Programming Paradigms and languages
Advertisements

Object-Oriented Design – Key Concepts Version 1.1 of : added learning objectives CompSci 230 Software Construction.
Unified Modeling Language
1 Objects and ClassesStefan Kluth 1.6Objects and Classes 1.6What is an Object? 1.7Objects and Classes 1.8Object Interface, Class Inheritance, Polymorphism.
Introduction To System Analysis and Design
1 Classes Overview l Classes as Types l Declaring Instance Variables l Implementing Methods l Constructors l Accessor and Mutator Methods.
Fall 2007CS 225 Introduction to Software Design Chapter 1.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Object Oriented System Development with VB .NET
What is an object? Your dog, your desk, your television set, your bicycle. Real-world objects share two characteristics: They all have state and behavior;
Software Testing and Quality Assurance
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Lecture #4 Agenda Announcements Review Questions? Classes and objects UML class diagrams Creating.
Spring 2009CS 225 Introduction to Software Design Chapter 1.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Object-Oriented Analysis and Design
1 Pertemuan 6 Object Oriented Programming Matakuliah: T0053/Web Programming Tahun: 2006 Versi: 2.
Object Oriented Software Development
Lecture 1 Introduction to Software Construction
The Design Discipline.
Object-Oriented Programming Concepts
Centre for Computer Technology ICT115 Object Oriented Design and Programming Week 2 Intro to Classes Richard Salomon and Umesh Patel Centre for Information.
Comp 245 Data Structures Software Engineering. What is Software Engineering? Most students obtain the problem and immediately start coding the solution.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
CompSci 230 Software Construction Course Revision: Themes A, B & C S
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.
Introduction to Software Design Chapter 1. Chapter Objectives  To become familiar with the software challenge and the software life cycle  To understand.
Introduction To System Analysis and Design
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
The Java Programming Language
Centre for Computer Technology ICT214 Object Oriented Design and Programming Week 02 – Classes, Objects, Instances Richard Salomon and Umesh Patel Centre.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Overview The Basics – Python classes and objects Procedural vs OO Programming Entity modelling Operations / methods Program flow OOP Concepts and user-defined.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
CSCE 240 – Intro to Software Engineering Lecture 2.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
CompSci 230 S Software Construction Introduction to OOD.
Prof. Bhushan Trivedi Director GLS Institute of Computer Technology
The Object-Oriented Thought Process Chapter 03
CompSci 230 S Programming Techniques
CompSci 230 Software Construction
Objects as a programming concept
Names and Attributes Names are a key programming language feature
University of Central Florida COP 3330 Object Oriented Programming
Object-Oriented Analysis and Design
Objects as a programming concept
Unified Modeling Language
The Software Development Cycle
University of Central Florida COP 3330 Object Oriented Programming
Object-Orientated Programming
CompSci 230 Software Construction
Procedural Abstraction Object-Oriented Code
Computer Programming.
Component-Level Design
Introduction To System Analysis and Design PART 2
Teach A-Level Computer Science: Object-Oriented Programming in Python
Object Oriented Analysis and Design
Software Design Lecture : 15.
Review of Previous Lesson
Review of Previous Lesson
Dr. R Z Khan Handout-3 Classes
Lecture 10 Concepts of Programming Languages
Creating and Using Classes
The Software Development Cycle
Presentation transcript:

Lecture 1 Introduction to Software Construction

Overview In earlier courses, you learned how to write programs to solve small problems. In this course we teach programming “in the large”. Large software systems have many stakeholders. What will its users want? Can we describe user requirements, accurately and concisely? Large software systems are very complex. Can we describe the design of a complex software system, accurately and concisely? Can we be sure that a complex system will do what it is designed to do, and that it will not do anything unintended? In this course you will learn some incomplete answers to these difficult questions. I will also attempt to teach you how to “learn how to learn” the technical skills you will need in the future – as a competent computer professional.

Syllabus Four Themes: The object-oriented programming paradigm Object-orientation, object-oriented programming concepts and programming language constructs – because, for many important problems, OO design is a convenient way to express the problem and its solution in software. Frameworks Inversion of control, AWT/Swing and JUnit – because many important “sub- problems” have already been solved: these solutions should be re-used! Software quality Testing, inspection, documentation – because large teams are designing, implementing, debugging, maintaining, revising, and supporting complex software. Application-level concurrent programming Multithreading concepts, language primitives and abstractions – because even our laptops have multiple CPUs. Dual-core smartphones are now available...

Agenda & Reading Topics: Review (or learn for the first time?) What is Object-Oriented Programming? Classes & Objects Variables & Methods Introduction to OO Design A process of determining what the stakeholders require, designing a set of classes with objects which will meet these requirements, implementing, and delivering. Structure Diagrams: high-level design Use Cases: high-level requirements Other concerns: implementation, quality assurance

Software Design Communication: Planning: Modeling: Construction: identify stakeholders, find out what they want and need. Planning: list tasks, identify risks, obtain resources, define milestones, estimate schedule. Modeling: develop structure diagrams and use cases, maybe some other UML artifacts. Construction: implement the software, with assured quality. Deployment: deliver the software, then get feedback for possible revision. To learn more: R. Pressman, Software Engineering: A Practitioner’s Approach, 7th Ed., 2010, pp. 14- 15.

What is Object-Oriented Design? In OO design, a system is a collection of interacting objects. Each object should have simple attributes and behaviours. Each object should have simple relations to other objects. In procedural design, a system is a collection of basic blocks. Each basic block should have a simple effect on local and global variables. Basic blocks are linked by control- flow arcs: if/then/else, call/return, while/loop, for/loop, case, goto, … In data architecture, a system is a collection of data structures, with access and update methods. Each data structure should have simple relations to other data structures. object 3 object 2 object 4 object 1 Program

What is an Object? A building block for OO development Examples: Like objects in the world around us Objects have state and behaviour Examples: Dog State/field/attribute: name, colour, isHungry, … Behaviour: bark(), fetch(), eat(), … Bicycle State: gear, colour, … Behaviour: brake(), turn(), changeGear(), … VCR State: brand, colour, isOn … Behaviour: play(), stop(), rewind(), turnOn(), …

Classes & Objects Class Object A set of objects with shared behaviour and individual state Individual state: Data is stored with each instance, as an instance variable. Shared behaviour: Code is stored with the class object, as a method. Shared state may be stored with the class object, as a class variable. Object Objects are created from classes at runtime by instantiation usually with New. There may be zero, one, or many objects (instances) of a class. Instantiated objects are garbage-collected if no other user-defined object can reference them.

Imagine a world of communicating objects An object remembers things (i.e. it has a memory): its state. An object responds to messages it gets from other objects. It performs the method with the given parameters, then sends a response. An object that receives a strange message may throw an exception. Be careful! An object’s method may “ask for help” from other objects. It sends a message to an object, and waits for a response. A method may send a message to itself! This is called recursion. Be careful. Messages between objects Usually: method calls and method returns, sometimes exceptions.

Information Hiding The implementation details of a method should be of no concern to the sender of the message. If a JavaKid tells a JavaDog to fetch(), the dog might run across a busy street during its fetch(). Parameterised methods allow the senders to have more control over object behaviour. For example, a JavaDog might have a parameterised fetch() method: ball = dog.fetch(SAFELY); Note: in these lecture slides, the word “should” indicates an element of style. You should write Java code that is understandable to other Java programmers.

Example 1: Ball Attributes Constructor Methods Represent the internal state of an instance of this class. Constructor Creates the object Methods Implement the processing performed by or to an object, often updating its state. If there are read and write methods for an attribute x, these should be called getX() and setX(). You should learn Java’s conventions for capitalisation and naming. Example: Ball.java public class Ball { public final static int SIZE = 20; private int xPos; private int yPos; private Color color; public Ball(int x, int y, Color c) { xPos = x; yPos = y; color = c; } public void move(int deltaX, int deltaY) { xPos += deltaX; yPos += deltaY; public void paint(Graphics g) { g.setColor(color); g.fillOval(xPos,yPos,SIZE,SIZE);

Object Instantiation When a constructor method is called, a new instance is created. If a class definition doesn’t include a constructor method, the Java compiler inserts a default constructor with default initialisations. Ball b = new Ball( 10, 20, Color.Red ); Ball c = new Ball( 0, 10, Color.Blue ); b: Ball xPos = 10 yPos = 20 Color = Red c: Ball xPos = 0 yPos = 10 Color = Blue public class Class1 { private int x; // Note no explicit constructor public int increment() { ++x; } Class1 d = new Class1(); d: Class1 x = 0 // is this good code?