Object-Oriented Programming with NaturalX - PowerPoint PPT Presentation

1 / 73
About This Presentation
Title:

Object-Oriented Programming with NaturalX

Description:

m i n d c r o s s Object-Oriented Programming with NaturalX Presented by: Rosanne Verteramo Sr. Training Consultant MindCross Training & Consulting – PowerPoint PPT presentation

Number of Views:81
Avg rating:3.0/5.0
Slides: 74
Provided by: saga93
Category:

less

Transcript and Presenter's Notes

Title: Object-Oriented Programming with NaturalX


1
Object-Oriented Programming with NaturalX
m i n d c r o s s
  • Presented by Rosanne Verteramo
  • Sr. Training Consultant
  • MindCross Training Consulting

1
MindCross Training Consulting -
www.mindcross.com
2
Overview
  • In such a rapidly changing field as OOP, it is
    essential to not only keep up but to lead the
    way. This presentation will cover the basic
    concepts of object-oriented programming and the
    elements of object oriented design, including
    objects, classes, and methods. It will introduce
    NaturalX and show you how to do Object-oriented
    programming (OOP) using NaturalX and the Natural
    development environment on NT.

3
Topics
  • An Introduction to Object-Oriented Programming
    (OOP)
  • The basic principles
  • Object-oriented design
  • Classes and methods
  • OO Programming with NaturalX
  • What is NaturalX?
  • Component-oriented development with NaturalX

4
Introduction to Object-Oriented Programming
m i n d c r o s s
4
MindCross Training Consulting -
www.mindcross.com
5
Object-Oriented Programming
  • Why Object-oriented Programming (OOP)?
  • It will quickly and easily lead to increased
    productivity and reliability due to reuse
  • Reusable components
  • Easy transition from existing languages
  • Similar to other programming techniques
  • Enables Enterprise Application Integraiton (EAI)

6
Object-Oriented Programming
  • Understanding the concepts.
  • A new way of thinking
  • A programming technique
  • Oriented around objects and data
  • Object-oriented languages do not force
    object-oriented programming

7
The Basic Principles of OOP
  • An analogy sending wine and cheese to a friend
    in another state

Friend
Wine and cheese
Me
8
The Basic Principles of OOP
  • An analogy sending wine and cheese to a friend
    in another state

Friend
Wine and cheese
Me
method
message
agent
9
Elements of OOP - Objects
  • Everything is an object
  • A software bundle of related variables and
    methods a code block
  • Used to model real world objects
  • Two characteristics
  • State - Maintained within variables / data
  • Variables are known as properties
  • Behavior - Implemented within methods / functions
  • An object is an instance

10
Elements of OOP - Objects
  • Everything is an object (continued)
  • Packaging properties/variables within the method
    of an object is known as encapsulation
  • Exposing properties makes them publicly available
    to the user of the object

Object
11
Elements of OOP - Objects
  • Everything is an object (continued)
  • Encapsulating variables/properties and methods
    within an object provides two primary benefits
  • Modularity
  • The source code for an object is written and
    maintained independently of other objects
  • Promotes reusability
  • Information hiding
  • Modifications to the information will not affect
    other users of the object

12
Elements of OOP - Messages
  • Communication between objects is accomplished by
    passing messages
  • Actions are produced in response to requests,
    called messages
  • An object may accept a message, and in return
    will perform an action and return a value
  • Additional information is passed to a method
    within an object as arguments or parameters

13
Information Hiding Encapsulation
  • As a user of a service being provided by an
    object, you only need to know the name of the
    messages that the object will accept
  • Its not necessary to know how the actions
    performed in response to the request will be
    carried out
  • The object is responsible for carrying it out the
    request

14
Elements of OOP - Receivers
  • Messages differ from traditional function calls
    in two very important respects
  • In a message there is a designated receiver that
    accepts the message
  • The interpretation of the message may be
    different, depending upon the receiver

