Using $1, $2, and $n variables in your code not only makes the code less readable, it can also increase confusion since the human brain can find it difficult to remember what these variables correspond to. The solution is to create a variable with an understandable name and assign it the value of $1, $2, or $n.
4D v18 R5 has good news, you can now name your parameters when declaring:
- a project method,
- a trigger
- a database method
- a form method
- a constructor of a class
- a function of a class.
Let’s see how!
by guest author Tiran Behrouz, 4D developer (Vancouver, Canada)
The introduction of ORDA in 4D v17 was a game-changer. Now with the introduction of classes in 4D v18 R3, we will witness a paradigm shift in 4D programming. We can now take advantage of object-oriented programming concepts such as polymorphism, composition, and inheritance to write our own class libraries. In this video, I demonstrate how to code a simple TimeStamp class using 4D and ORDA.
By now you’re aware of the availability of ORDA classes. In this blog post, you’ll learn a few handy tips to get the most out of them!
Let’s see it in action!
In a previous blog post, we introduced you to the world of ORDA data model classes. Now it’s time to get our hands dirty and learn more!
You already know that ORDA’s structure (datastore, dataclass, entity, entity selection) is made up of objects. But they’re not just objects, they’re strongly-typed objects linked to specific ORDA classes. This means that you can write functions to hide the complexity of your data’s physical implementation.
ORDA was a revolution with 4D v17. It opened a whole new world of possibilities and took you to another programming dimension. A dimension where you can easily develop applications using an object-oriented approach.
We didn’t stop there! We continued to add enhancements to ORDA through a set of features in each subsequent feature release. Now with 4D v18 R4, we’re thrilled to be going another step further with the availability of ORDA data model classes. Classes dedicated to your data model.
This will greatly elevate your code. Your applications can now easily expose services, be more manageable and easier to maintain, and seamlessly integrate with other applications.
This is another big feature made possible thanks to the projects!
In a previous blog post, we introduced a very important concept in object-oriented programming: Classes. Now we’ll go through another core concept: Inheritance, the mechanism that allows a class to acquire the behavior of another class.
Many of you have have been asking to be able to define an object type ever since the Object type became available. Thanks to object notation, many of you dream of having object functions. Dream no more and say hello to classes in 4D v18 R3 project database! In this blog post, we’re introducing one of the most interesting concepts of object-oriented programming … along with a database example and a bonus video!
Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!
* Your privacy is very important to us. Please click here to view our Policy