简体   繁体   English

过渡到 OO ABAP?

[英]Transition to OO ABAP?

It appears that most of our SAP programmers are using the old version of ABAP, the one before object-oriented stuff.似乎我们的大多数 SAP 程序员都在使用旧版本的 ABAP,即面向对象之前的那个版本。 I also noticed that the language is much cleaner and more modern with OO (they apparently took the opportunity to get rid of deprecated things).我还注意到,面向对象的语言更简洁、更现代(他们显然借此机会摆脱了不推荐使用的东西)。

As the system is not rolled out yet, the time to make any redesign is now rather than later.由于该系统还没有推出,现在进行任何重新设计的时间都不是很晚。

It is worth requesting that new code be written as OO ABAP programs?是否值得要求将新代码编写为 OO ABAP 程序? How to sell that to management?怎么卖给管理层? Does the interface with non-OO programs work well?与非 OO 程序的接口是否运行良好?

(updated to note that I'm talking specifically about the new code, especially planned for the next year) (更新以注意我是专门讨论新代码,特别是计划在明年)

If it's working in production, don't rewrite your code.如果它在生产中工作,请不要重写您的代码。 Not worth the time or money, and no management (at a company big enough to be running SAP) would agree to it.不值得花时间或金钱,而且没有管理层(在一家足以运行 SAP 的公司中)会同意它。

Unless you move to a green field environment, you're never going to get everything re-written in OO.除非你搬到一个绿色的环境,否则你永远不会用 OO 重写所有的东西。 SAP hasn't even done that with their core ECC modules. SAP 甚至没有用他们的核心 ECC 模块做到这一点。 Expecting to be able to do it with your custom stuff is unrealistic.期望能够用您的自定义东西来做到这一点是不现实的。

I would just read up on OO ABAP and start writing new programs with it.我只会阅读 OO ABAP 并开始用它编写新程序。

OO ABAP and procedural ABAP work together just fine. OO ABAP 和程序性 ABAP 一起工作得很好。 You can call classes & methods from procedural programs and (more limited, but) vice versa.您可以从过程程序中调用类和方法,并且(更多限制,但)反之亦然。

We develop a lot of new, fresh, ABAP code to our customers, and the use of ABAP OO is growing slowly, but still growing.我们为我们的客户开发了很多新的、新鲜的 ABAP 代码,ABAP OO 的使用增长缓慢,但仍在增长。

It's easier to convince new developers to work with ABAP OO, because there is a lot less to learn.说服新开发人员使用 ABAP OO 更容易,因为要学习的东西少得多。 Also, writing code using OO ABAP enables the correct use of design patterns, highly effective unit testing, UI abstraction (eg SAPgui and WebDynpro or SAP Console), and reduces documentation a lot.此外,使用 OO ABAP 编写代码可以正确使用设计模式、高效的单元测试、UI 抽象(例如 SAPgui 和 WebDynpro 或 SAP 控制台),并大量减少文档。

Also, as some people said before, SAP isn't rewriting their codebase to ABAP OO.此外,正如一些人之前所说,SAP 不会将他们的代码库重写为 ABAP OO。 But they surely given a try by rewriting ME51N from ME51, ME21N from ME21 and SBWP from SO01.但是他们确实尝试了从 ME51 重写 ME51N、从 ME21 重写 ME21N 和从 SO01 重写 SBWP。

Also, all the new APIs from SAP, like ABAP Unit, ABAP Proxy, the new ALV, WebDynpro for ABAP and the all-new Enhancement and Switch Framework are good examples (I think) on why you should give some attention to it.此外,来自 SAP 的所有新 API,如 ABAP Unit、ABAP 代理、新的 ALV、用于 ABAP 的 WebDynpro 以及全新的增强和切换框架都是很好的例子(我认为)说明为什么你应该关注它。

It depends on the size of the programs to be written.这取决于要编写的程序的大小。 If it is a large "system" without too much database interaction, there may be some benefits.如果是一个没有太多数据库交互的大型“系统”,可能会有一些好处。 For smaller programs, I don't see any advantages of "objectifying" the code.对于较小的程序,我看不到“对象化”代码的任何优势。

It also depends on the skill and preferences of the developers.它还取决于开发人员的技能和偏好。 If they want to "OO", there may be better environments.如果他们想“OO”,可能会有更好的环境。 If they're stuck in their "old procedural" ways of thinking, there may be other ways to improve the code than switching to OO.如果他们坚持“旧的程序”思维方式,那么除了切换到面向对象之外,可能还有其他方法可以改进代码。

One example I'm commonly seeing is the discussion of "what should the database do" (eg joins, sorting, grouping) vs. "what should I do in code".我经常看到的一个例子是“数据库应该做什么”(例如连接、排序、分组)与“我应该在代码中做什么”的讨论。

I just found a copy of the white paper Esti mentioned at the SAP SDN: Not Yet Using ABAP Objects?我刚刚找到了 SAP SDN 中提到的 Esti 白皮书的副本: 尚未使用 ABAP 对象? Eight Reasons Why Every ABAP Developer Should Give It a Second Look 每个 ABAP 开发人员都应该重新审视的八个理由

This paper gives a brief insight in the benefits of using ABAP OO.本文简要介绍了使用 ABAP OO 的好处。

Old, classic reports often contain redundant codings.旧的、经典的报告通常包含冗余编码。 Different reports have been built with much "copy and paste".使用大量“复制和粘贴”构建了不同的报告。 Try to find which things are redundant and then pull them - step by step - out of these reports into new global, reusable, well-designed classes and make the old reports more tight by replacing existing code with "call method"s to central definied and well-tested OO-logic.尝试找出哪些是多余的,然后将它们——一步一步——从这些报告中提取到新的全局、可重用、设计良好的类中,并通过用“调用方法”替换现有代码来使旧报告更加紧凑,以中央定义和经过良好测试的面向对象逻辑。

Try finding a copy of the white paper:尝试查找白皮书的副本:

Not Yet Using ABAP Objects?还没有使用 ABAP 对象? Eight Reasons Why Every ABAP Developer Should Give It a Second Look by Horst Keller and Gerd Kluger . Horst Keller 和 Gerd Kluger 为每个 ABAP 开发人员重新审视它的八个原因

Some of the biggest advantages for SAP OO, particularly with new SAP developers is that it forces you to be a lot more explicit that procedural ABAP. SAP OO 的一些最大优势,特别是对于新的 SAP 开发人员,它迫使您比程序化 ABAP 更加明确。 It makes written code a lot more maintainable and may feel more familiar to programmers coming from a more mainstream background.它使编写的代码更易于维护,并且对于来自更主流背景的程序员来说可能会感觉更熟悉。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM