Does anyone know of any VB.Net code generation plug-ins for StarUML? - vb.net

Simple question really. No elaboration required.
I have found similar tools for Java, C#, C++ and other languages but not VB.Net.
Thanks

Unfortunately, I don't know of a plugin for StarUML that will generate VB.NET code, however, if using a different modelling tool is a possibility, Sparx System's Enterprise Architect will generate code in VB.NET (as well as many other languages).
Enterprise Architect enables you to
generate source code from UML model
elements, creating a source code
equivalent of the Class or Interface
element for future elaboration and
compilation. In particular you can
generate C, C++, C#, Delphi, Java,
PHP, Python, ActionScript, Visual
Basic and VB.NET source code. The
source code generated includes Class
definitions, variables and function
stubs for each attribute and method in
the UML Class.
Unfortunately, Enterprise Architect is not free nor is it open source, however, there is a full functional 30 day trial available, along with discount options for academic pricing (if appropriate).
If you're looking to stay with free and/or open source software, I think the closest for VB.NET code generation would be to use a couple of tools in conjunction with each other:
Dia is an open source, GTK+ based diagram creation program for Linux, Unix and Windows released under the GPL license. You can use this to create your UML diagrams. From there, you would use:
Project: CodeGen from Novell, which will take the UML diagrams saved/exported from Dia and convert them into skeleton C# or VB.NET code.
If you're prepared to look at a more "general purpose" code generator, this page:
Generators that build VB.NET
will give you a good starting list of tools that will generate VB.NET code.

Related

Distinction between programming language and framework

