Jump to content

Black Pearl

Members
  • Posts

    410
  • Joined

  • Last visited

  • Days Won

    13

Posts posted by Black Pearl

  1. Looks really cool. :thumbup1:

    Did take me some time to follow the cycle from Paul's big paper through the other threads, and I certainly miss some of the discussions.

    A lot of half finished thoughts from my side, but I just throw them in the debate as fuel for all of you:

    Bidirectional Association of by-val classes

    This has kept me thinking for some time when studying the association meta-class of uml for my latest post on my blog. At first I was convinced that by-val design only allows uniderctional associations of classes. But theoretical thinking told me, that if class A contains class B, I can place class A in a LVObject in class Bs private data (inside the Get method). Later I then can retrieve class A back from B with a type cast and update the values of B inside A.

    If I read the code correctly, this is implemented between StateMachine and State. If so, thanks for the proof.

    Dynamic dispatch instead of enum/case

    This was discussed on the NI forum recently (I don't remember the thread).

    Basically, the traditional enum shift register and case structure design is completly replaced by dynamic dispatching. Again, if I understand this correctly, thanks for the demonstration.

    Readability of the design

    This is dating back to my first analysis of state machines. I did browse some text-based implementations of state machines. I think they used a very similar design. At that time, I felt the case/enum SMs in LV very superiour as they directly present me the code instead of the general state machine design.

    This is nothing if I have an up-to-date documentation in uml as presented. But getting to the concrete code takes me a couple of clicks more than when I use the traditional non-OOP approach. I would list this as a big con because I have to do a lot of 'cowboy coding' on customers site and neither have the uml tools available there nor the time for proper modelling.

    But I see that I have the possibility to attack a task by at least two ways: EITHER going through the state machine and accessing the concrete dynamic dispatch vi of Enty, DoActiitiy or Exit OR going through the class of the states and having in the PE for every class access to all three Activities.

    Now comes the theoretical stuff:

    state machine theory I: transisitons

    I checked the wikipedia entry on state machines. The mathematical modell suggests that a state machine has states, transisitions and an alphabet. From this, the state classes should not have access to the command queues (alphabet). Also they should not contain the transitions, tranisition logic and TransisitionActivity.

    state machine theory II: Entry state

    The initial state is also part of the state machine definition. So the private data cluster of the stateMachine class should contain a set (array) of state classes and an initial state (which is 'listed inside'/ 'an element of' the set of states (can you force this?).

    uml I: transisitions

    I just did have a very brief look at the state machines in the uml specs. Transisitons are seperate from States. The transitions are performed by the state machine meta-class and not the state meta-class.

    This is a bit tricky in the implementation, but described in the specs:

    • If the states DoActivity finishes execution, it's generating an event/trigger.
    • If a trigger is received by the SM, the DoActivity is aborted
    • Certain triggers can be deffered as an attribute (?) of the state.

    I didn't get all of this in my head at first reading, so propably anyone who mights try to improve the design be adjusting it to uml: Superstructure Chapter 15; Tranisitions 15.3.14; 15.3.11; current spec.

    uml II: pseudostates

    To get even more out of such a state machine design, we could target the list of pseudo-states. I consider all parallel process options to be really cool in LV, so fork and join could be nice to have. Even more I'm struggling with the concepts of Deep and Shallow History.

    uml III: orthogonal regins, sub-statemachines

    Now I'm really leaving my LV knownledg and completely focus on uml state machines. Is it possible to have a general (reusable) state machine class (and each specific state machine is inherited from this with it's own set of states)? Can we do a nesting of state machines (the top SM contains a state that contains another SM)? Can we find a deign to have two and more SM's running in parallel as 'orthogonal states', including proper mechanism to stop the others in case of severe errors in one of them?

    Ok, enough of theory. Hope this hobby of mine helps you to get projects out and is not just a waste of time. My professional work is completly non-OOP, non-uml.sad.gif

    Felix

    • Like 1
  2. Remember, with great power comes great responsibility. What do I mean by this? I mean that I'd like someone to finish writing the ElementWrapperRetooler.lvclass for me. :-) It's one of the classes that is now unlocked. That class is the start of a solution to "I have a class X that has another class Y as a private data member. I want to create a new method on X that has the same conpane as a method on Y but with all terminals of type Y replaced with terminals of type X. On the block diagram, I want to unbundle the Y, call Y's method, and if there's an output, put the Y back into my X cluster." This has been requested by many people over the four years since LV was released to accelerate development of the Delegate pattern and similar patterns, but I've never finished writing it.

    It's friday evening and it's raining outside:

    You made my weekend!

    That's even more than you revealed on the ni community in terms of presents for the 'scripting ninjas'.

    Now I need to send a PM to JGCode to thank him as well.

    Felix

  3. As far as I can read/understand Java code, it supports multiple inheritance for interfaces. So you were correct.

    Anyway, thanks for the citations you posted.

    The note you posted above about uml is not complete (superstructure 7.3.24 ) :

    * there is nothing that forces the methods to be abstract in the interface (it is mentioned for the properties!). -> I'm not clear with this.

    * Constraints (Pre- and postconditions) are forced to be implemented with the interface.

    * association can be forced by the interface.

    * An interface can redifine Interfaces (I don't know what redefine means, sorry -> I want to be able to tell you next week).

    * An interface can contain classifiers (thats really important, how to write a method which returns or accepts a MyCLassA as a parameter?)

    * It is somehow (I don't understand yet) possible to say that a class requires a certain interface. I see the use: I want to call MyClass.MyOperation(iMyInterface).

    As far as I see at the moment:

    * Interfaces can only have abstract methods

    * abstract class can have a mixture of abstract and implemented methods.

    * if you have abstract methods only (as by interfaces or pure abstract classes), you can allow multiple-inheritance.

    Also, turn it the other way:

    * an abstract class can contain some code ([re]used in the child classes). An interface not.

    * A very importantfeature is to call any object by it's interface.

    Felix

  4. I don't have my copy of Head First handy, but in UML can't the stereotype <<interface>> mean either the type or an api?

    From uml (Interface):

    As a classifier, an interface may be shown using a rectangle symbol with the keyword «interface» preceding the name.

    So it is only the type, not the API.

    Also, there is no stereotype <<interface>> in the standard profile.

    I also was wrong with my saying about the Interface is different than a class, interface is a child of classifier, as is the class. There is also a class called InterfaceRealization, this is the one that has a very different inheritance tree (Dependency, Abstraction, Realization).

    Felix

  5. @Dave/Daklu, the Adapter seems to be a very cool pattern for LVOOP, as a kind of substitute for the missing interfaces. I'll need to study them...

    Here a set of 'stupid' things (I just want to state that I'm not a wise old man but feel more like a babarian in the fine civilization of OOP) I gained from my studies on meta-modelling and OOP (just in case you might find them useful or like to discuss):

    * It seems that in the beginning of OOP interfaces and abstract methods/classes were about the same. You call an object by its abstract parent class or it's interface and don't care how it implements it's methods. How these are implemented (not the methods but abstract c/m and interfaces) is very much a language flavour.

    * In MOF (which is the metamodel of OOP), abstract classes are suggested like this (which is possible in LVOOP): Each package should provide a factory to return the classes. In case of an abstract class it should return a null-pointer (that's not possible in LV, but a default obj) and a NullPointerExeption.

    * In uml, interfaces are very different to classes in respect of their inheritance. I'm not yet into the details. But it is mentioned that they provide a facade to the class, so the facade pattern could be a way to go (I think that's Daklu's implementation, I also think about the adapter pattern at the moment).

    * In uml there is also another concept, I think it was called 'Substitutable'. It works like an interface in situation where you can't have interfaces (uml is meant to model also stuff outside programming; you can't model an electronic circuit by defining 'interfaces' the same way). Again, I haven't looked into the details.

    Felix

  6. To still feed the original topic - preferred uml tools:

    The developement of the eclipse uml2 tools has slowed down/stalled; it wasn't part of this years release (helios).

    However a new tool is on the horizon: papyrus mdt

    http://www.eclipse.org/modeling/mdt/papyrus/

    It didn't make it into the releas as well, but it can be downloaded as an add-on from helios. I've been playing around with a day for now, it seems a bit more powerful than the older uml2 tools. Still it is lacking user friendly design and also provides the classic open-source flaw: don't ask for documentation.

    If looking for a heavy-weight but free (open-source) option, check it out.

    It's even listed in the OMG's list for SysML (which is pretty short).

    Felix

  7. Just focusing on data types:

    Enterprise Architect (EA), for example, provides a dialog to create data types for a language. I have done this--it's very easy!--for LabVIEW basic types (not an exhaustive list--just what we need) and I will attach the resulting file. Just import it into EA (I can provide detailed instructions if necessary) to use it.

    The next level is to define more complex types and their rules. For instance, a LabVIEW cluster contains attributes but no methods and does not support inheritance. (Just for modeling purposes I just use a class and give it a cluster stereotype. It doesn't mean anything special to EA but it works well enough since I don't do code generation.) One could change the metamodel, but likely one usually implements this as a profile for the particular language, as you suggested. I think this is fairly straightforward, too. (I don't know for sure whether EA uses profiles here, but they support modeling and even code generation in 10 languages already.)

    Paul, is it possible that you export them as xmi, then I should be able to import them in my tools.

    On the implementation, I think I32, SGL, DBL, ... should be modelled as primitive types.

    Arrays would be modelled using the multiplicity, I would need to look up where this is inserted in the class hierarchy.

    Clusters would be of DataType: DataType is specialized from Classifier (same as Class) and has attributes. The advantage is that dataType does not have an identity.

    Enums would be LiteralEnumeration.

    More intersting would be how to model advanced and by-ref data types with their specific usages:

    * Communication types: User Events, Notifiers, Queues

    * For by-ref implementation: (single-element) queues, DVR

    The other work to be done in this field:

    using profiles (?) to disallow inheritance, methods (?)

    modelling polymorphism, type-casts, uml method ConformsTo() (then again maybe we need to modell this in OCL)

    implementing type def as a sterotype (?) <<type definition>>, maybe also for strict type def and private data cluster

    Felix

  8. Thank you Paul, I'll give SysML a higher priority. Apart from it's usefulnes to system engineers (in my case I could be classified as system integrator, writing software with LV is just a part of my job, my favorite actually), it opens an interesting technical perspective.

    As I wrote previously, I think there is a good chance that it is possible to make uml match LVOOP using profiles (for those who are not into the uml syntax: it's a way to extend uml and it's part of the core specs). Profiles allow you to restrict uml, e.g. to disallow multiple-inheritance. If SysML is introducing new diagrams on profiles alone, it should also be possible to implement LV specifics (extending instead of restricting).

    The concept of uml-profiles is still above my uml knownledge, but I think both objectives are possible to realize. This leaves two obstacles towards an uml-LVOOP interface:

    * Is this sufficient to describe data-flow/by-val classes (would it be sufficient to say that an attribute or a class is by-val?)

    * How about the availability of tools that correctly implement profiles (I know that uml2 tools for eclipse had said something about implementing it).

    Second point on Pauls topics: requirements tracing.

    I don't question the benefits of this, but without a punishing force (regulated industries) you won't find it. Personally, I've seen it practiced once and plenty of examples where it can't be implemented. Here I wonder if a hybrid solution would be acceptable by those that practice it. By hybrid I mean if a uml/LVOOP code-generator and reverse-engineering tool would place the trace-elements in an own format (like vi scripting tags) and map that to SysML or uml notes/sterotypes/artifacts?. The main interface is already defined by XMI.

    And how huge would be the effort to get such a process certified?

    On the general request on NI's involvement:

    I'm really in favour of pushing NI towards the uml standard. But I don't expect and I don't want them to show to much activity on this side at the moment, they just should be aware of this. One of the main reasons is, that I'd like them to focus on LVOOP developement (which only they can do) and burden such tasks as interfacing uml to the community (that's not free-of-charge, see endevos uml modeller, but you can do it without root-access to the LV-code). At later stages (that's why I want to push them), they are needed like to make an uml-profile an accepted standard for LabVIEW and maintaining it for new uml specs.

    On community needs:

    All the discussion here shows a very, very broad range of priorities in the LV/uml integration. I'd like to get more grip on this, then I could design some polls on the community page. The one direction is not new to uml, usage: reverse engineer, code-generation, documentation, modelling, fetish/abuse, consulting, conforming to a standard. The next is about budget (beside money this is also the time to learn using the tool). Also completness is an issue, do you need all diagrams or just the class-diagram (do you really need a state-chart or just a state-diagram?)? Or do you need a broader scope (SysML is one option, I personally use dia which isn't good for uml but has a lot of other diagram formats as well).

    Felix

  9. [..]

    modeling requirements in SysML

    [..]

    I've stumbled on the keyword 'SysML' recently and added it to my (ever growing) 'must know' list. Can you please provide me with a short abstract focussing on what it can be used for.

    Felix

    Edit: I'd like to see you promoting your IE suggestion on the community page as well.

  10. I did create a community group for uml on the dark side:

    http://decibel.ni.com/content/groups/uml

    This thread is of course refered there.

    You're all invited to join, but I'll stay on LAVA as well of course.

    I'll try to do more on the LabVIEW/uml frontier the next month. I think this is a really interesting issue, as the graphical nature of uml is actually favouring our minds experienced with graphical software engineering. On the other hand, uml is condensing a bunch of OOP concepts that are not yet represented in LVOOP (interfaces, abstract classes...). And to even think bigger, uml has some concepts intended to bridge the gap: on the one hand it could be necessary to try to reuse the infrastructure only and develop a modelling language on it's own via CMOF or EMOF in parallel to uml to comply with the LVOOP native by-val syntax. On the other hand, a subset of LVOOP (by-ref design) could be modelled using the profiles packages that are in both Infrastructure and superstructure of the uml specs.

    But it must admit that I'm just to much in my early steps on both uml and LVOOP to see the way to go. But I'll be bloging in the community mentioned above about my uml-findings (it's pretty dry but philosophical stuff, best digested with some dry red wine!).

    Felix

  11. index.php?app=downloads&module=display&section=screenshot&id=140

    Name: quick create a new vi from template

    Submitter: Black Pearl

    Submitted: 14 Aug 2010

    File Updated: 03 Jan 2011

    Category: *Uncertified*

    LabVIEW Version: 7.1

    License Type: BSD (Most common)

    Installation:

    Copy the contents to LabVIEW xxxx/resource/plugins

    Abstract:

    Speed up creating new vi's from templates!

    It's using the 'new vi'-hook to create the new vi from a custom template. A plugin architecture allows to map different templates to the keyboard.

    For a quick-start, try Ctrl+N followed by 'H' (without releasing the Ctrl key).

    Detailed Description:

    When using

    • New -> Blank VI from the Startup Window
    • File -> New VI from the menu of any vi
    • or the Ctrl+N shortcut
    the lv_new_vi.vi hook is called.
    Releasing of the Ctrl key (when using the shortcut) uses the Default.vit. The next key-press k creates a new vi from the template [...]/plugins/lv_new_vis/templates/k.vit. This is case insensitve and only works with a..z and SPACE. If no template is found or if an error occures, the default action of LabVIEW (empty vi) is performed (Failsafe).
    In addition to normal vi templates it supports global vi templates and control templates.
    Even more customization is possible using special tags on the vi or vit. Use
    [...]/plugins/lv_new_vis/tools/lv_new_vi__TagEditor to read and set them:
    • isBD_ToFront? bring the block diagram in front instead of the front panel
    • isRunMe? will instead run the vi in the template folder. Use this for wizards, more sophisticated scripting and other dialogs.

    Examples (V0.9.3: seperate ogp package):

    Try the following keys to see the different possibilities:

    • f: normal vi, FP at front
    • b: BD at front
    • g: global vi
    • c: control
    • w: wizard
    • h: help

    You do not need to delete the demo templates, a w.vit will load even with w_example.vit present.

    Compatibility: Developed in good old 7.1 and tested with 2010. I don't know if it works nicely with the project explorer and did never try to use it with projects, libraries and classes.

    Planned Features:

    * Error logging

    * Redirections via Config file (I will link the standard templates) (Edit: It's faster to just place them in the templates folder.)

    V 0.9.1

    Fixed issues with the Application Instances of LV8.0 and higher.

    Wizards are still launched in the diaolog App.Instance, they need to get the default App on their own.

    V 0.9.2

    Changes: Closing all references

    Beta: Uses VI Activation Event to abort when the user switched to a different app. (See discussion for details).

    V 0.9.3

    Uses VI Activation Event to check Ctrl-Key when user switches from a diffrent application.

    Now available as packages (ogp). Uses a seperate package for the examples.

    V 0.9.4

    Fixed issues with 0.9.3: After start of LV, Ctrl+N didn't work the first time

    Enjoy, Felix

    Click here to download this file

    • Like 2
  12. Ton, very nice you discovered this. I have seen a behaviour in LV 7.1 (so unsupported and I never tested it on newer versions + several bug-fixes in LV8 on events) that is similar:

    Two user events directly fired one-by-one the later one was missed when I used some event structures (at least two in SubVIs, most likely another one in the main vi). Using an wait 0 between removed this problem.

    I will see on monday if I still have the code and check it with a recent version. If you have, please post a CAR so I can refer to if my issue is the still persistent, 'cause it might be related (too slow event structures).

    Felix

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.