I am using Astah to create class diagrams (for a TypeScript application). I am trying to add a function keys that returns an IterableIterator of type T.
My problem is that every time I hit enter keys():IterableIterator<T> is changed to keys():IterableIterator<T, ?>. Am I trying to add it incorrectly (first time modelling generics or is this a problem/setting in Astah (the design tool I am using)?
Related
The ABAP documentation lists three kinds of modularization structures:
Methods. Problem: methods don't accept parameters.
Function modules. Problem: FMs belong to function groups and can be called from other programs. Apparently they are meant to be reused across the system.
Forms. Problem: are marked as "obsolete".
Is there a newer structure that replaces the obsolete FORM structure, that is:
Local to our program.
Accepts parameters.
Doesn't require ABAP Objects syntax ?
Methods. Problem: methods don't accept parameters.
I am not sure how you came to that conclusion, because methods support parameters very well. The only limitation compared to FORMs is that they don't support TABLES parameters to take a TABLE WITH HEADER LINE. But they support CHANGING parameters with internal tables, which covers any case where you don't actually need the header-line. And in the rare case that you are indeed forced to deal with a TABLE WITH HEADER LINE and the method actually needs the header-line (I pity you), you can pass the header-line as a separate parameter.
You declare a method with parameters like this:
CLASS lcl_main DEFINITION.
METHODS foo
IMPORTING iv_bar TYPE i
EXPORTING es_last_message TYPE bapiret2
CHANGING ct_all_messages TYPE bapiret2_t.
ENDCLASS.
And you call it either like that:
main->foo( IMPORTING iv_bar = 1
EXPORTING es_last_message = t_messages
CHANGING ct_all_messages = t_messages[] ).
or with the more classic syntax like that:
CALL METHOD main->foo
IMPORTING iv_bar = 1
EXPORTING es_last_message = t_messages
CHANGING ct_all_messages = t_messages[].
Function modules. Problem: FMs belong to function groups and can be called from other programs. Apparently they are meant to be reused across the system.
Yes, function modules are supposed to be global while FORM's are supposed to be local (supposed to: You can actually call a FORM in another program with PERFORM formname IN PROGRAM programname).
But classes can be local or global, depending on how you created them. A global class can be used by any program in the system. So function groups can be substituted by global classes in most cases.
The one use-case where function modules can not be substituted by methods of classes is for RFC-enabled function modules. RFC is the Remote Function Call protocol which allows external systems to execute a function module in another system via network. However, if you do need some other system to communicate with your SAP system, then you might want to consider to use webservices instead, which can be implemented with pure ABAP-OO. And they also offer much better interoperability with non-SAP systems because they don't require a proprietary protocol.
Is there a newer structure that replaces the obsolete FORM structure, that [...] Doesn't require ABAP Objects syntax ?
Here is where you got a problem. ABAP Objects syntax is the way we are supposed to program ABAP now. There is currently a pretty hard push to forget all the non-OO ways to write ABAP and fully embrace the ABAP-OO styles of writing code. With every new release, more classic syntax which can be substituted by ABAP-OO syntax gets declared obsolete.
However, so far SAP follows the philosophy of 100% backward compatibility. While they might try their best to compel people to not use certain obsolete language constructs (including adding scary-sounding warnings to the syntax check), they very rarely actually remove any language features. They hardly can, because they themselves got tons of legacy code which uses them and which would be far too expensive and risky to rewrite. The only case I can think of when they actually removed language features was when they introduced Unicode which made certain direct assignments between now incompatible types syntactically illegal.
You are having some wrong information there. Don't know what system version are you in, but this info could help you out:
Methods: They actually accept parameters (should be crazy if they wouldn't). In fact, they accept IMPORTING, EXPORTING, CHANGING and RETURNING parameters.
Forms: Indeed they are obsolete, but in my opinion there is no risk in using then, almost every standard component relies in programs made out of FORMS. FORMS are a core concept in ABAP programming. They are the "function" or "def" of many other languages. They accept USING, CHANGING and TABLES parameters.
I'm new to Elm, and have a basic question about the language.
The core function Basics.toString : a -> String has a native module (i.e. javascript) implementation.
It seems that by design Elm has no means to do run-time type inspection and no function overloading or, to put it another way, no ad-hoc polymorphism.
Am I correct in this assertion, and therefore that a native module implementation is the only way to implement any function like toString whose behaviour depends on the value of a type variable?
I'm not opposed to this, I can see simplicity such a constraint affords - I'm just wondering if I've understood things correctly!
I need to insert a 2D attribute and show it as a parameter of a function in my class diagram using Modelio tool.
In pure UML, you have to create a type intergerArray which will represent interger[0..n] then your parameter will be an array of this integerArray.
If you target a specific code implementation Java, C++ or C# Modelio, as any other tool generating code from Model, has a specific way to specify it.
You can ask it here https://www.modelio.org/forum/index.html
I'm using ELKI for the first time and I'm having a problem understanding it's structure. It seems that I need to do a lot to produce some results.
How can I perform PAM K-medoid clustering with custom distance measure?
Implement your distance function (see this tutorial)
The section "Basic distance function" is a minimal working example. Add the elki.jar, create this class, run the project in eclipse, and you should be able to choose this distance function in PAM.
Make sure it has either
a public, parameterless constructor (easiest), or
a public static class Parameterizer (see documentation)
so that it can be instantiated and configured by the GUI.
To make it appear in the UI dropdown, ensure it is either
in a folder on your classpath (development mode - just don't build a jar - easiest), or
in a .jar, and listed in the META-INF/elki/<interfacename> service file
or type the class name. But usually there is a mistake in step 2 if it doesn't show up in the dropdown; and the class cannot be instantiated.
Run PAM and choose your distance function in the dropdown.
The most common mistake is that people don't have a constructor the UI could use.
The constructor must be public and parameterless, or you need to add a parameterizer to specify the parameters.
I've read over internet some relevant information that in fact .Net provides possibility to create defined new dynamic type at runtime. First i thought its great news because my current application got hard-coded enum type defined in class. What my thought was i could create that enum usinf reflection and create his enum values from XML. Unfortunetly i tried to find some good tutorial but cannot find something could explain me enough how to do that. Can you give me either some good sample or redirect me to somwhere where i can obtain some knowledge how could i achieve that?