8 – Objects as building blocks Visual Basic: An Object Oriented Approach.

Slides:



Advertisements
Similar presentations
PROGRAMMING LANGUAGE (JAVA) UNIT 42 BY ROBERT BUTTERFIELD TELEPHONE Data Structures and Algorithms.
Advertisements

8 – Objects as building blocks Visual Basic: An Object Oriented Approach.
Dr Terry Hinton 28/10/03 CSM18 VB OOP1 Visual Basic: An Object Oriented Approach Programming is a Model of the Real World Object in Real World modelled.
Data Structures.
Intro. to Data Structures 1CSCI 3333 Data Structures - Roughly based on Chapter 6.
Computer Science 112 Fundamentals of Programming II Overview of Collections.
Overview of Data Structures and Algorithms
CHAPTER 4 Queues. Queue  The queue, like the stack, is a widely used data structure  A queue differs from a stack in one important way  A stack is.
Advanced Data Structures
1 CSC 421: Algorithm Design & Analysis Spring 2013 See online syllabus: (also on BlueLine2) Course.
Visual Basic: An Object Oriented Approach 6: Object Modelling.
Trees Chapter 8.
Queues Chapter 6. Chapter Objectives  To learn how to represent a waiting line (queue) and how to use the methods in the Queue interface for insertion.
CS 307 Fundamentals of Computer Science 1 Abstract Data Types many slides taken from Mike Scott, UT Austin.
Midterm 2 Overview Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Fall 2007CS 2251 Trees Chapter 8. Fall 2007CS 2252 Chapter Objectives To learn how to use a tree to represent a hierarchical organization of information.
Trees Chapter 8. Chapter 8: Trees2 Chapter Objectives To learn how to use a tree to represent a hierarchical organization of information To learn how.
Fall 2007CS 2251 Queues Chapter 6. Fall 2007CS 2252 Chapter Objectives To learn how to represent a waiting line (queue) and how to use the methods in.
Data Structures Topic #3. Today’s Agenda Ordered List ADTs –What are they –Discuss two different interpretations of an “ordered list” –Are manipulated.
COMP 110 Introduction to Programming Mr. Joshua Stough.
Queues Chapter 6. Chapter 6: Queues2 Chapter Objectives To learn how to represent a waiting line (queue) and how to use the methods in the Queue interface.
Fall 2007CS 2251 Queues Chapter 6. Fall 2007CS 2252 Chapter Objectives To learn how to represent a waiting line (queue) and how to use the methods in.
Data Structures Lecture-1:Introduction
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
COMP 121 Week 14: Queues. Objectives Learn how to represent a queue Learn how to use the methods in the Queue interface Understand how to implement the.
CSCA48 Course Summary.
Computer Science Department Data Structures and Algorithms Lecture 1.
PRESENTED BY: RAJKRISHNADEEPAK.VUYYURU SWAMYCHANDAN.DONDAPATI VINESHKUMARREDDY.LANKA RAJSEKHARTIRUMALA KANDURI ALAN.
Chapter 10 Strings, Searches, Sorts, and Modifications Midterm Review By Ben Razon AP Computer Science Period 3.
© 2011 Pearson Addison-Wesley. All rights reserved 11 B-1 Chapter 11 (continued) Trees.
Trees Chapter 8. Chapter 8: Trees2 Chapter Objectives To learn how to use a tree to represent a hierarchical organization of information To learn how.
CS212: DATA STRUCTURES Lecture 1: Introduction. What is this course is about ?  Data structures : conceptual and concrete ways to organize data for efficient.
111 © 2002, Cisco Systems, Inc. All rights reserved.
1 Introduction to Data Structures. 2 Course Name : Data Structure (CSI 221) Course Teacher : Md. Zakir Hossain Lecturer, Dept. of Computer Science Stamford.
 DATA STRUCTURE DATA STRUCTURE  DATA STRUCTURE OPERATIONS DATA STRUCTURE OPERATIONS  BIG-O NOTATION BIG-O NOTATION  TYPES OF DATA STRUCTURE TYPES.
