Object-Oriented Programming

Object-oriented programming (OOP) is programming primarily focused on data, while data and behavior are being inseparably linked. Data and behavior together constitute a class, while object are class instances.

OOP consider computation as modeling of behavior. The modeled item is the object represented by computational abstractions. Suppose we want to write a well known game "Tetris". To do this, we must learn how to model the appearance of random shapes composed of four squares joined together by edges. Also we need to regulate the falling speed of shapes, define operations of rotation and shift of shapes. Moving of shapes is limited by the well's boundaries, this requirement must also be modeled. Besides that, filled rows of cubes must be destroyed and achieved points must be counted.

Thus, this easy to understand game requires the creation of several models - shape model, well model, shape movement model and so on. All these models are abstractions, represented by calculation in the computer. To describe these models, the concept of Abstract Data Type, ADT(or complex data type) is used. Strictly speaking, the model of "shapes" motion in DOM is not a data type, but it is a set of operations on the "shape" data type, using the restrictions of "well" data type.

Objects are class variables. Object-oriented programming allows you to easily create and use ADT. Object oriented programming uses the inheritance mechanism. The benefit of inheritance is the face that it allows obtaining derivative types from data types already defined by a user.

For example, to create Tetris shapes, it's convenient to create a base class Shape first. The other classes representing all seven possible shape types can be derived on its basis. Behavior of shapes is defined in the base class, while implementation of behavior of each separator shape is defined in derivative classes.

In OOP objects are responsible for their behavior. ADT developer should include a code to describe any behavior that would normally be expected from the corresponding objects. The fact that the object is responsible for its behavior, greatly simplifies the task of programming for the user of this object. If we want to draw a shape on the screen, we need to know where the center will be and how to draw it. if a separator shape know how to draw itself, the programmer should send a "draw" message when using such a shape.

The concept of OOP has a set of related concepts, including the following:

Simulated of actions from the real world

user-defined data types

Hiding the implementation details

Possibility of code reuse through inheritance

interpretation of function calls during execution

some of these concept are rather vague, some are abstract, others are general.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Object-oriented programming with ABAP Objects(基于ABAP对象的面向对象编程)是SAP开发平台ABAP中的一种编程范例。它利用面向对象的思想,将数据(对象的属性)和行为(对象的方法)封装在一起,以便更好地组织和管理代码。 在ABAP Objects中,可以定义类(class)来描述一个对象的特征和行为。通过类的实例化,可以创建具体的对象,并调用对象的方法来实现特定的功能。这种面向对象的编程模式使得代码更加模块化、可重用,并且更易于维护和扩展。 在ABAP Objects中,支持面向对象的四大特性:封装、继承、多态和抽象。封装可以将对象的内部状态和行为隐藏起来,只暴露必要的接口;继承可以通过创建子类来扩展和重用已有类的特性;多态可以实现在不同的对象上调用相同的方法,产生不同的行为;抽象可以定义接口规范,让具体的类去实现。 通过ABAP Objects,开发人员可以更加灵活地进行程序设计和实现,也能够更好地应对复杂的业务需求。同时,由于ABAP Objects与SAP系统集成紧密,因此可以很方便地访问和操作SAP系统中的数据和服务,为企业的业务流程提供更多的可能性。 总之,Object-oriented programming with ABAP Objects在SAP开发中扮演着重要的角色,它为开发人员提供了更加高效、可维护的编程模式,也为企业的信息化建设带来了更多的价值和机遇。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值