Programming with Objects: Class Libraries and Reusable Code.

Slides:



Advertisements
Similar presentations
Sub and Function Procedures
Advertisements

Communication between modules, cohesion and coupling
1 Chapter Three Using Methods. 2 Objectives Learn how to write methods with no arguments and no return value Learn about implementation hiding and how.
CPS 506 Comparative Programming Languages Abstract Data Type and Encapsulation.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 1.1 of…
Case, Arrays, and Structures. Summary Slide  Case Structure –Select Case - Numeric Value Example 1 –Select Case - String Value Example  Arrays –Declaring.
Chapter 5 - Menus, Sub Procedures, and Sub Functions  Menus - controls - properties and events –menu editor - create and change –defining menus - menu.
Names and Scopes CS 351. Program Binding We should be familiar with this notion. A variable is bound to a method or current block e.g in C++: namespace.
C# Programming: From Problem Analysis to Program Design1 Advanced Object-Oriented Programming Features C# Programming: From Problem Analysis to Program.
Chapter 13: Advanced GUI and Graphics
ASP.NET Programming with C# and SQL Server First Edition
Chapter 13: Object-Oriented Programming
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
Abstract Data Types and Encapsulation Concepts
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Review of C++ Programming Part II Sheng-Fang Huang.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
McGraw-Hill© 2007 The McGraw-Hill Companies, Inc. All rights reserved. 1-1.
Microsoft Visual Basic 2005: Reloaded Second Edition
An Object-Oriented Approach to Programming Logic and Design
Tutorial 11 Using and Writing Visual Basic for Applications Code
Microsoft Visual Basic 2005 CHAPTER 9 Using Arrays and File Handling.
1 Web-Enabled Decision Support Systems Objects and Procedures Don McLaughlin IE 423 Design of Decision Support Systems (304)
CHAPTER SIX Reducing Program Complexity General Sub Procedures and Developer-defined Functions.
Using Arrays and File Handling
Chapter 8: Writing Graphical User Interfaces
Forms - An Overview of Oracle Form Builder v.6.0 Abhishek Parag Prashant Arun.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC BUILDING BLOCKS Bilal Munir Mughal 1 Chapter-5.
CSCI 3327 Visual Basic Chapter 6: Methods: A Deeper Look UTPA – Fall 2011.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
‘Tirgul’ # 7 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #7.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Module 3: Working with Components. Overview An Introduction to Key.NET Framework Development Technologies Creating a Simple.NET Framework Component Creating.
Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent.
Chapter 9: Writing Procedures Visual Basic.NET Programming: From Problem Analysis to Program Design.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
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.
Copyright © Curt Hill Generic Classes Template Classes or Container Classes.
Data Structures Using C++ 2E1 Inheritance An “is-a” relationship –Example: “every employee is a person” Allows new class creation from existing classes.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC PROGRAMMING FUNDAMENTALS Bilal Munir Mughal 1 Chapter-8.
1 Chapter Four Creating and Using Classes. 2 Objectives Learn about class concepts How to create a class from which objects can be instantiated Learn.
CITA 342 Section 2 Visual Programming. Allows the use of visual expressions (such as graphics, drawings, or animation) in the process of programming.
VB Classes ISYS 512/812. Object-Oriented Concepts Abstraction: –To create a model of an object, for the purpose of determining the characteristics (properties)
Top-down approach / Stepwise Refinement & Procedures & Functions.
CHAPTER SIX Reducing Program Complexity General Sub Procedures and Developer-defined Functions.
Introduction to Object-Oriented Programming Lesson 2.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Introduction to Computers Lesson 13A. home Computer Program A set of instructions or statements, also called code, to be carried out by the computer’s.
Object Oriented Programming. OOP  The fundamental idea behind object-oriented programming is:  The real world consists of objects. Computer programs.
Design Patterns Creational Patterns. Abstract the instantiation process Help make the system independent of how its objects are created, composed and.
1 n Object Oriented Programming. 2 Introduction n procedure-oriented programming consists of writing a list of instructions and organizing these instructions.
Introduction to UML and Rational Rose UML - Unified Modeling Language Rational Rose 98 - a GUI tool to systematically develop software through the following.
CPS120: Introduction to Computer Science Lecture 16A Object-Oriented Concepts.
IS 350 Course Introduction. Slide 2 Objectives Identify the steps performed in the software development life cycle Describe selected tools used to design.
TK1924 Program Design & Problem Solving Session 2011/2012
Forms Concepts Triggers Fired when Internal/External events occur
INF230 Basics in C# Programming
Abstract Data Types and Encapsulation Concepts
Using local variable without initialization is an error.
Abstract Data Types and Encapsulation Concepts
Interfaces.
Analysis models and design models
Social Media And Global Computing Creating DLLs with Visual Studio
CSCI 3327 Visual Basic Chapter 6: Methods: A Deeper Look
Tonga Institute of Higher Education
Presentation transcript:

Programming with Objects: Class Libraries and Reusable Code

Objectives Understand and employ the Visual Basic.NET classes, forms, components, modules, structures, and namespaces Understand the notion of a class library and its usefulness in creating reusable code Convert a Windows Forms application into a class library Build a class library, and create a solution with multiple projects Incorporate a component into a class library project, and use the component to exchange parameter data with a client program

Understanding Classes, Forms, Components, Modules, Structures, and Namespaces Principle of structured programming –Large programs should be subdivided into smaller, meaningful logical functional units Class –Defines the properties, fields, methods, and events that go into an object –A reference type –Object is an instance of a class –Can inherit from another class –Is both inheritable and reusable Form –A type of class –Has a graphical component and a code component –May serve as a container for other forms –Must be instantiated as an object before it can be used –Code portion of a Windows form is loaded at the same time and on the same computer as the GUI

Component A class that conforms to a certain standard for interacting with other components May or may not contain a graphical element Can provide an easy way to communicate between projects in a solution After component class has been instantiated, its methods are available

Module A reference type, consisting of declarations and procedures only Similar to a class in terms of serving as a container for code Unlike a class in several respects –Cannot be instantiated nor inherited –Cannot be nested inside another structure Variables and procedures are shared by default Public variables and procedures –Accessible and scoped to the namespace that contains the module

Structure An expansion of the user-defined type in previous releases of Visual Basic Can contain different kinds of data items, each with its own accessibility Is a value type (each variable based on a structure contains its own data) Declared at the module or class level

Declaration of structLogonPassword

Namespace Organizes the list of names that occur in an assembly An assembly –The package that results from compilation Can also contain lower-level namespaces Reason for subdividing large project into namespaces –To avoid name collisions

Compiling a Project into a Class Library Class library –Defines a class –Great way to create reusable objects –Compiles to a DLL file (dynamic link library) DLL file –Cannot be executed directly –Must be called from inside another running program Output from the compiler is known as an assembly After you have compiled your project into a class library –Executable project (or client) that calls this library must identify both the class library’s DLL file and its namespace name

Summary Class –Template or blueprint for an object Form –Class that has both a graphical representation and a code segment Component –Class designed for interaction with other components Module –Contains code only and its data values are shared Structure –Value type that defines fields, properties, methods, and events at the module level Namespace –Defines a list of names (classes, structures, other namespaces, etc.) within an assembly Class library –Defines a reusable program Project compiled into a class library –Can receive ByVal or ByRef parameters from the calling (client) program Method of passing parameters between programs –Through component class