15
Elements off OOP - Classes
  • A class is a blueprint that defines the
    properties and methods for that class
  • Every object is an instance of a class
  • The variables and methods will be common to all
    objects
  • Behavior is associated with classes, not with
    individual instances
  • All objects that are instances of a class use the
    same method in response to similar messages

16
Elements off OOP - Classes
  • Every objects state is independent of every
    other object related to that class
  • For every instance of a class the system
    allocates enough memory for the object and all
    its data

17
Classes and Instances
  • An object is an instance of a class
  • Class Square
  • Instance Maggies_ green_ square

18
Classes and Instances
  • Class hierarchies
  • Classes can be created from other classes
  • Class Bike
  • Class Mountain_Bike
  • Mountain_Bike is considered a sub-class of Bike
  • Bike is considered the superclass

19
Elements of OO - Inheritance
  • Classes are organized into a singly-rooted tree
    structure, inheritance hierarchy
  • Relates to both data and/or behavior
  • Everything from a higher level class is
    automatically applicable to lower levels in the
    hierarchy

20
Classes and Instances
  • Class hierarchies - inheritance hierarchy

Class dot
Class line
Class rectangle
Maggies green square
21
Elements of OOP - Encapsulation
  • The proper use of methods
  • One must provide the intended user of a module
    with all the information needed to use the module
    correctly, and with nothing more

22
The Basic Principles of OOP
  • OOP is not simply features added to a programming
    language - - it is a new way of thinking
  • The OOP views a program as a community of agents,
    termed objects
  • Each object is responsible for a specific task
  • An object is an instance of a class

23
The Basic Principles of OOP
  • Communication is accomplished by passing messages
  • An object is an encapsulation of state (data
    values) and behavior (operations)
  • Every object has its own memory
  • The behavior of objects is dictated by the object
    class

24
The Basic Principles of OOP
  • Classes are organized into a tree structure
    called the inheritance hierarchy
  • An object will exhibit its behavior by invoking a
    method (similar to executing a procedure) in
    response to a message
  • The OOP view of computation is that an
    application is a conglomeration of interacting
    computing objects

25
OO Programming with NaturalX
m i n d c r o s s
25
MindCross Training Consulting -
www.mindcross.com
26
What is NaturalX
  • Software AGs technology for component-oriented
    development using Natural

Natural
Mainframe
Unix
Windows
Open VMS
AS/400
Database
27
What is NaturalX
  • Component-oriented development

Component
Component
Component
NaturalX
Visual Basic
Visual C
28
What is NaturalX
  • Component-oriented development

EntireX DCOM
EntireX DCOM
EntireX DCOM
29
Natural Development Environment
  • Natural Studios
  • User-friendly GUI for development of procedural,
    event-driven, and component-based Natural
    applications
  • Includes a Class Builder for developing NaturalX
    classes/components
  • Automatically generates code and statements
    necessary for the NaturalX class module

30
Natural Development Environment
31
NaturalX Statements
  • Define Class . . .
  • Define Interface . . .
  • Property . . .
  • Method Is. . .

32
NaturalX Commands
  • Register
  • Deregister

33
Steps to Creating NaturalX Classes
  • Using the Class Builder
  • Create a new Class with name
  • Create a new Interface with name
  • Create methods with appropriate names
  • Implement methods as subprograms
  • Create properties with appropriate names
  • Create Object data area
  • Stow class with module name
  • Register

34
Steps to Creating NaturalX Classes
35
(No Transcript)
36
(No Transcript)
37
(No Transcript)
38
(No Transcript)
39
(No Transcript)
40
(No Transcript)
41
(No Transcript)
42
(No Transcript)
43
(No Transcript)
44
(No Transcript)
45
(No Transcript)
46
Components of a NaturalX Class
47
Components of a NaturalX Class
Class Name and ClassID (GUID)
Interface Name and Interface ID (IID)
Method Name
PDA
Properties
48
(No Transcript)
49
NaturalX Structure for Classes
  • Define Class . . .
  • Define Interface . . .
  • Property . . .
  • End-Property
  • Method . . .
  • End-Method
  • End-Interface
  • End-Class

