Structured COBOL programming

38 335 0
Structured COBOL  programming

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College “Copyright @ 2000 John Wiley & Sons, In. All rights reserved. Reproduction or translation of this work beyond that permitted in Section 117 of the 1976 United States Copyright Act without the express permission of the copyright owner is unlawful. Request for further information should be addressed to the permissions Department , John Wily & Sons, Inc. The purchaser may make back-up copies for his/her own use only and not for distribution or resale. The Publisher assumes no responsibility for errors, omissions, or damages, caused by the use of these programs or from the use of the information contained herein.” Structured COBOL Programming, Stern & Stern, 9th Edition CHAPTER 18 AN INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING Structured COBOL Programming, Stern & Stern, 9th Edition TABLE OF CONTENTS • The Advantages of Object-Oriented Programming • Overview of Object-Oriented Programming (OOP) • Tutorials for Object-Oriented COBOL – Lessons 1 through 3 – What You’ve Learned Structured COBOL Programming, Stern & Stern, 9th Edition Advantages of Object-Oriented Programming • Object-oriented programming (OOP) is a concept that has the potential for significantly enhancing the quality of all programs. • This concept is considered by many to to be the key to improved productivity in future programs. – ANSI formed an OO COBOL Task Group to define the OO extensions to the COBOL language as a part of the COBOL 2000+ standard. Structured COBOL Programming, Stern & Stern, 9th Edition Advantages of Object-Oriented Programming • Some programming languages that already implement the OO approach are: – SMALLTALK – C++ • Keep in mind that the concept of object- oriented programming will be added to the COBOL standard as an extension. – Thus any new compiler incorporating object oriented techniques will be compatible with previous standards. Structured COBOL Programming, Stern & Stern, 9th Edition Overview of Object-Oriented Programming • Data and procedures are combined and stored in a program as units referred to as objects. • Action occurs when an object receives a message from the user. • Services or actions are performed by the program as responses to user messages. Structured COBOL Programming, Stern & Stern, 9th Edition Overview of Object-Oriented Programming • Objects can be written so that they share attributes data and methods with other objects. – Objects can have any number of other attributes unique to them. – Data and procedure components need only be written once and copied to all objects with same attributes. Structured COBOL Programming, Stern & Stern, 9th Edition Overview • A class defines a template for a series of similar objects. – The class can be used to define and create objects that are the same except for the value of their data. • By defining classes and objects within classes the following takes place: 1. Complex applications will be easier to develop. 2. Programs will become more standardized. Structured COBOL Programming, Stern & Stern, 9th Edition Overview 3. Reusable code stored in libraries will reduce duplication of effort, programming and maintenance costs, and errors. 4. Improve programmer productivity 5. Objects can be acted on in any program by responding to the messages provided by the user. Structured COBOL Programming, Stern & Stern, 9th Edition Overview • In summary: – Data and procedures are combined into a class definition. – The class definition is specified in COBOL with procedures and global data that looks like standard COBOL. – Multiple instances of a class, each with its own local data, can be created at any point. – These instances of a class are the objects that can send and receive messages from other objects. [...]... OBJECT Structured COBOL Programming, OBJECT-ORIENTED COBOL PRODUCTS • The following companies and products have incorporated OO options into their COBOL compilers: SOFTWARE DEVELOPER PRODUCT Micro Focus Object COBOL IBM Visual Age for COBOL Computer Associates Visual Realia COBOL Netron, Inc Netron/Fusion TechBridge Technology TechBridge Builder Structured COBOL Programming, TUTORIAL FOR OO COBOL BY... through INHERITANCE Structured COBOL Programming, Overview • Conceptually the implementation of OO in COBOL begins using standard COBOL: – The COPY statement enables the copying of class definitions and objects into a program – The CALL statement enables the sending of message to objects to get results – The INVOKE statement may be used also Structured COBOL Programming, Overview • A COBOL Example: INVOKE... item in some programs Structured COBOL Programming, Overview • For objects within a class the following is done in COBOL: IDENTIFICATION DIVISION FACTORY ENVIRONMENT DIVISION DATA DIVISION PROCEDURE DIVISION END FACTORY Structured COBOL Programming, Overview • To define methods and data unique to a specific object the following COBOL is written:... a Parameter to an Object and Returning a Value Structured COBOL Programming, WHAT YOU’VE LEARNED • Once you've completed the tutorial lessons outlined in your textbook you will have seen Personal COBOL s basic structures and had some amount of interaction between program entities • These are the basic components of all OO programming Structured COBOL Programming, WHAT YOU’VE LEARNED • You will have... fundamental concepts of OO COBOL programming – In going through the tutorial, you'll learn: • The basics parts of a class • The key elements needed to use an object • Passing a parameter to an object method • Passing a parameter to an object method and getting back a return value Structured COBOL Programming, TUTORIAL FOR OO COBOL BY MICRO FOCUS • Lesson Two: "Hello World" and OO COBOL – Permits working... by messages sent to the objects Structured COBOL Programming, Overview • Objects are ENCAPSULATED: – This means their data and procedures are hidden behind an INTERFACE • One goal of OOP is to develop libraries of objects that can be shared and called into user programs as needed – CALL and COPY are verbs that can achieve some of the objectives of OOP Structured COBOL Programming, Overview • A CLASS... back to the user program Structured COBOL Programming, Overview • Often you begin establishing a new instance of an object from a class of objects – MYSAVINGSACCOUNT may be an instance of ASAVINGSACCOUNT • Defining an instance of an object is called INSTANTIATION • This may be accomplished by code such as: INVOKE ASAVINGSACCOUNT 'New' RETURNING MYSTAVINGSACCOUNT Structured COBOL Programming, Overview... classes means placing reusable code in a central location or library Structured COBOL Programming, Overview • An object is called an INSTANCE of a class – Objects INHERIT attributes data and procedures- from their class • A class can include a group of objects and may be included in another object called a MEMBER object Structured COBOL Programming, Overview Example-1: • A Bank-Account may be defined as... applied to checking-account but not to savings-account Structured COBOL Programming, Overview Example-3 • Data such as account-number can be shared by objects within the class as well • This may be made available to users for processing but may also be protected so that users can enter and retrieve them, but not be able to change them Structured COBOL Programming, Overview • Classes and their objects consist... a COBOL reserved word so we use FACTORY • Factory data must be set to its initial value using the INITIALIZE verb or a VALUE clause (e.g., interest rate) Structured COBOL Programming, Overview • METHODS can be two types: – Object methods unique to each object in the class – Factory methods shared by all objects in the class • Objects are identified by unique names called OBJECT HANDLES Structured COBOL . information contained herein.” Structured COBOL Programming, Stern & Stern, 9th Edition CHAPTER 18 AN INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING Structured COBOL Programming, Stern & Stern,. Object-Oriented Programming • Overview of Object-Oriented Programming (OOP) • Tutorials for Object-Oriented COBOL – Lessons 1 through 3 – What You’ve Learned Structured COBOL Programming, Stern. future programs. – ANSI formed an OO COBOL Task Group to define the OO extensions to the COBOL language as a part of the COBOL 2000+ standard. Structured COBOL Programming, Stern & Stern,

Ngày đăng: 23/10/2014, 20:10

Mục lục

    CHAPTER 18 AN INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING

    Advantages of Object-Oriented Programming

    Overview of Object-Oriented Programming

    Terms and Concept Analogies

    TUTORIAL FOR OO COBOL BY MICRO FOCUS

    WHAT YOU’VE LEARNED