What are these diagrams called? (answer : railroad diagrams) - diagram

I have seen a lot of these diagrams in some help files and src documentation
What are they called? Are there any other (for same purpose) known diagrams?
Img source : http://www.sqlite.org/images/syntax/insert-stmt.gif

They are called "railroad diagrams", because of their resemblance to a railroad track. They were often used to describe the grammar of older languages, before more formal grammars became routinely used. The problem with them is you can't easily feed them into tools like parser generators, or grammar checkers, so they are not used so much these days.

They are called syntax diagrams.

Related

Are you modeling or drawing? in uml

Please I need help in understanding this two approaches in the uml world. I am a programmer who is new to uml. I just started learning uml lately but kept getting this phrase asked all the time. - Are you modelling or drawing?. An explanation is needed with clear examples.
This link hinted just a little but I am stil confused -- http://modeling-languages.com/drawing-tools-vs-modeling-tools/
UML is a modeling language, which has a graphical notation. Its semantic is precisely specified by UML 2.5 standard of the OMG and also the international standards ISO 19505-1:2012 and 19505-2:2012 (although the latter corresponds to UML 2.4.1).
THere are two different approaches to UML diagramming. And it's heavily influenced by the tools you use:
Drawing tools generally offer UML shapes to be used in drawings. But there is no deeper meaning behind the shapes. It's only pictures. These tools would allow you to mix a use case with a class or an actor in a deployment diagram. The advantage is that you can do what you want. The inconvenience is that what you want may not be compliant.
Real modeling tools let you combine only valid UML elements together and ensure consistency of what you draw with the deeper meaning of the UML language. And they build a true and comprehensive model behind the scene by combining all the facets of the different diagrams.
Modeling tools can do smarter things. They can relate for example a class to their object instantiations in sequence diagram. They can help you to find all the other models in which a specific class is used. If you rename a class or add a property in one diagram, it'll be automatically reflected in all the others.
Modeling requires more discipline, but it's more powerful in the end. Some modelling tools can even use their understanding of UML to generate code out of the model.
You can use UML diagrams in very free way and you can use them up to the specifications. There are even different UML tools - some support only free style diagrams/drafts, some check dependencies and correctness and thus create models. There are some tools in between (MS Visio is one of them)
Nothing is ideal and fitting for everything. For example, some strict tools (VP and EA) forbid to make number-named classes, but according to UML specification you MUST use number names for anonymous classes. But -sigh- we have what we have.
Use of UML as such is not strictly predefined. So, you can use it for freehand drafts, later work on them more thoroughly and make them models. Or do only drafts. Or only models. But at any moment you should know how strictly are you keeping up to specifications. Or at least, trying to keep up. But even very free draft can help you greatly to understand the task or to think in a more productive way.

flow charts for languages

I was looking at some syntax diagrams for SQLite and was wondering if they could be used to describe all languages (like Python, C++, etc.)?
http://www.sqlite.org/lang_createtable.html
From some CS classes I took years ago I remember groups of languages the could be described by DFA and what not, but don't remember many details and think this is probably different anyways.
Any clarity would be appreciated.
You wouldn't usually call them "flow charts", but "syntax diagrams" (as you did) or "railroad diagrams". See the Wikipedia article for details, and feel free to use my Railroad Diagram Generator for generating them from an EBNF grammar.
A DFA corresponds to regular grammars, whereas EBNF and syntax diagrams describe context free grammars. These are different levels of the Chomsky hierarchy, which is the basic framework for classifying formal grammars.

Textual representation for UML class diagrams - DSL for UML

