ABAP 直升机视图

发布于 2024-08-19 08:29:23 字数 1436 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

椒妓 2024-08-26 08:29:23

它(总是)编译吗?

ABAP 被“编译”成一种字节码(由于历史原因称为“加载”),然后由内核内的虚拟机执行。您可以将其与 Java 进行比较,有一个很大的区别:负载不是独立于机器的,而是针对目标机器类型进行了优化。这意味着在具有多种不同类型的应用程序服务器的系统环境中,您可能会对单个程序有多个预编译加载。您不会看到任何这些 - 整个编译过程是自动处理的。

Typestem:它是强类型的吗?它使用类型推断吗?

强类型,顶部有泛型类型系统。请注意,该语言中集成了一个完整的数据字典 - 非常方便。

继承:单个/多个、类似接口的结构?

单一继承。支持接口,包括复合接口和实现组件重命名(两个接口IF_FOO和IF_BAR都可以定义一个方法BAZ,实现这两个接口的类将有两个方法IF_FOO~BAZ和IF_BAR~BAZ)。

集合:除了数组之外还有集合吗?有通用集合吗?它使用列表理解吗?

你所知道的其他编程语言中的“数组”在ABAP中并不真正存在——你通常会使用所谓的“内部表”来代替。想想类似数据库的结构化内存表。有一些集合类的想法分布在不同的模块中,但执行此操作的规范方法是使用内部表 - 定义所谓的表类型行,这些行要么表示对实例的引用,要么表示包含此类引用的结构。

数组、返回类型、参数类型、重写中的(con/contra/in)方差怎么样?

数组:见上文。重写:实现接口方法或重写超类方法时不能更改方法签名。至于参数 - 这取决于您是否传输数据(或数据引用)或对象引用。一般来说,向上转换可能会隐式发生,而您必须显式执行向下转换。

有异常处理吗?

是的。不止一种方式 - 再次出于历史原因(向后兼容性)。支持基于类的异常。

有合同支持的内置设计吗?

据我所知,没有。

与其他众所周知的语言相比,有什么值得注意的地方吗?

很多东西。您可能需要检查 http://www.volker-wegert.de/en/node/ 17http://www.volker-wegert.de/en/node /21 承认有偏见的概述:-)

Is it (always) compiled?

ABAP is "compiled" into a sort of byte-code (called "load" for historical reasons) that is then executed by a virtual machine inside the kernel. You can compare this with Java, with one big difference: The load is not machine-independent, but optimized for the target machine type. This means that in a system landscape with several different types of application servers, you might have multiple pre-compiled loads for a single program. Not that you'll ever see any of this - the entire compilation process is handled automatically.

Typestem : Is it strongly typed? Does it use type inference?

Strongly typed with a system of generic types on top. Note that there's a complete data dictionary that is integrated into the language - very handy.

Inheritance : single / multiple, interface-like structures ?

Single inheritance. Interfaces are supported, including composite interfaces and implementation component renaming (two interfaces IF_FOO and IF_BAR can both define a method BAZ, and a class implementing both interfaces will then have two methods IF_FOO~BAZ and IF_BAR~BAZ).

Collections : Has it collections apart from arrays? Has it generic collections? Does it use List comprehension?

What you know as "array" in other programming languages does not really exist in ABAP - you'll usually use so-called "internal tables" instead. Think database-like structured in-memory tables. There are some ideas of collection classes spread out through different modules, but the canonical way to do this is to use internal tables - define a so called table type of lines that either represent references to instances or structures that contain such a reference.

How about (con/contra/in)variance in arrays, returntypes, parametertypes, overriding?

Arrays: see above. Overriding: You can not change the method signature when implementing interface method or overriding superclass methods. As for the parameters - that depends on whether you transfer data (or data references) or object references. In general, upcasting may happen implicitly while you have to perform the downcasting explicitly.

Any Exceptionhandling?

Yes. More than one way - again for the historical reasons (backward compatibility). Class-based exceptions are supported.

Any build in design by contract support?

None that I'm aware of.

Anything remarkable as oposed to other well known languages?

Lots of stuff. You might want to check http://www.volker-wegert.de/en/node/17 and http://www.volker-wegert.de/en/node/21 for an admittedly biased overview :-)

纸短情长 2024-08-26 08:29:23

我将尝试提供一些以前的回复没有提供的内容,同时跳过他们确实提到的内容:

它(总是)编译吗?
好吧,程序员的界面说“激活”,而不是编译,但那是因为有内置的版本管理。当您激活某些内容时,它会对其进行编译,并使源版本和二进制版本成为“活动”版本。如果有人尝试运行未编译的源代码,它将在运行时自动编译。

Typestem:它是强类型的吗?
基本上,是的。 ABAP 就像 Pascal 和 COBOL 之间的奇怪交叉。有“字段符号”,就像指针一样。现在也有通用类型。 (和通用字段指针)。最酷的事情之一是 ABAP 类型和数据库类型之间没有区别。您创建的任何表格都会自动成为结构类型。也就是说ABAP与数据库的集成方式几乎是其他语言所没有的。您还可以编写 SQL,它实际上是 ABAP 的一部分,而不是像其他语言那样只是一个字符串。

