Hello guys, so i have a fundamental doubt. i been working with x++ for the past few days in project from work. but i dont get some of the functionality of x++.
practical example :
i have to parse a file(flat text .txt)
the first line of the file is the HEADER : 232828278928cjeueocjJefreymark2872
the second one is a paymente registry : 839829209302vjieujhc28290vmneike
and there are a few other lines that have other type of registries.
so my job is to parse every line(from char 0 to char 11 is the account number for example) and to save that info into variables(and update some tables). that part is okey.
between header and the other lines there is some common fields, what i d normally d do in c#
is create BASE class that has all the common fields and the method that parse those fields, then create a class HEADER,PAYMENTS and all the other lines that inherents from BASE so i d reuse the fields and the PARSE code instead of writing that every time.
the problem i found is that the classes in x++ dont seem to be made that way. every class is for a independent process and independent feature. is not used as a normal Object-oriented language d use it.
at least not the way i see it. could you tell how this is done properly in ax?hope you get what im trying to explain my english is not very good.
thanks
*This post is locked for comments
Using good object-oriented design can't harm. :-)
Nevertheless don't pretend that if you know the language, you know how to use it in all situations. If you know C#, you may know nothing about developing ASP.NET MVC, for example.
AX has some specific and some ways how dealing with them. For example, you can easily call X++ methods on another machine (client <-> server), but it obviously takes much more time than calling normal methods. To avoid excessive client/server calls, AX has some patterns and frameworks, e.g. to collect user input on client, pack it, send it to server and do all processing there. If you're not aware of why it's done, it may make no sense to you.
Great to know . " It's also not true at all that every class is for an independent process - on the contrary, many processes use dozens of classes and some (general-enough) classes are used in thousands of processes.
I agree that a lot of code in AX isn't very object-oriented, but it's fault of developers, not of X++. You don't have to, and shouldn't, follow bad patterns in code AX codebase." this part was really helpful, i ll do everything as it was c# not worrying about how its actually done in the AX codebase. the ax codebase was what was troubling me. TY :)
What exactly do you miss in X++ regarding classes? It's all normal - inheritance, polymorphism, interfaces, you name it. I didn't get what else you need. Of course, you won't find many features that you're used to in C#, but none of them is necessary for OOP.
It's also not true at all that every class is for an independent process - on the contrary, many processes use dozens of classes and some (general-enough) classes are used in thousands of processes.
I agree that a lot of code in AX isn't very object-oriented, but it's fault of developers, not of X++. You don't have to, and shouldn't, follow bad patterns in code AX codebase.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,963 Most Valuable Professional
nmaenpaa 101,156