UML classdiagrams are a standard graphical notation to describe classes and their relationships.
Is there a standard textual notation (DSL) to describe the same? Don't say XMI or EMF;-)
I think you could do that with Corba IDL and use Interfaces for classes, but this is somehow too much on the Corba side. You could use Java Interfaces, but this is too Java.
Background of my question is writing generators. I think it is easier to write a generator based on the syntax tree of a DSL than to parse a graphical notation. A graphical notation first has to be translated into a syntax tree (that would be the same you'd get from the corresponding DSL). I think translating a graphical notation into the syntax tree is harder than to translate a DSL (where you can use ANTLR).
You've got the answer already, but I'd like to clarify. There is a standard notation, it's called HUTN, and nobody uses it.
Check this complete list of textual notations to describe UML models. Btw, the reasons to create one of these tools (in particular TextUML) can be find here.
It is no coincidence that UML separates abstract and concrete syntax.
Tying up code generation to a user-facing notation is a bad idea. Tools (code generators) and people (modelers) have totally distinct needs, so no single syntax can serve both audiences well. Not to mention you lose the ability of applying the same code generator to models created using different notations.
TextUML is a concrete syntax tailored to modelers. XMI is a much better notation for tools, and the UML2 object model makes it very easy to handle.
Rafael
http://abstratt.com/blog
No standard notation to my knowledge but a good summary of options here.
hth.

A naive questioin about UML and Turing completeness

It'a a well-known fact that UML does not Turing complete (in contrast to usual programming languages). But it seems to me UML is even more flexible than traditional languages. I can't imagine a problem you can describe by means of such language as C++ (f.e) but at the same time can't describe by means of UML. Quite the contrary it's much more easier for me to fancy a construction existing in UML but unreliazable in C++ (Java, Delphi, VB and so on...)
Could you help me to understand this moment? I really can't catch it.
I´d say that UML IS a turing complete language since the addition of the Action Semantics package (this happened in UML 1.5 version).
Now UML includes an imperative action language (not to be confused with OCL) that allows a precise definition of the behaviour of class methods. This imperative action language includes the typical set of assignments, if conditions, iterators,... you´d expect from any programming language.
This action language is one of the popular components of Executable UML approaches but it´s now part of the UML standard itself
Interesting question. A couple of points come to mind, although there's probably a whole more to it. Apologies it's quite long.
What can you describe with e.g. C++ that you can't describe with UML?
First, you have to define what you mean by "UML". Generally, people tend to mean the 'core' elements - those on Class Diagrams, State Diagrams, Activity Diagrams etc. - plus OCL (the constraint language).
Given those elements you can't specify imperative algorithms. Specifically, anything that requires assignment. You can however get very close: the steps and decision logic can be expressed using e.g. Activity Diagrams, and the function of each step defined as pre- and post-conditions in OCL. However, you never quite get to fully specifying the behaviour. Take an example of an atomic step whose purpose is to increment the value of an integer. The input is an integer - say X. The output is described by the post-condition X == X#pre+1. However, there's nothing in UML to actually implement the step.
Now it's entirely conceivable to extend usage of UML to address above. The UML Action Semantics were developed precisely to enable specification of actions. Doing so makes the language computationally complete. The problems are merely practical:
There's no universally agreed and adopted syntax for the semantics;
There are very few implementations
What can you describe with UML that can't be implemented in e.g. C++?
In essence nothing. However there are two practical limitations:
UML "specifications" are usually imprecise, ambiguous and/or incomplete. Activity Diagrams, for example, often leave paths dangling. Could it be represented directly in C++? Yes. Would it compile? No.
Some of the mappings for UML constructs to imperative, stack based languages are non-trivial. State Models are an example: while there are well-known patterns, the mapping is quite complex. This is especially true for hierarchical and/or concurrent behaviour. In an activity Diagram, it's easy to express that two activities happen in parallel and then synchronise before moving to the next step. That can of course be done in C++ but requires the use of e.g. threading libraries.
It can however be done. In fact, it's what the Executable UML tools do: Model Compilers take an executable UML model and translate it into 100% functioning imperative code.
hth.
As the name implies UML is a modelling language. It can sometimes be applied as a methodology for designing software.
Once upon a time they were dreaming up ways of automatic code generation, they were called CASE tools. They failed to get the code generators to work effectively, although they did remove a lot of boiler plate code from the language. This augmentation became the key to UML as it provided a way to augment the experience of designing and programming software.
I don't know if UML is "Turing Complete", I hope it is, wouldn't it be great to come up with solutions by describing the problem to the computer in pictorial format and letting the computer do all that hard nasty programming for you.
UML is the meta language to the doing in the code. It describes artefacts, how they relate/interact and what they do.
UML is being added to, new design artefacts are being added year by year, and if it is not already Turing Complete I don't see why it couldn't be.
However I think somewhere along the line I read something about languages being "Turing Equivalent" if they could both express and solve the same solution.
Since UML is the design language and code is the implementation language based on the UML design I would say that UML and code (c#, java, etc) are Turing Equivalent. If they are agreed to be Turing Equivalent then UML must be Turing Complete.

Absolutely necessary UML Diagrams even for very small projects?

UML provides us with many different kinds of diagrams. but in many situations only small set of them is really necessary, what do you think about the most usefull UML diagrams, even for very small projects?
Well, it really depends on the project. I think it is wrong to just create any UML diagram as a rule without assessing if it will be really usefull.
However there are some obvious situations when they're usefull:
If your project will be any way large in terms of OO structure then it is usually usefull to create a class diagram. That way you can deal in abstractions until it is time to get stuck into details.
If you project will be mostly UI driven then it can be quite useful to create a Use Case diagram as a way of defining requirements. This is especially useful if you can get your customer to buy into this method.
If it looks like your system will have many interactions between objects then creating a sequence diagram can be usefull for understanding interactions. Also, I think sequence diagrams are the most intuitive for developers as I notice a lot of developers instinctively diagram there interactions like this - even if they're not familiar in UML - in simple powerpoint\visio diagrams.
Deplyoment Diagrams are obviously usefull if your system will use many technolegies and require a lot of HW.
I think key point is that only use UML when the software becomes complicated to the point where we need to think in abstractions - UML helps visualise and document these abstractions.
I do not think UML diagrams are essential part of a project documentation whether we're talking about big or small projects.
Good comments around provide much more value than sophisticated diagrams.
I personally have an impression UML is a toy of the academia world. It's the only place I was hearing and seeing people running around with UML, SOA and so on.
In my working practice I've barely seen UML at all. Well, maybe once during my term project and at my current job where we've got a couple of eight-years-old (and just the same deprecated) diagrams somewhere on the internal FTP server.
Usually formal UML is too much for small projects. Just stick to basic class diagrams and simple use-case diagrams.
Small projects are (in my experience) more often subject to change so your diagrams will be out-of-date very often. You are much more likely to keep a less formal diagram up-to-date than redo all the fancy UML stuff.
UML is dead, nobody who matters uses it.
The only people that use UML are consultant types who write articles and are trying to be formal and fancy and lack substance.
If UML is so great why cant i find any for any of the projects that Google publishes on googlecode ?
Where is the UML for Ruby or Python or DOT NET or Java ?
UML is dead because the use of open source crapy tools !! Many companies take free tools and just create few diagrams, no training at all then they say that this is not useful.
This is non professional and very limited use of UML is a real disaster for projects !!

Resources