We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byFrancesca Buzby
Modified over 2 years ago
© Tomáš Kozel, Pavel Čech Programming I Pavel Čech Faculty of Informatics and Management University Hradec Kralove explorer.uhk.cz /pc/www
© Tomáš Kozel, Pavel Čech 2 Content Introduction into programming Object oriented modeling Object oriented programming Programming in Java
© Tomáš Kozel, Pavel Čech 3 Objectives Introduce students to OOP in Java Apply apply knowledge acquired in ALGD Use advanced tools for application development
© Tomáš Kozel, Pavel Čech 4 Resources McConnell:Rapid Development – Microsoft Press 1996 McConnell:Code Complete – Microsoft Press 1994 Electronic publications The Java Tutorial, Java SDK Documentation - Thinking in Java edition
© Tomáš Kozel, Pavel Čech 5 Tools Java 2 SDK – basic package for programming in Java Eclipse – IDE for programming in JAVA ArgoUML – CASE Tool for object oriented modeling in UML These tools can be downloaded from> (uid: student, pwd: prox) All tools a free
© Tomáš Kozel, Pavel Čech 6 Terminlogy Program = sequence of commands describing some action Process = program being executed (running) program Processor – device capable of executing a program Data – certain kind of objects, that are appropriately transformed by the program
© Tomáš Kozel, Pavel Čech 7 Terminology (cont.) Source code – programming code written in a certain programming language Target code – binary code, that is created by compilation of source code – is executable Byte code(Java) – intermediate code that is create by compilation but it is run by runtime environment (JRE, JVM) Library – group of files that contain subroutines and classes and that can be used in our program
© Tomáš Kozel, Pavel Čech 8 Terminology (cont.2) Data type – determines type and the size of value in variables. Indirectly determines the set of operations that can be applied to the value. Variable – “named” block of memory in RAM for storing values. The size of the memory block depends on the data type of the value. Constant – the same as variable but it is not allowed to changed the value (it is read only). The constant can be assigned value only once and that can be only read.
© Tomáš Kozel, Pavel Čech 9 Programming language the means of communication between computer and the programmer the means of describing an algorithm needs to be understandable for both sides Taxonomy Lower level programming lang. Higher level …
© Tomáš Kozel, Pavel Čech 10 Types of prog. lang. Structured Separation of data and operations Older by still commonly used In many cases faster and efficient C, Pascal, Basic,… Object oriented Modern Easily maintainable The code can be re-used Eiffel, Smalltalk, Java,... Hybrid Not strictly object oriented i.e. can also be structured (C++, Object Pascal - Delphi, Visual Basic...)
© Tomáš Kozel, Pavel Čech 11 Compiler =special kind of programs for conversion of source code into machine code Types Interpreter Compiler
© Tomáš Kozel, Pavel Čech 12 Interpreter source code output data Computer Interpreter input data
© Tomáš Kozel, Pavel Čech 13 Compiler developer’s computer source code input data output data user’s computer compiler target code
© Tomáš Kozel, Pavel Čech 14 The process of compilation Editor Compiler Linker (links program) OBJ code relative code Library Target code Source code Debugger
© Tomáš Kozel, Pavel Čech 15 Running program in Java Compilation environment Run-time environment Source code (.java) Java compiler Byte code (.class) Local or network transmission of byte code Class Loader + Verifier of byte code Java libraries Java Interpreter Just-In-Time compiler Runtime system OS HW Java Virtual Machine
© Tomáš Kozel, Pavel Čech 16 What is object … Objects real world - entities that can be found everywhere software – program entities that follow the rules of real world ones. By combination of sw. object we create object oriented programs (systems).
© Tomáš Kozel, Pavel Čech 17 Real world objects Have a name (object identity) Have properties (state) Do something (behavior)
© Tomáš Kozel, Pavel Čech 18 Where can we find objects? Thinking about a situation We can write some notes with description and processes in that situation. Noun can be objects. Verbs can be operations (behavior) of objects Objects that are not important when considering a given problem can be left out
© Tomáš Kozel, Pavel Čech 19 Object oriented programs (Alan Kay) 1. Everything is object. Objects stores data and we can ask for some services (performing an operation). 2. Program is a group of objects that comunicates (send messages = ask for services). 3. Each object has its own memory space and can consists of other objects. Complex objects can be divided into other objects. 4. Every object belongs to a class. 5. Every object of the same class has to understand the same messages and perform the same operations. Objects can belong into more classes through inheritance.
© Tomáš Kozel, Pavel Čech 20 Why use objects in programs? It is modern … They’re closer to reality Readable source code Advanced tools and languages Reusable Easily maintainable
© Tomáš Kozel, Pavel Čech 21 What objects can today? Behave Have properties Inherit from ancestors Adapt Communicate …
© Tomáš Kozel, Pavel Čech 22 Terminology revisited Object always something particular with identity called also instance (Trabant, Audi A6,...). Class type of objects, a group in which a set of objects belong. Describes general features common to all objects (instances) in a class (Car).
© Tomáš Kozel, Pavel Čech 23 UML.... tool ArgoUML Unified Modeling Language Graphical language for object modeling ClassObject MyFord:Car Car Color HP Go() Brake() Car attributes (data) methods (operations)
© Tomáš Kozel, Pavel Čech 24 Software objects have name (identity), state, behavior name is determined by identifier, state is described by attributes, behaviour is realized by methods
© Tomáš Kozel, Pavel Čech 25 Basic OOP principles Abstraction Encapsulation Inheritance Polymorphisms Communication (messages)Communication (messages) AssociationAssociation Aggregation (composition)Aggregation (composition)
© Tomáš Kozel, Pavel Čech 26 Abstraction = separation of important and unimportant aspects based on a given problem Example: Calculator from the point of view of the student Important aspects: Range and precision of numbers Number and types of operations Can be kept secret during the test Unimportant: Number of chips on a system board Type of processor Exact algorithm of every operation
© Tomáš Kozel, Pavel Čech 27 Encapsulation = data and operation forms a atomic whole that cannot be separated Data (properties, state) of object and operations are dependent and influence each other. Not all features of objects are propagated to outside (Information hidding) Data – attribures of an object Operation – methods of an object Example: An angry man (state) is more noisy (behavior) than the calm one.
© Tomáš Kozel, Pavel Čech 28 Information hiding Every object can have private elements (attributes, methods) than cannot be seen or influence from the outside of the object (Information hiding). These elements are hidden behind so called public interface. Example: state and properties of a man‘s intestines Public interface Private state „Doughnut“ diagram
© Tomáš Kozel, Pavel Čech 29 Communication (messaging) Objects communicate by sending messages. As a consequence of receiving a message some operation is performed (message passing = method invocation)
© Tomáš Kozel, Pavel Čech 30 Association = represents a general binary relation between two classes Each class in association has its role For each object with a role we can determine multiplicity (cardinality) of that relation Example: Class Student is in association with the class Faculty. The student „studies“ and the faculty is „studied by“. Multiplicity: Many students (n or *) can study only one faculty.
© Tomáš Kozel, Pavel Čech 31 Aggregation = special kind of association that represents the relation „part of“ Object can contain other objects. Such objects are created by aggregating other objects. If the use of part objects is exclusive in aggregation we talk about composition. Example: Composition: TV x Chip Aggregation: Student x Lab
© Tomáš Kozel, Pavel Čech 32 Association in UML FacultyStudent studuje 1..* 1 Association LabStudent TVTVChip Aggregation Composition
© Tomáš Kozel, Pavel Čech 33 Inheritance = ability of objects to inherit attributes and behavior from ancestors (it is so called object evolution) ie. that attributes and behavior can be further extended and modified Example: Parent -> Children Machine -> Vehicle -> Car
© Tomáš Kozel, Pavel Čech 34 Inheritance in UML MachineVehicleCarTruck
© Tomáš Kozel, Pavel Čech 35 Class attributes Attributes are common must be present for all objects of a particular class State of object is given by values of attributes Sometimes called data, properties Example: Color, Brand, horse power
© Tomáš Kozel, Pavel Čech 36 Class methods Specify behavior Sometimes called operation or services It is custom to hide attributes and use so called access method to set or retrieve values Access methods Selectors – reading/retrieving values Modifiers – setting/writing values
© Tomáš Kozel, Pavel Čech 37 Information hiding Rule: None of the attributes should be directly accessible from the outside world ->(Black Box) Attributes Method
PSSA Preparation. Question 1(no calculator) D Question 2 (no calculator)
NI LabVIEW Object-Oriented Programming ni.com/labviewzone.
Copyright © 2003 by Prentice Hall Computers: Tools for an Information Age Chapter 15 Programming and Languages: Telling the Computer What to Do.
Computer Science Department CPS235: Introduction1 Introduction to OOP.
By Waqas Over the many years the people have studied software-development approaches to figure out which approaches are quickest, cheapest, most.
Chapter 9: Using Classes and Objects. Understanding Class Concepts Types of classes – Classes that are only application programs with a Main() method.
Chapter 11: Models of Computation Invitation to Computer Science, C++ Version, Third Edition.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 Chapter 7 System Models.
1 Prof. Valter Bezerra Dantas
Time for a BREAK! You have 45 Minutes. Time Left 44.
Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 1 Embedded Computing.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 13 Slide 1 Application architectures.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 29Slide 1 Configuration management l Managing the products of system change l Objectives.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Fundamentals, Design, and Implementation, 9/e Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques.
Modeling Main issues: What do we want to build How do we write this down.
Chapter 11 Membrane Structure Essential Cell Biology Third Edition Copyright © Garland Science 2010.
1 Final and Abstract Classes. 2 Restricting Inheritance Parent Child Inherited capability.
1 Programming Language Concepts Chapter 3 Describing Syntax and Semantics.
10 Systems Analysis and Design in a Changing World, Fifth Edition.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 1 An Introduction to Visual Basic 2005.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 3 CPUs.
EU market situation for eggs and poultry Management Committee 20 October 2011.
Slide 5-1 Copyright © 2003 Pearson Education, Inc. Figure: Computer Science an overview EDITION 7 J. Glenn Brookshear.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
COMPUTER INTERFACES 1. The term interface means the link between the computer and the user; it refers to the means by which the user interacts with the.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
by D. Fisher (2 + 1) + 4 = 2 + (1 + 4) Associative Property of Addition 1.
Lecture 6: Software Design (Part I) Dr Valentina Plekhanova University of Sunderland, UK
10 Chapter 10: The Traditional Approach to Design Systems Analysis and Design in a Changing World, 3 rd Edition.
Executional Architecture Lecture Conceptual vs execution Conceptual Architecture Execution Architecture Component Connector Domain-level responsibilities.
Lilian Blot TO PROGRAMMING & PYTHON Introduction Autumn 2012 TPOP 1.
1 Introduction to Object Oriented Design. 2 Overview Understand Classes and Objects. Understand some of the key concepts/features in the Object Oriented.
OOPS CONCEPT. OOPS Benefits of OOPs OOPs Principles Class Object Objectives.
Chapter 10 Analyzing Genes and Genomes Essential Cell Biology Third Edition Copyright © Garland Science 2010.
Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
© Tomáš Kozel, Pavel Čech Java Basics Class structure, declaration, primitive data types, statements.
1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
Introduction to Object-oriented programming and software development Lecture 1.
Chapter 12 OOP: Creating Object- Oriented Programs Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 5.
Name Convolutional codes Tomashevich Victor. Name- 2 - Introduction Convolutional codes map information to code bits sequentially by convolving a sequence.
Chapter 15 Intracellular Compartments and Transport Essential Cell Biology Third Edition Copyright © Garland Science 2010.
Object-Oriented Programming Session 9 Course : T Programming Language Concept Year : February 2011.
C Copyright © 2005, Oracle. All rights reserved. Practice Solutions.
© 2017 SlidePlayer.com Inc. All rights reserved.