I am going to be creating a model editor, and I am considering using GMF. The editor will need to handle state machines (UML-based syntax, but not identical), which means concurrent regions.
I would prefer to model concurrent regions like this: http://upload.wikimedia.org/wikipedia/en/thumb/a/aa/UML_state_machine_Fig4.png/660px-UML_state_machine_Fig4.png
Does anyone know if this is possible in GMF? I have been trying to find examples where people have done this and could not come up with anything. And I really want to know if this is possible (or requires a bunch of hacks) to implement before I begin development.
Of course it's possible. It's a GMF feature called compartments which allows editors to have nested elements.
Take a look, for example, at:
Hierarchical model in GMF
GMF tutorial
Related
I have relatively large traffic map, so if I try to edit the car spawning/routing/exiting/logical branching controls and move them around, the editor reacts slowly. I would probably prefer using text editor, so I can insert the values in bulk, (and then do something else while the editor is dealing with it) and also take bigger advantage of copying text.
However, I do not know where to find it. Any help? Or does AnyLogic allow only graphical editing?
For graphical editing, there are 2 options here:
You can easily split your model into chunks. Either put them into different agent types or even across several models. Much lighter during development using the GUI. And the latter even allows working with several people in parallel.
The former is easier to setup, though.
If you want to get into developing models without any graphical editing, this is also possible. See my AnyLogic workshop on the topic as a starter. You need to have a solid foundation in OOP and Java though.
I am programming a plug-in that uses a virtual tree-like file-structure. Basically it acts just like a standard filesystem containing files, with the difference that these files do not actually exist in a specific location in the filesystem but rather are mere java objects.
These are currently supported by the navigator (a custom implementation using the Common Navigator Framework) using a SettingProvider, and interaction with these Objects is implemented just like interaction with standard files.
However, it is necessary to stick markers to these Objects now. As I understand the Eclipse framework, markers can be attached to *IResource*s only, so in order to achieve this goal, instead of using *SettingProvider*s, I should create instances of IResource.
However, the standard implementation only allows creation of resources from the filesystem. Since things like virtual folders exist, there must be a possibility to create virtual resources, i.e. resources without an actual location in the filesystem.
But how can I do this? My research seems to be leading nowhere...
Alternatively, is there a possibility to achieve the desired functionality (sticking markers to objects in a CNF navigator) in a different way?
Thanks in advance!
Right, markers can only be attached to resources in the workspace. To implement a custom filesystem, Eclipse provides the EFS-mechanism, to provide a "file-like" structure, for further information see http://wiki.eclipse.org/EFS - on this page you'll also find links to example implementations which should give you an idea how to implement your own filesystem contributor.
BUT: IMHO it is the wrong approach to use Eclipses marker system for your scenario. All stuff is very tight coupled to the workspace model which does not work well with a custom data model. From my experience the best is to
have your own marker-model which fits exactly to your data model,
implement a decorator for your tree (via extension point)
implement something similar like the Problems-view to visualize markers.
Although is sounds a bit odd to implement something similar that is already there it will save you a lot of headaches cause your scenario is not restricted by the boundaries of the workspace model and api.
I do have an iPad application which is customized for different customers in regards to color scheme, logos and other items.
I already created different targets where I defined #ifdef macros accordingly, and most variables are defined in a global.h file for easy maintanance.
Do you have any other useful suggestions I should consider at this time, especially as in the future there will be updates available - but not all new features will be avaialble to all clients?
Firstly, if you don't do that already, use the branching feature of your versioning system to handle different client needs, i.e. if one client wants an additional feature, don't (automatically) contaminate your master code base.
What you can also do is encapsulate all configurable features of your app. A very simple approach would be to create a configuration .plist or other kind of XML where you can easily configure adaptable features.
Mainly, if it's possible, try to extract all customizable features out of the primary code base. Load customizable data from easily editable files like XMLs, to make sure you don't accidently break something while configuring for a client.
You could totally abstract out all of the customizable elements and create a library of the remaining code. Each customer's App would then just instantiate that library and feed in their own customized elements. That way you don't have to change any code when you build the App for a new customer. You also get the benefit of having all the changes between customers located in one area and it also makes the code more testable.
If a customer doesn't get a feature, then you just feed in a null value (or equivalent)
This ideas is basically Inversion of Control
I like to convert reusable components into frameworks. This way you can expose customizable options and hide all of the complex code.
Another option would be to create a workspace. This would allow you to open projects within it and share their assets with the main workspace files.
There are some Topics on Stackoverflow already related on how to model different Threads in UML, for example: Is there an inituitive UML approach to depict threads.
However I still feel, that my case has not been already discussed, even though it should be pretty common:
I am creating an iPhone Application, where I am obviously have a Main-UI-Thread and I am also using Background-Threads to perform Remote-Calls, etc. I basically have 4 different aspects that I like to display within my diagramm:
The UI that is shown to the User.
The Tasks that are being performed by the Main-UI-Thread (therefore blocking the UI)
The Tasks that are performed by Background-Threads
Updates of the UI, which are performed by the UI-Thread, but can be triggered by Background-Threads. For example: new Information loaded from Server, which needs to be displayed on the UI
Has anybody ran into a similiar issue and therefore might show me an example or give me some best practises on how to solve my problem? I am not even sure if I should use a sequence-diagram, an activity-diagram or maybe even some other type.
Well Pascal,
This is not an UML question. It is a design question.
UML just helps you
To understand hard and crtical section of your program/design and to
explore alternative solutions , while writing your code. with the power of visual modeling.
So..
First, ask yourself what kind of parallelism or concurrency exist in
your problem? To investigate this:
Draw a simple activity diagram with partions in which each partions
used to represent different operating system threads or processes.The
object nodes can be used to model the shared objects and data.Forking can be used to model the creation and parallel execution of multiple threads or processes.
Then ask yourself(using that diagram)
What are my shared data? What are my active classes? (threads)What kind of "concurency" problems" may
accour? What may go wrong? What are synronization points? etc..Based on this Explore different alternatives, designs.
The last thing you should worry is UML and its sytax(symbols).
The best UML diagrams are the one that wake up the desire of "asking question" in your mind.
At first forget about Uml. Ask core questions about your problem. If you like visual modeling and your mind like visual thinking use Uml for better understand and investigate possible design solutions.
UML can not design for you...
I found this research papers while searching for same thing
M-UML: an extension to UML for the modeling of mobile
agent-based software systems
May be it can help you
I've noticed in pretty much every company I've worked that they have a common library that is generally shared across a number of projects. More often than not this has been a single companyx-commons project that ends up as a dumping ground for common programs including:
Command Line Parsers
File Utilities
Framework Helpers
etc...
Some of these are well thought out and some duplicate functionality found in Apache commons-lang, commons-io etc..
What are the things you have in your common library and more importantly how do you structure the common libraries to make them easy to improve and incorporate across other projects?
In my experience, the single biggest factor in the success of a common library is user buy-in; users in this case being other developers; and culture of your workplace/team(s) will be a big factor.
Separate libraries (projects/assemblies if you're in .Net) for different application tiers is essential (e.g: there's obviously no point putting UI and data access code together).
Keep things as simple as possible; what you don't put in a common library is often at least as important as what you do. Users of the library won't want to have to think, so usage needs to be super easy.
The golden rule we stuck to was keeping individual functions focused on a single task - do one thing and do it well (or very very well); don't try and provide something that tries to take every possibility into account, the more reusable you think you're making it - the less likely it is to be used. Code Complete (the book) has some excellent content on common libraries.
A good approach to setting/improving a library up is to do regular code reviews and retrospectives; find good candidates that you've already come up with and consider re-factoring them into a library for future projects; a good candidate will be something that more than one developer has had to do on more that one project (for example).
Set-up some sort of simple and clear governance of the libraries - someone who can 'own' a specific library and ensure it's overal quality (such as a senior dev or team lead).
I have so far written most of the common libraries we use at our office.
We have certain button classes that are just slightly more useful to us than the standard buttons
A database management class that does some internal caching and can connect to ODBC, OLEDB, SQL, and Access databases without even the flip of a parameter
Some grid and list controls that are multi threaded so we can add large amounts of data to them without the program slowing and without having to write all the multithreading code every time there is a performance issue with a list box/combo box.
These classes make it easier for all of us to work on each other's code and know how exactly they work since we all use the exact same interfaces throughout our products.
As far as organization goes, all of the DLL's are stored along with their source code on a shared development drive in the office that we all have access to. (We're a pretty small shop)
We split our libraries by function.
Commmon.Ui.dll has base classes for ui elements.
Common.Data.Dll is sort of a wrapper around Enterprise library Data access classes.
Common.Business is a dumping ground for other common classes that don't fit into one of those.
We create other specialized dlls as needs arise.