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

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.
1 Structures. 2 User-Defined Types C provides facilities to define one’s own types. These may be a composite of basic types ( int, double, etc) and other.
Computer Science 112 Fundamentals of Programming II Overview of Collections.
Overview of Data Structures and Algorithms
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.
1 Chapter 24 Lists Stacks and Queues. 2 Objectives F To design list with interface and abstract class (§24.2). F To design and implement a dynamic list.
CS 307 Fundamentals of Computer Science 1 Abstract Data Types many slides taken from Mike Scott, UT Austin.
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.
Overview CS113, Fall 2000 Gene Itkis. The Promise Heavy Fast-paced Challenging Rewarding.
8 – Objects as building blocks Visual Basic: An Object Oriented Approach.
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.
Visual Basic: An Object Oriented Approach 11 – Patterns in object oriented programming.
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.
Chapter 3 List Stacks and Queues. Data Structures Data structure is a representation of data and the operations allowed on that data. Data structure is.
Trees Chapter 15 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013.
Stacks. An alternative storage structure for collections of entities is a stack. A stack is a simplified form of a linked list in which all insertions.
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.
 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:
Data Structure Introduction.
5. Collections Arrays Other basic data structures.NET collections Class library example.
Slide 1 Linked Data Structures. Slide 2 Learning Objectives  Nodes and Linked Lists  Creating, searching  Linked List Applications  Stacks, queues.
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 
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Week 15 – Wednesday.  What did we talk about last time?  Review up to Exam 1.
Linked Lists. Introduction In linked list each item is embedded in a link Each item has two parts – Data – Pointer to the next item in the list Insert,
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
Integrating and Extending Workflow 8 AA301 Carl Sykes Ed Heaney.
Lecture 8: Collections, Comparisons and Conversions. Svetla Boytcheva AUBG, Spring COS 240 Object-Oriented Languages.
List Structures What is a list? A homogeneous collection of elements with a linear relationship between the elements linear relationship - each element.
Introduction toData structures and Algorithms
CSCE 210 Data Structures and Algorithms
Standard Template Library
Trees Chapter 15.
Fundamentals of Programming II Overview of Collections
Trees Chapter 11 (continued)
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.
COMP 103 Binary Search Trees.
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
Object-Oriented Knowledge Representation
Binary Trees: Motivation
Introduction to Data Structure
COP3530- Data Structures Introduction
structures and their relationships." - Linus Torvalds
Lecture Set 9 Arrays, Collections, and Repetition
Presentation transcript:

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

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

Arrays Private Accounts (1..100) As AccountObj For I = 1 To 100 Set Accounts(I) = AccountObj Accounts(I).Initialise Next

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 them

Collection Classes Specialised forms of collection Based on standard collection class Add Remove Item( ) Count Support for For Each … syntax Allows natural form of iteration over a collection

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

Objects and Links Object called DataNodeObj Private Link As DataNodeObj Private Data As … Public sub AddData(…) … Public sub Initialise Set Link = DataNodeObj If... Link.Initialise Link.AddData

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

Visual Basic Structures End

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

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

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