继承:单个/多个、类接口结构?
有接口结构,我一般不使用它们。如果您创建了很多可重用的类,那么它们将是一个好主意。

集合:除了数组之外,它还有集合吗?有通用集合吗?它使用列表理解吗?
更好的是,它有“内部表”,它基本上是一种动态数组。它们几乎可以从任何类型声明,包括数据字典中的类型。它们可以循环、排序等。有多种类型,包括散列和排序变体。

有异常处理吗?
OOP 和非 OOP 类型。

与其他众所周知的语言相比,有什么值得注意的地方吗?
正如另一位海报所说,很多。它非常擅长与数据库操作以及重用复杂结构和数据类型有关的任何事情。它自然是跨数据库和跨平台(操作系统和处理器)。它有一个非常好的版本管理和传输系统。整个SAP系统有非常好的多语言支持。您可以自动获得带有适当标题和选择框的简单屏幕,这意味着您可以进行更少的编程和更多的工作。您不必在数据库类型和语言类型等之间进行映射。
它不太擅长的事情:
1. 数字通常存储为 ASCII,这使得在许多应用程序中数学计算速度不够快。
2. 大多数数据结构都非常规范化,这意味着您的数据有时可能分布在 50 个表中。 “星级”查询很常见。在这些情况下,用于检索数据的内置函数(例如逻辑数据库)是您的朋友。
3. SAP 试图成为每个人的一切,因此有很多配置选项等,有时一个功能不会根据过去的行为执行您期望的操作。
4.ABAP有时非常冗长。尝试在 GUI_DOWNLOAD 这样简单的东西上使用“模式”按钮。
5.SAP对他们所承担的任务非常雄心勃勃,因此很早就遇到了硬件、操作系统和RDBM系统的限制。因此,他们有一些遗留下来的问题来处理,但效果并不好。 (台球桌、集群桌等)
6. 当您激活程序时,它不会对所使用的功能模块进行全面的兼容性检查。在某些情况下,某些东西会毫无问题地激活,但随后在运行时崩溃,即使它可能在编译时被捕获。

I'll try to provide some things the previous reply hasn't, while skipping what they did mention:

Is it (always) compiled?
Well, the interface for the programmer says "Activate", not compile, but that's because there is built in version management. When you Activate something, it compiles it, and makes the source and binary versions the "active" version. If someone tries to run source that isn't compiled, it will automatically be compiled as they run it.

Typestem : Is it strongly typed?
Basically, yes. ABAP is like a strange cross between Pascal and COBOL. There are "Field Symbols", which are like pointers. There are also now generic types. (And generic field pointers). One of the coolest things is that there is no difference between ABAP types and Database types. Any table you make will become a structure type automatically. That is to say, ABAP is integrated with the database in a way that almost no other languages are. You can also write SQL, which is actually part of the ABAP, as opposed to being just a string, like in other languages.

Inheritance : single / muliple, interface-like structures ?
There are interface structures, I don't usually use them. If you made a lot of re-usable classes, they would be a good idea, though.

Collections : Has it collections apart from arrays ? Has it generic collections? Does it use List comprehension ?
Better, it has "Internal tables", which are basically a type of dynamic array. They can be declared from almost any type, including those in the data dictionary. They can be looped, sorted, etc. There are several types, including hashed and sorted variants.

Any Exception handling?
Both OOP and non-OOP types.

Anything remarkable as oposed to other well known languages?
As the other poster said, a lot. It is very good at anything to do with database operations, and re-using complex structures and data types. It is naturally is cross-database and cross-platform (OS, and processor). It has a very good version management and transport system. The whole SAP system has very good multi-language support. You can get simple screens with appropriate titles and selection boxes automatically, which means that you can do less programming and more work. You don't have to map between DB types and language types, etc.
Things it's less than good at:
1. Numbers are typically stored as ASCII, this makes it less than fast at math in many applications.
2. Most of the data structures are very normalized, meaning your data may be spread across 50 tables sometimes. "Star" queries are very common. Built in functions to retrieve data (f.e. Logical Databases) are your friend in those cases.
3. SAP tried to be everything to everyone, so there are a lot of configuration options, etc., and sometimes a function doesn't do what you expected it to based on past behavior.
4. ABAP is sometimes very verbose. Try using the "pattern" button on something simple like GUI_DOWNLOAD.
5.SAP was very ambitious with what they took on, and thus ran into limitations of hardware, operating systems, and RDBM systems early-on. Thus, they have legacy kludges to deal with it that aren't pretty. (Pool Tables, Cluster tables, etc.)
6. When you activate a program, it doesn't do full compatibility checking with the function modules used. There are situations where something will activate with no problem, but then crash at run-time, even in cases where it could have been caught at compile time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文