I'm a student and started developing some projects in VB.Net and I'm liking it a lot. However, I asked this question to some colleagues and they couldn't answer. Even my teacher wasn't able to clarify what was exactly VB and .Net. I have checked this question here but even the accepted answer gives me some doubts.
For example, for this bit of code here
Class Example
Private _value As Integer
Public Sub New()
_value = 2
End Sub
Public Function Value() As Integer
Return _value * 2
End Function
End Class
Module Module1
Sub Main()
Dim x As Example = New Example()
Console.WriteLine(x.Value())
End Sub
End Module
How can the language be separated from the framework? I know the language is syntax and all but, where is the framework?
I've read that frameworks contain libraries: what are exactly libraries? The language (syntax and all) I can see it, it can be seen, but is the framework visible too? If so, where?
So in a VB.Net application, when I look at the code, all I can see is VB: the same goes for C#.Net applications.
Maybe silly example: For instance, for a car to function, all components must be good - from the tires to the hood, the engine, the fuel - but all of them are visible, and while from the outside we can't see the oil or fuel running inside or the pistons working, we can see them if we want.
Is it possible to see all the components when looking at a VB/C# .Net application? I mean, to look at code and clearly distinguish what is VB or C# and .Net?
Thanks
There are three primary parts to the .NET framework:
Compiler (MSBuild)
Runtime environment (CLR) - virtual machine, garbage collector, etc.
Supporting libraries (FCL)- System, ADO.NET, LINQ, WPF, WCF, etc.
All three of the above are included with the freely-distributed .NET Framework. The term .NET Framework refers collectively, and loosely, to all of those things, but they each perform very different roles. The answer to your question is different for each of those parts.
Compiler
As you probably know, you cannot run VB.NET code directly. It must first be compiled into an executable which can be launched as a Windows process. The compiler is used to compile a variety of high level languages (such as VB.NET and C#) into assemblies (e.g. EXEs, DLLs). Unlike native compilers, though, .NET assemblies do not contain native machine code. Instead, the .NET compiler compiles into .NET assemblies which contain MSIL code. MSIL is a slightly-higher-level-than-machine-code language which, in theory, can be run by a virtual machine on any platform.
The compiler is obviously not visible in your code. Obviously there is no place in your code where you can say "that's the compiler". Rather, the compiler is the tool that you use to compile all of your code. The compiler, though, does dictate what languages you can use. If the .NET framework does not contain a Ruby compiler, then you can't very well write a .NET application in Ruby. So, in that way, the fact that your code is written in VB.NET or C# at all is the indication that it will be compiled using the .NET Framework.
You may be thinking, "The compiler isn't part of the framework--that's part of Visual Studio." But if you were thinking that, you would be wrong. The compiler is installed as part of the .NET framework. You don't technically need Visual Studio to compile a .NET application. You could write an application in any .NET language, using Notepad, and then compile and run it with the .NET Framework without ever having installed Visual Studio.
The compiler portion of the .NET Framework is referred to as MSBuild.
Runtime Environment
Since the compiler compiles your high-level code into MSIL assemblies, rather than into native machine-code binaries, you must have the .NET Framework installed in order to run any .NET application. When you run a .NET application, the Framework is responsible for just-in-time (JIT) compiling the MSIL code into machine code so that it can be executed on your current platform. It also provides the memory management features such as garbage collection.
The same runtime environment is shared by all .NET languages (since all .NET languages compile to MSIL code). Therefore, it's not a VB.NET runtime environment nor a C# runtime environment, but rather, it's a MSIL runtime environment. Instead of having one runtime environment per language, there is actually one runtime environment per platform. A separate environment must be custom implemented for each processor architecture and each operating system on which the Framework will run.
This part of the framework is largely invisible to you and your code. There are some methods you can call to access the GAC, or the garbage collector, or the .NET security system, but other than that, you don't even know it's there. Unless the Framework isn't installed, that is--in that case, it becomes clear very quickly just how necessary it is.
The runtime-environment portion of the .NET Framework is referred to as the Common Language Runtime (CLR).
Supporting Libraries
The .NET Framework comes packed with many extraordinarily useful libraries (DLLs). For instance, every application references the mscorlib.dll and System.dll libraries, which provide many of the core data types in the System namespace. There are many other libraries which you can optionally reference with your projects as necessary.
These supporting libraries are provided as already-compiled MSIL assemblies, so they can all be referenced and used by projects written in any .NET supported language. When you call Console.WriteLine("Hello World") in VB.NET and Console.WriteLine("Hello World"); in C#, you are calling the exact same .NET Framework library. The Console class is defined in the mscorlib.dll library. It doesn't matter which language you use to call it, it always does the same thing.
The supporting libraries are very visible in your code. Any time you use anything that is not explicitly defined by you in your own code, you are using the Framework (unless, of course, it's something from a third-party library). In your example code above, you are using Integer and Console. Both of those types are defined by the .NET Framework's supporting libraries (both are defined by mscorlib.dll). In other words, the language is all of the syntax that you use to make the calls to the Framework. Everything else is the Framework.
If you want to "see" the supporting libraries, the best place to start is in Visual Studio. You can use the Object Browser to browse through all of the types defined by the libraries that you currently have referenced in your project. If you want to reference more .NET Framework libraries, go to your Project Properties designer's References tab, click the Add... button, then select the Asseblies > Framework option. That will list all of the supporting libraries that are provided as part of the .NET Framework. If you want to find out more about any of the functionality provided by any of those libraries, your best resource is the MSDN (and Stack Overflow, of course).
The supporting libraries portion of the .NET Framework is referred to as the Framework Class Library (FCL).
Here is how I envision the two
The framework is the set of libraries, APIs and runtime components that are available for the language to use
The language is the syntax by which the framework is accessed
In many cases it's hard to separate the two because the language when used is nearly always accessing some part of the framework. Take for instance even this very simple definition
Class Example
End Class
Even though it is unstated, this definition depends on the targeted framework having a definition of System.Object. This is necessary for the language to setup the appropriate base class for Example.
You have to keep in mind that if you're using a programming language, at some point it all must boil down to binary 1's and 0's.
This means that when your program gets compiled and run, it's making use of the C# compiler. The C# compiler is a program written in a native language (probably c or c++). This program allows yours to be converted into stuff that the .net framework runtime can understand. Essentially, your C# code becomes some sort of intermediate bytecode.
Similarly, after your program is compiled into this intermediate bytecode, it is run on top of a virtual machine (JVM for Java or the .net framework runtime for C#). This virtual machine is a pre-compiled program written in a native language (c or c++), which allows your program to interface with the computer's processor in a way that both understand.
All of these pre-written, pre-compiled pieces are part of a framework. They are installed to your machine in some particular location (which is why they might not be readily visible with the rest of your code and assets) and provide APIs to anything that wants to make use of them.
The APIs are analogous to the understanding between a gas pedal and an engine. An engine accepts more fuel as a result of someone pressing the gas pedal. In some sense, the engine "talks" to the gas pedal and understands that if you press firmly on the pedal, the engine should respond by injecting more gasoline into the combustion chambers.
These individual pieces, along with their "understandings" represent a framework. You might add a "Driver" who can operate a gas pedal as your "C# Application".
How can the language be separated from the framework?
For example... take for instance English, English is a language, while a book would be a Framework. In this example, you can write whatever you want in English, but you can't write in "The Hobbit", because it is a book, not a language.
However, you can make references to the book. For instance you can talk about Trolls, and you don't have to define it's behavior or looks, because the book already defines them for you.
Where is the framework?
The framework exists whenever you make reference to it. In the Trolls example, if you ask "Do you know how do Trolls look like?", I would need a context for that, it may be Harry Potter's, Tolkien's, World of Warcraft's, etc. And I will give you compilation errors because I can't understand you.
If however we "use" the same "Framework" (book), or if you tell me about them before, I would be able to respond you (compile).
Is the framework visible too? If so, where?
VB/C# are languages, you can't "really see" where it is, because you write it. It is like asking where is English. You can however compile it, and that is what you can "find", just like you can find a printer.
The Framework is a set of libraries/utilities already packed into a beautiful black box that you download and trust your life to.
VisualStudio helps you a lot, and it will hide "complicated stuff", imagine like it is a movie called The Lord of The Rings, and it removes a lot of stuff that you can't really look into unless you read the book.
You can't really dive into "what .NET does internally", because it is closed software. Imagine that I burn down all the books and you have to trust the movie.
But you could use an Open Source example such as Struts (a JavaEE Framework) because it is open source (books should not be burned in Open Source examples).
Here is an abstract example.
Speech is similar to a framework, you have phonation, producing sound;
resonance; intonation, variance of pitch, etc. Those are all the building blocks for communicating.
To speak a specific language, you must utilize phonology, morphology, language syntax, proper grammar; semantics, etc - all the rules for that Language.
...
In a programming framework, you have building blocks (code libraries, dependent files, specific folder/file layout, ect.) that you might need to complete a programming task.
A programming language is the set of rules you must abide to in order for your application to correctly work.
....
In the Java programming language, I could open notepad and write java code, compile it, and run it on any machine that has the JVM installed.
Java Server Faces (JSF) is a framework where a Model-View-Controller (MVC) paradigm exists as the basis to run web applications. You have necessary dependent files (like web.xml) that must exist for the server to correctly implement, structured layout of classfiles, and implementation/configuration of other libraries. In an essence, your files are still written in the Java Programming language and your syntax must be correct, but if you want to build a web application using that framework, you must have adhere to those other specific patterns and constraints.

Is there an automatic tool to find the DRY-ness of your code base?

I am a strong advocate of the DRY principle:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
Are there any tools that can test a code base for the amount of DRYness and both quantify and pinpoint specific examples for correction?
Simian
Simian (Similarity Analyser) identifies duplication in Java, C#, C,
C++, COBOL, Ruby, JSP, ASP, HTML, XML, Visual Basic, Groovy source
code and even plain text files. In fact, simian can be used on any
human readable files such as ini files, deployment descriptors, you
name it.
Simian runs natively in any .NET 1.1 or higher supported environment
and on any Java 5 or higher virtual machine, meaning Simian can be run
on just about any hardware and any operating system you can hope for.
Both the Java and .NET runtimes are included as part of the
distribution.
PMD's Copy Past Detector (CPD)
Duplicate code can be hard to find, especially in a large project. But
PMD's Copy/Paste Detector (CPD) can find it for you!
Note that CPD works with Java, JSP, C, C++, Fortran and PHP code.
You can run it commandline, there is an ANT task, and an Eclipse plugin.
Clone Detective for Visual Studio
Clone Detective is a Visual Studio integration that allows you to
analyze C# projects for source code that is duplicated somewhere else.
Having duplicates can easily lead to inconsistencies and often is an
indicator for poorly factored code.
See our CloneDR tool, which finds exact and near miss sets of duplicated code using computer langauge structure as guide. As well as detecting clones, it will show you a rough abstraction and the parameter bindings that explain the differences between the clone instances.
It has instantiations for many lanuages: C, C++, C#, Java, JavaScript, PHP, COBOL, Python, PLSQL, ... It tends to find 10-15% duplicated code across systems that have any serious size (e.g, 100K SLOC and above). There are sample reports for many languages at the web site, and you can download a trial copy.

Any tools to check for duplicate VB.NET code?

I wish to get a quick feeling for how much “copy and paste” coding we have, there are many tools for C# / Java to check for this type of thing. Are there any such tools that work well with VB.NET?
(I have seen what looks like lots of repeated code, but wish to get some number to help me make a case for sorting it out)
Update on progress.
I have just tried Simian.
It does not seem to be able to produce a nicely formatted report I can sent by email
It does not cope when the names of local variables, or parameters etc may have been changed, e.g it just matches on lines of text being the same.
Clone Doctor does not support VB.NET (only C# and VB 6 and lot of other)
October 2010: VB.net added to langauges supported by CloneDR
Clone Detective for Visual Studio only supports C#
SolidSDD - Source Code Duplication Detector only supports C, C++, C# and Java
DuplicateFinder is open source, but otherwise looks very match like Simian, e.g it just works on lines of text
ConQAT - Continuous Quality Assessment Toolkit seems to have a clone detector that works for VB.NET (not tried it yet)
Gendarme is a bit like FXCop and has a AvoidCodeDuplicatedInSameClassRule rule, this looks very promising, as it avoids the problem of working at the text level. Just tried it, it is the best solution so far, pity it does not search with a greater scope.
Before claiming that this question is a duplicate, please check that the other question addresses VB.NET, as a lot of tools that work well for C# don't work so well for VB.NET. (However it would not surprise me if this question is a real duplicate)
CodeRush 11.2 introduced a new feature called Duplicate Detection and Consolidation (DDC)
http://community.devexpress.com/blogs/markmiller/archive/2011/11/29/duplicate-detection-and-consolidation-in-coderush-for-visual-studio.aspx
Make sure to check out the options for it as well, as you can have it run when so many lines are changed, certainly time has passed, etc.
They've posted some decent videos on the DevExpress site too.
Simian: http://www.redhillconsulting.com.au/products/simian/
[I'm the author of CloneDR ("Clone Doctor").]
CloneDR is parameterized by a full grammar for the programming language in question. So it doesn't just match lines. Rather, it can find clones which are syntactically well-formed, with variations that are more than just identifier changes, regardless of where they stop or start in a line.
The engine on which CloneDR rests, The DMS Software Reengineering Toolkit" is a tool for analyzing large scale systems in any programming language, and uses language descriptions to drive the analysis. DMS has a wide variety of language front ends already available.
Presently it has VBScript and VB6 (as dialects of "Visual Basic"). It doesn't have VB.net, but that would be pretty straightforward to do given the DMS infrastructure and our experience with lots of other languages.
So, CloneDR could do this just fine, with a small bit of effort on our part.
EDIT October 2010: VB.net added as a language CloneDR can process.
Atomiq supports vb.net amongst other languages, and the results are nicely presented.
JetBrains published console tool set Resharper Console Tools to run duplication analysis. Once installed it allows you to do the same analysis as TeamCity does and generate duplicates report locally and even include duplicates search into custom build process with MSBuild. This tool does exactly what you need. More details you can find here at JetBrains blog post
Try Simian:
Simian (Similarity Analyser) identifies duplication in Java, C#, C, C++, COBOL, Ruby, JSP, ASP, HTML, XML, Visual Basic, Groovy source code and even plain text files.
I once saw an impressive demo of Pattern Insight; its CP Miner may be what you’re looking for: http://patterninsight.com/products/cp-miner.php. It seems to be language-independent, though I couldn’t find anything explicit about languages other than C/C++.
Roll up your sleeves and write your own parser to use it with CPD?
See the question for the tools I found.

VBx Language, What is this?

In Ironpython site exists references to a language called VBx using DLR. But i can't find any reference to this in google. Where is it?
Edit: Is a Implement of Visual Basic 6.0 in DLR? if yes is so cool. Is more expected for people using VB6 yet and can't migrate because big frameworks.
From this mailing list post:
VBx was an implementation of Visual Basic on the DLR. It was first meant
to be in Silverlight, but the VB team decided they'd rather put VB.NET in
Silverlight rather than build a new implementation up from scratch. So, VBx
is on hold.
Apparently it's an implementation of VB in the DLR:
http://www.mail-archive.com/users#lists.ironpython.com/msg05933.html
Straight from the mouth of Paul Vick (long time VB architect)
What is VBx?
VBx was one of the four language implementations that were originally driving the design of the DLR, the other three being IronPython (from which the DLR was extracted in the first place), IronRuby and Managed JavaScript.
VBx was intended to be a dynamic version of Visual Basic.NET or a .NET version of Visual Basic 6, whichever way you want to look at it. It was primarily intended as a testbed for the flexibility of the DLR, secondarily as a testbed for a more dynamic version of VB.NET and tertiarily (is that a word?) as a scripting language for Silverlight. It has fulfilled its primary goal and the designers of VB.NET decided that they want to pursue goals two and three within the existing VB.NET language, rather than producing yet another slightly different incompatible version of VB. (You already have VB.NET, VB, VBA and VBScript.)
Managed JavaScript was also abandoned, the team was folded into the IE team and is responsible for the ECMAScript 5 engine in IE 9.

Are there open source Common Lisp COM wrappers?

I have an application that is written in SBCL and is deployed as an executable on Windows. The need has arisen for it to interact with Excel via COM and another application via DDE (I know, I know).
DDE is simple enough for me to have quickly wrapped what I needed in a very small, simple to maintain C library. COM, on the other hand, seems like a large enough project to just implement this portion of the functionality in Python with the Win32 extensions library.
This, to me, is annoying in that a lot of CL code is being augmented with some Python that is of varying degrees of integration with the main project.
I've seen that LispWorks and Allegro CL both allow for COM interaction but cannot find any open source implementations of the same functionality via google or CLiki.
Does such a thing exist?
There are bindings called cl-win32ole, implemented using CFFI.
You are asking for Excel integration, so the Excel example included in cl-win32ole might be of interest to you:
I'm not aware of open source COM wrappers that work on multiple CL implementations, SBCL including.
Your best bet might be checking out Corman Lisp which is Windows specific and includes a COM server. Check out its features page: http://www.cormanlisp.com/features.html
My impression is that Corman Lisp isn't actively supported any more but I could be very wrong on that, but at least you might glean something useful from its source code.