50
(No Transcript)
51
NaturalX Syntax for Class objects
  • Define Class xxxxxxxx
  • Object using LDA
  • Local using GUID_LDA
  • ID GUID_Variable (from GUID_LDA)
  • Interface InterfaceName
  • ID Interface_ID (from GUID_LDA)
  • Property PropertyVariable
  • IS VariableName (link variable to property)
  • End-Property
  • Method MethodName
  • IS SubprogramName
  • Parameter Using PDA
  • End-Method
  • End-Interface
  • End-Class
  • End

52
NaturalX Statements
  • Create Object . . .
  • Send Method . . .

53
Calling NaturalX Components
  • Declaration
  • Define data local
  • 1 ObjectName HANDLE of OBJECT
  • End-Define
  • Instantiation
  • Create Object ObjectName of CLASS ClassName
  • Giving NaturalError
  • Invoking Methods
  • SEND Method MethodName to Object ObjectName
  • WITH Parameters

54
Calling NaturalX Components
  • SEND syntax
  • SEND Method MethodName to Object ObjectName
  • WITH Parameters
  • RETURN ReturnValueField
  • GIVING NaturalError
  • Parameter options
  • By Value Input parameters of the method
  • By Reference Input and output parameters
  • By Value Result Return value for the method

55
Writing the Client Program
1 MyEmpl Handle of Object Create Object MyEmpl
Of Class 'DEMOCLASS Send Method 'GET_EMPL' To
Object MyEmpl WITH PID result
56
Registering Classes with NaturalX
  • Manual Register/Deregister
  • Register ClassName LibraryName
  • DeRegister ClassName LibraryName
  • Automatic Registration using Natparms
  • AUTOREGISTER

57
(No Transcript)
58
Distributing Components
  • DCOMCNFG
  • Microsoft utility which specifies information
    needed for DCOM
  • Location of COM object
  • Permissions
  • Runtime specifications
  • On Server - define launch and access permissions
  • On Client - define location of COM object

59
Distributing Components
  • DCOMCNFG.exe

Component on NT Server
Define location of component on client machine
Define security (launch and access privileges)
60
(No Transcript)
61
(No Transcript)
62
(No Transcript)
63
(No Transcript)
64
(No Transcript)
65
(No Transcript)
66
(No Transcript)
67
Writing the Client Program
1 MyObject Handle of Object
Create Object MyObject Of Class
'EAS.EMPLOYEE'
Height MyObject.Height
MyObject.Height Height
68
The Component Browser
  • Means for Browsing all Components
  • GUIDs
  • Interfaces
  • Properties
  • Methods
  • Type library is created for every NaturalX class
    as part of the Register process

69
Summary
  • OOP is a new way of thinking
  • OOP involves the use of classes, objects,
    methods, and properties
  • A class is a blueprint for a software module
  • An object is an instance of a class
  • A method represents the code within the class for
    behavior

70
Summary
  • Properties represent data
  • Encapsulation allows reuse and promotes
    information and function hiding
  • Inheritance hierarchy is the ability to create
    classes from other higher level classes
  • NaturalX is a tool allowing you to create
    components using the Natural programming language

71
Summary
  • NaturalX uses classes, interfaces, and methods,
    and properties
  • An interface is a group of methods
  • A method is processed in NaturalX as a subprogram
  • There is a one to one ratio between Natural
    methods and subprograms
  • Properties are needed within NaturalX to make
    class data publicly available

72
Summary
  • Properties store their data within an Object data
    area
  • There is one object data area per class in
    NaturalX
  • GUIDs can be created automatically in NaturalX
    when stowing the class

73
The End
Thank you, from MindCross Training
Consulting Training worldwide
Write a Comment
User Comments (0)
About PowerShow.com