MVC patter uses delegates to interconnect a lot of class objects with each over. For Qt they are signals and slots, for C# they are events, for Java they are closures. But all diagramming and UML designers i know only operates with inheritance and child-parent composition :(. Is it any software available that allows to draw classes visually, design delegates, connect delegates to endpoints and generate code based on such a 'model'?
The description above may not be accurate: i'm not very deep in terminology. If anyone want any clarification about this question, please comment, i wll clarify what is unclear.
I've had good experiences with Sparx System's Enterprise Architect. You can download a fully functional 30 day trial.
AndroMDA has support to generate a web user interface from a UML model that defines the flow of an application. See the Search Criteria Panel from the Getting Started Java documentation. If you use the AndroMDA BPM4Struts cartridge, the presentation layer will be MVC based. Not sure this is what you're looking for though.
PS: The history of MDA is not full of successful experiences - and this is an euphemism - and I wouldn't recommend this approach (even less for the presentation layer)
If you're looking for something free / open-source, there's always:
StarUML
The only way you can succesfully apply MDA is the other way around. Define the model in a fluent DSL, and generate the diagrams you need out of it.
I've used TogetherJ and Enterprise Architect, but I'm not impressed. Nice diagrams, lousy workflow. I very much prefer a Smalltalk environment (preferably with MOOSE) and a few diagram generators.
Related
I'm making a web application that is quite a bit more complicated than others I've produced in the past. I think before I go much further I should try and get down a plan for the application as I currently have it.
I recently took a course in UML, but that doesn't seem particularly appropriate here - as while I'm using an object-oriented framework it is really the relationships between the Models, Controllers, Actions, Views and URL mappings I'm looking to document.
So my question is - Are there any software design applications out there that are particularly useful for documenting the structure/functionality of an MVC application?
On the basis of this I'd be hoping to write a testing plan.
Documentation is not for the creation of "testing plan" (whatever what means to you). If you want to test your application, you should have been writing unittests all along.
This sort of documentation is meant to alleviate the confusion in larges-scale applications. And the use of UML would be appropriate in this case, though there is no rule, that states you have to use all diagrams. But in your situation class or component diagram might be quite useful, with some sequence diagrams to illustrate more confusing parts of the application.
Also some ER diagram might help, if you have a complicated DB structure.
I am starting a maintenance project where I need to work with legacy code and also create new ones. New ones I can create proper interface based development and I can use Moq to do proper unit testing. I can't use Moq against the legacy code since they do not have proper coding to mock out the objects. Based on the reading, Typemock looks like an excellent fit since I can isolate the object and return what we want when a method is called on legacy objects. I really like the simplicity and ease of development. I would like to know is there any other tools out there like Typemock I should look at before committing to it since I have to pay for it.
Thanks
PS: ours is Microsoft shop we work with C#/ASP/ASp.Net/Silverlight and VB.Net
** I just found that Infragistics have one mocking tool as well.
What you're looking for is a mocking framework that uses the Profiler API. These are the ones that can "mock anything" because they sort of run "underneath" the code being tested.
When considering one of these, you'll want to think about things like:
Integration support: Does it work with the tools you're using? For example, your build server, coverage tool, unit testing tool, etc. Are there any additional tools it comes with (e.g., Visual Studio plugins) that might help you work with it?
Technical support: If something goes wrong or you find a bug in the product, can you ask someone about it?
Syntax/patterns: Does it support AAA testing or is it only record/replay? How easy is it to start working with?
Community and learning resources: How's the documentation? Are there people out there who can answer your more general usage questions or are you "on your own?"
There are three primary mocking frameworks to consider that I'm aware of:
Typemock Isolator - The most mature with a free license for open source projects, but otherwise not free.
Telerik JustMock - New to the scene, but good features. There is a free/limited version.
Moles - Free from Microsoft, though somewhat less easy to integrate with tools outside the VSTS realm.
Full disclosure: I'm a Typemock MVP and I've been using Isolator for a while. It has thus far been worth its weight in gold, particularly in Brownfield development. I will admit in some cases, where it's more Greenfield, I use Rhino or Moq. It really depends on what I'm doing.
In any case, I recommend evaluating each of the tools yourself to see which works best in your environment. Be sure to see how it integrates, how easy it is to get going, etc. for each one, and then make your decision based on your experience in your setting.
Please help - I'm getting lost!
I'm writing a small desktop application which has some controls and some screen. This should later be integrated with a small web site, also having some screens. The idea is to let the user edit videos and select images, and then share their results with her friends.
The desktop app is using C# WPF, the web site - ASP.Net MVC.
I read that growing the application past a few screens would be easier using MVVM. So I started searching and discovered Caliburn.Micro and MVVM.Light. I have downloaded some tutorials but, just as I was getting ready to deep-dive into the material, I found here on S.O. that there's also Prism, MEF, Unity, ReactiveUI - This is becoming too much!
I'm terrible at learning new things - It's taking me ages to study WPF and ASP.Net MVC. I don't want to study lots of new material only to find out later that it's not relevant. And I don't have an architect to instruct me.
So my question is: Could you put these frameworks and technologies in perspective, and suggest which I should focus on studying and using (esp. what can be later used with Windows 8)?
If you want to build an MVVM application (which you probably do for various advantages), then you want an MVVM framework.
I would recommend Caliburn.Micro, as it is straightforward to implement following the examples on the Caliburn.Micro documentation page. It also has a very compelling convention over configuration mechanism, and uses an Actions system to invoking verbs (methods) on your view models from the view. This is more powerful than any other mechanism I've seen.
Prism is quite a heavyweight framework which includes elements of MVVM design to help the implementation, as well as being particularly tailored towards building composite applications (applications that are built up of decoupled components within a hosting shell).
MEF is useful for these types of applications that need to discover plugins or extensions to the application (even after the application has bootstrapped), and can be used alongside an MVVM framework such as Caliburn.Micro. MEF can also be used for implementing inversion of control, but doesn't provide some of the core features found in other inversion of control containers, so you may decide to only use it to implement plugin functionality.
Unity is an IoC container, and would be used to implement dependency injection for your general application infrastructure. There are lots of IoC containers in the .NET space though, some of which offer either improved performance, additional features, or a more friendly API.
I don't know about ReactiveUI as I haven't used it.
If you're talking about maximising code reuse for a move to WinRT, then MVVM is a great choice.
PRISM already include MEF and MVVM logic :)
Ok little bit of explanation here:
MVVM stand for logic in your application. Actually clever way of decoupling of View, View-Model and Model. Don't know any best (?) framework to do it - you could check Catel if you want or MVVM Light but it just a tons of code from someone who understand the MVVM logic and just make it easy to implement it. You could actually try to write your own MVVM framework and see that 'there's no secret ingredient' - just the same repeating code and same classes, etc... Actually you don't need any MVVM framework to implement MVVM.
Once you learn and write MVVM you immediately run into question - How I NUnit test it in decoupling way (this is not trivial problem in Silverlight for example) - so here all IOC/Inject framework come into play. For example MEF. Consider following example to understand a big picture about Inject framework:
Project 'Shared', written in 'least delimiter' (for example Portable Library)
public interface IAmSharedInterface
{
string SayHello();
}
Project 'Main', reference only 'Shared' project
public class IAmMainClass
{
[ImportingConstructor]
public IAmMainClass(IAmSharedInterface SharedInterface)
{
SharedInterface.SayHello();
}
}
Project 'Implementor', reference only 'Shared' project
[Export(IAmSharedInterface)]
public class IAmImplementor: IAmSharedInterface
{
public string SayHello()
{
return "Hello from implementator class to whoever using it";
}
}
You see - there's no direct reference between 'Main' and 'Implementator' projects - all 'magic' happens in MEF/Unity build/resolve process. So you could easily run NUnit test on Main without using 'Implementor' project and 'Implementor' with 'Main'. There's also a scenario where other project could implement and export 'IAmSharedInterface' specially for testing purposes.
So back to PRISM - it have all (!) this. I know it's not easy framework to understand right away and it doesn't suitable for simple 'Hello World' programs but once you learn it - there's no way back. It just glue all the parts together and give you big degree of freedom in using whatever moq framework you want (for example Rhino).
Prism developing in Microsoft so (I hope) it will be supported not just in Windows 8 but in Windows 9 and in all future versions.
Whatever you asked it's all inside: MVVM, Inject, decouple/plug-ins, easy to read and test
To save adding to the detailed information above, I'll attempt to make life easy for you.
1) For now, forget about IOC / Dependency Injection / Plugin architecture. You say you're creating a simple app, so forget about this for now. Keep your code tidy and you can implement this later if necessary (it's good stuff).
2) Out of the frameworks you've listed I would suggest Caliburn.Micro. It's relatively straight-forward and lightweight. It wouldn't take you long to get up and running.
3) Create your model in a separate assembly which you can use for both your windows app and your MVC website.
Keep it simple and don't get bogged down with all the technologies.
This answer reproduces some abridged chunks of Rockford Lhotka's Blog article "Using the MVVM pattern requires a framework" which was cited in another answer.
It is sort of a meta-answer to this question (though it does contain a specific recommendation), but it seemed very useful to explain the role of a framework in MVVM in the first place.
There are three fairly
popular presentation layer design patterns that I collectively call
the “M” patterns: MVC, MVP, and MVVM. This is because they all have an
“M” standing for “Model”, plus some other constructs.
The thing with all of these “M” patterns is that for typical
developers the patterns are useless without a framework. Using the
patterns without a framework almost always leads to confusion,
complication, high costs, frustration, and ultimately despair.
These are just patterns after all, not implementations. And they are
big, complex patterns that include quite a few concepts that must work
together correctly to enable success.
...
Trying to do something like MVVM without a framework is a huge amount
of work. Tons of duplicate code, reinventing the wheel, and retraining
people to think differently.
At least with a framework you avoid the duplicate code and hopefully
don’t have to reinvent the wheel – allowing you to focus on retraining
people. The retraining part is generally unavoidable, but a framework
provides plumbing code and structure, making the process easier.
You might ask yourself why the MVC pattern only became popular in
ASP.NET a few short years ago...
Strangely, MVC only started to become mainstream in the Microsoft
world when ASP.NET MVC showed up. This is a comprehensive framework
with tooling integrated into Visual Studio. As a result. typical
developers can just build models, views, and controllers. Prior to
that point they also had to build everything the MVC framework does –
which is a lot of code. And not just a lot of code, but code that has
absolutely nothing to do with business value, and only relates to
implementation of the pattern itself.
...
Typical developers really do want to focus on building models, views,
and viewmodels. They don’t want to have to build weak reference based
event routers, navigation models, view abstractions, and all the other
things a framework must do.
...
In the meantime, Caliburn Micro appears to be the best MVVM framework
out there – certainly the most widely used [as of 2012]...
(Text copied inline for preservation reasons.)
I made some GUI desktop applications on my first years of development, but my experience and practice have changed, so now I'd like to retake this subject with better knowledge.
Most of my experience has been web since then.
I've been reading about GUI Architectures, and several related questions here on S.O.. I know I'm still not in the "architect" level of knowledge from Design patterns and such, as to start building a great GUI App from scratch
I'm trying to figure out how to design an app with a GUI, using good design practices for the architecture. I'm focusing on MVC architectures, with RIAs (Flex, Java FX, you choose), thinking of keeping the GUI as decoupled as possible from the domain. This has brought me some trouble...
I've been having a hard time relating an MVC architecture such as SpringMVC with a GUI, which could also implement its own MVC. Most of what I've read are high level concepts, but I can't seem to be able to translate this into code.
"Where do I create the view?", "How do you hook the controller with the model and the view?", etc. These are some of the questions I keep asking myself after some reading and studying.
I'm probably kind of lost, and quite entangled as to where to start, so any help is appreciated.
Are there any guides/tutorials/documentation you can recommend to start on this subject? I should probably start with the RIA/GUI basics, and then specialize on the technology I'll use.
You didn't specify which language you prefer, but here are some practical guides for Java:
Java SE Application Design With MVC:
http://www.oracle.com/technetwork/articles/javase/mvc-136693.html
Model-View-Controller (MVC) Structure
http://leepoint.net/notes-java/GUI/structure/40mvc.html
Also, for specifically SpringMVC, here are some practical guides:
http://maestric.com/doc/java/spring
http://www.zabada.com/tutorials/spring-mvc-basics.php
I watched few videos/webcasts about "Oslo" but I still fail to see how it all comes together.
I understand that Oslo is a modeling platform.
What's the process to create a DSL?
Is it more than just a tool to create DSLs?
I understand that MGramma is used to create a DSL's syntax.
What is M language for?
What is MSchema?
After creating an MGrammar and compiling it to .mgx, what's the next step?
That Wikipedia article is pretty opaque.
The Microsoft project page for Oslo might be a better starting point. It begins:
About "Oslo"
”Oslo” is the codename for Microsoft’s
forthcoming modeling platform.
Modeling is used across a wide range
of domains and allows more people to
participate in application design and
allows developers to write
applications at a much higher level of
abstraction.
IMHO, it does seem more "fully buzzword compliant" than a real product. That said, it looks like there is some kind of demo or technology preview available for download. One might hope that they have included some samples that make it clearer what kinds of problems it is intended to solve.
Think of oslo as an excel/access replacement. Something for end users to model and process their data, without the need of developers.
MGrammer is where things get interesting for us, but the bits that are interesting are more of a v2 thing. You could think of it as excel macros done right.