Data Design and Implementation. Definitions of Java TYPES Atomic or primitive type A data type whose elements are single, non-decomposable data items.
Fall 2007CS 2251 Queues Chapter 6. Fall 2007CS 2252 Chapter Objectives To learn how to represent a waiting line (queue) and how to use the methods in.
Data structures Abstract data types Java classes for Data structures and ADTs.
Queues Chapter 6. Chapter 6: Queues Chapter Objectives To learn how to represent a waiting line (queue) and how to use the five methods in the Queue interface:
Chapter 1 Data Structures and Algorithms. Primary Goals Present commonly used data structures Present commonly used data structures Introduce the idea.
Data Structure Introduction.
5. Collections Arrays Other basic data structures.NET collections Class library example.
Standard Template Library The Standard Template Library was recently added to standard C++. –The STL contains generic template classes. –The STL permits.
Elementary Data Organization. Outline  Data, Entity and Information  Primitive data types  Non primitive data Types  Data structure  Definition 
Collections Data structures in Java. OBJECTIVE “ WHEN TO USE WHICH DATA STRUCTURE ” D e b u g.
Collections A collection is a way of grouping a set of related items. Property or methodDescription Add methodAdd items to the collection. Count propertyReturn.
Abstract Data Type EnhanceEdu.
Introduction to Collections. Collections Collections provide a way of organizing related data in a model Different types of collections have different.
2005MEE Software Engineering Lecture 7 –Stacks, Queues.
Data Structure and Algorithms
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
1 Chapter 4 Unordered List. 2 Learning Objectives ● Describe the properties of an unordered list. ● Study sequential search and analyze its worst- case.
Lecture 8: Collections, Comparisons and Conversions. Svetla Boytcheva AUBG, Spring COS 240 Object-Oriented Languages.
Lecture 1 Data Structures Aamir Zia. Introduction Course outline Rules and regulations Course contents Good Programming Practices Data Types and Data.
Introduction toData structures and Algorithms
CSC 421: Algorithm Design & Analysis
Fundamentals of Programming II Overview of Collections
Trees Chapter 11 (continued)
COMP 53 – Week Eleven Hashtables.
Trees Chapter 11 (continued)
Data Structures Data Structure is a way of collecting and organising data in such a way that we can perform operations on these data in an effective.
Lesson Objectives Aims – Know about…
CSC 421: Algorithm Design & Analysis
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
structures and their relationships." - Linus Torvalds
Introduction to Data Structure
COP3530- Data Structures Introduction
structures and their relationships." - Linus Torvalds
Data Structures and Algorithms Lecture-1: Introduction
Lecture Set 9 Arrays, Collections, and Repetition
Presentation transcript:

8 – Objects as building blocks Visual Basic: An Object Oriented Approach

OOP Structural Forms In general, object orientation supports Inheritance (interface only in VB) Composition (whole-part structures) Aggregation (objects with collections) Messages (interacting objects) Building an efficient, well-organised object oriented program should involve all of these to some degree

Structures in the real world All around us, things are organised into structures Buildings Traffic and communications networks Living organisms Complex systems built up of repeated of simple building blocks Should try to mimic this in programs

Structures in programs Ways of grouping objects using available mechanisms Arrays, Collections Lists Simple lists of objects Stacks (Last-in, First out) Queues (Last-in, Last-out) Trees Hierarchical structures of objects Graphs Arbitrarily interconnected objects

Choice of Structure Various selection criteria Organisational form of system we are modelling Storage efficiency – space required to store items Computational efficiency – how long to add and remove objects Often a trade-off is necessary

Logical and Physical Structure Interconnect objects using references Forms of interconnection involve Logical structure The model of interconnections we wish to create Physical structure The actual mechanisms we use to create i

Modelling in VB Tendency to favour Collections in VB code Simple Efficient Direct Can be used to create a variety of logical structures The ‘Microsoft way’ Not always the best mechanism Can build custom forms of structures using references

Collection Classes Specialised forms of collection Based on standard collection class, but.. Optimised for storing and retrieving a specific class of object Implement standard class interface… Add Remove Item( ) Count Support for For..Each syntax Allows natural form of iteration over a collection

Building Collection Classes Awkward to hand-code in VB Need to set properties for specialist methods of collection and collected classes Special members Item property – Default property Iterator (For…Each enumerator) VB’s class builder Generates whole collection class automatically Links collection class to collected class None of the subtle syntax errors possible in hand coding

Using a custom collection class Simplifies coding for client applications Add items using a simple call Iterate over collection easily Set T = New colTransactions T.Add “10/10/2000”, , “Deposit” T.Add….. ‘‘‘ For Each Tr In T T.PrintStatementLine Next

Alternative Collections Ordered Collection Items added in a specific order Can use binary search to insert and retrieve items Efficiency in searching (and therefore retrieval

Queues and Stacks Collections with limitations on insertions/retrievals

Alternatives to Collections Tree Structures Each item can contain references to several other items Efficient for storage and retrieval Recursive

Graphs Arbitrary interconnections Complex, and can be inefficient to code Require use of specialist algorithms to search and traverse