How to apply Test Driven development for GUI application(VC MFC)? - user-interface

Can I use TDD for gui application?
How to do it.

The answer which has evolved over the last few years is, you don't apply TDD to the GUI, you design the GUI in such as way that there's a layer just underneath you can develop with TDD. The Gui is reduced to a trivial mapping of controls to the ViewModel, often with framework bindings, and so is ignored for TDD.
This is known variously as the Presentation Model (Fowler) the Model-View-ViewModel and DataModel-View-ViewModel architecture.
This approach removes the GUI layer from TDD and unit testing. It does not mean the GUI is never tested but just acknowledges that it is not cost effective to pursue automated GUI testing, particularly as part of TDD. Integration and user testing should cover the GUI.
Josh Smith's 2009 WPF article is a detailed explanation of MVVM with some testing.
More recently, Houssem Dellai's 2016 video Creating Unit Tests for Xamarin Forms Apps shows a XAML UI with bound ViewModel and walks through creating a unit test project

Why not. Here is a good article, from object mentor.
Found another blog post, TDD - Introduction to Moq. Its related to C# and VB.NET.
Checking out Myth and Misconception regarding TDD is a must.
Here is a book related to .NET, TDD in Microsoft .NET.

Chad Myers has a nice walk through testing the controller:
http://www.chadmyers.com/Blog/archive/2007/11/27/tdd-with-asp.net-mvc-3.5-extensions.aspx

Related

Can the Model View Presenter be used in a native desktop application?

I'm just starting out on GWT, and I came across the MVP (was actually trying to get ahead of myself..get a little motivation). I already have a desktop application that I want to modify, can a desktop application use the MVP? and if the answer is no, what components and or classes can be used to simulate having a model view presenter?
You cannot compare GWT and MVP: they are totally different things.
GWT is a toolkit that allows you to write desktop-like web applications in java.
Some years ago, Ray Ryan from google gave a talk at the Google IO where he presented an effective pattern to code web applications using GWT. This pattern is MVP. It was not invented by google, it was already there. It's just fit for purpose when you come to write desktop like web applications. At least, this is what Ray Ryan proposed in his talk.
As far as I know there are 2 most famous implementations of the MVP in GWT: Acticivties and Places (Google) and GWTP (Arcbees). You can also create one yourself as exercise, it is not too complex. The main concept is having the view as dumb as possible and put all the business logic in the presenter. The View and the presenter collaborate through an interface. Ok, easier said than done, I'll give you that. But you can google for more.
So yes, you can write a desktop application using MVP.

What is the life cycle of web developing

I just wanted to get right picture of design cycle. I have gathered list as follows,
Requirement gathering
Wireframe design
Visual design (user interface)
Mockup (prototype)
Development
Do you have different view?
However I have gathered the flow, it may be suggested or commented by community. And I wanted to enhance its technical names, I don’t know I much I’m success.
Consultation
Content/ Functionality outline
ite diagram
Page description diagram
Technical design
Wireframe
Prototype
Usability
Visual
Concept
Design Presentation/ UI Architecture
Fine tuning
Development
xHTML/ CSS/ JS
Accessibility
Compatibility
Test
UI
Content
Accessibility
Compatibility
Your ideas make this flow rich, for sure.
Analysis
Specification Building
Design and development
Content writing
Coding
Testing
Promotion
Maintenance and Updating

Sample N-tier ASP.NET MVC3 application with best practices (using EF 4.1)

I am looking for a sample ASP.NET MVC3 N-Tier application that demonstrates best practices (uses Domain Driven Design and Entity Framework 4.1 Code first). I found the following. which one do you recommend out of these (or any other one not in this list)?
http://efmvc.codeplex.com/
http://prodinner.codeplex.com/
http://www.dofactory.com/Framework/Framework.aspx (not free)
I was in the same position not long ago.
The things you linked are OK, but certainly not enough on their own.
I find this topic lacking in the free resources, as it is quite big and needs good organization and breadth. On the other hand, there are good resources if you are willing to pay a little.
These are the resources I used:
PluralSight - training videos. ($30 per month, quite worth it, not affiliated, but a subsciber)
Here are the courses that are great on the topic:
Principles of Object Oriented Design - by Steve Smith, he is a great lector.
Design Patterns Library - over 10 hours of videos on design patterns. Can't compare them to DotFactory, but they are very well done.
Inversion of Control - what the name says, important topic in depth.
There are also lots of stuff on TDD, MVC, EF etc. All worthy topics.
Books on Kindle (I haven't been reading lots of books, but Kindle really revived my passion for written knowledge)
Professional Enterprise .NET
Microsoft® .NET: Architecting Applications for the Enterprise
Applying Domain-Driven Design and Patterns: With Examples in C# and .NET
Have you seen the following projects? They also have the source code that they can have complete documentation.
http://microsoftnlayerapp.codeplex.com/
http://www.nopcommerce.com
Best practices are always subjective. Your application may require DI and as well as Interceptors but sample apps are relatively small and putting anything into there turns out to be ridiculous. Still, I would suggest you to go through MVC Music Store. It has pretty good implementation and a very good sample.
http://mvcmusicstore.codeplex.com/
Although this post is old, But I have had same problem to find a good and modern pattern for a good ntier application. After I goggling for some hour, I Found Onion Architecture By Jeffrey Palermo. It is a must read article. here: jeffreypalermo.com/blog/the-onion-architecture-part-1/
By using this article and using some other researches I Made a template (Example) of this architecture that uses Entity Framework 6.0 and Ninject Dependency Injection 3.2.0
NTierCSharpExample
I this template: Center Layer Is Domain Layer. Then Service Layer that is a bridge between presentation and Data Layer.
For simplicity I used console app for presentation but you can simply remove it out and plug in a new asp.net mvc 5 application or any other presentation app you want.
Funny this kind of question comes up couple of times per week at least recently.
What I can say, only about the layering of the different projects, accordingly to my experience and feedback I've got, is to check question and my answer here:
MVC3 and Entity Framework
RKP this is not answering all and completely to your question, is about layering the architecture and some ideas on why only (see comments under my answer).
I make a good pattern based on EF 4.1 and MVC3:
MVC3 and EF architecture
good luck

MEF vs. PRISM. What is the difference? What will be supported in the future?

What I want to create is a Silverlight app with a few tabs/modules that will all be separate DLLs.
I see PRISM has the Shell/Module concepts that seem directed towards doing UI and I find a nice demo (showing how to search digg/twitter).
But it sounds like MEF will be included in VS2010 so I would like to go with that option.
Can anyone somehow clearly explain the differences? (I am not a advanced programmer)
MEF and Prism serve two very distinct goals.
Prism is basically guidance for designing composite applications - where you have a shell and "regions" that are dynamically assigned, and integrated. It includes an IoC container (Unity) that it uses for it's injection.
MEF is a dependency injection framework - it's main goal is to "fill in" depedencies at runtime for an application. In this respect, it's filling the same goal as Unity does within Prism (and, in fact, you could pretty easily rework Prism to use MEF instead of Unity).
Prism fills a broader scope, in some respects, but is also really limited to GUI applications. MEF is just doing one thing (Dep. Injection), but geared to be more general purpose, for any type of application.
As for the lifetime of these products -there is no answer here, but this is kind of how they're being developed:
Prism was developed by the Patterns and Practices team. The goal isn't to necessarily make software, but to provide guidance. As such, they update (although somewhat infrequently) the Prism library and sample, but Prism isn't a core part of the framework shipped by Microsoft. It's really a third party library (even though MS funds a lot of it, most of the P&P people aren't MS FTE).
MEF, from the blog posts, sounds like it is planned to be integrated into the framework, and be used directly inside of MS projects. As such, it's getting heavy development, directly from Microsoft, and being used in their products.
I, personally, have read through the Prism documentation (and have the book), and have gone through the samples. It is very helpful to understand how to break apart an application, but it really is guidance more than a complete, usable framework. The samples are very good at doing what they're designed to do - educate an architect in how to design a composite application.
If your goal is to just keep a clean separation of concerns in a silverlight application, I'd focus more on learning MVVM than necessarily just using Prism.
If you want to use MEF, there are other good options. For example, the WPF Application Framework is an entire MVVM framework built on top of using MEF, and fairly nice.
Basically, MEF is a general-purpose extensibility framework:
If you are building extensible applications, extensible frameworks and application extensions, then MEF is for you.
whereas Prism is mostly for building GUIs:
The Composite Client Application Guidance is designed to help you more easily build modular Windows Presentation Foundation (WPF) and Silverlight client applications.
So MEF and Unity are basically the same...
Well, not exactly. MEF is more focused on extensions which aren't known at compile time, while IOC containers generally focus on dependencies which are known at compile time. The top answer to this question gives a good explanation of the differences.
Yes. Check these two posts for more:
http://blogs.msdn.com/gblock/archive/2009/12/02/mef-and-prism-to-be-or-not-to-be.aspx
http://blogs.msdn.com/dphill/archive/2009/12/09/prism-and-mef.aspx

MVP Taligent Programming Model for .Net

Has anyone created a .NET control architecture using the taligent programming model as follows?
http://www.wildcrest.com/Potel/Portfolio/mvp.pdf
As stated by IBM -
MVP will enable IBM to deliver a unified conceptual programming model across all its major object-oriented language environments
The question is how do you implement or map the IInteractor concept (Page 9) to a .NET interface? Currently the guess is to use the IInputElement interface as a the event source for all UI input controls.
If anyone has already implemented the taligent pattern in .NET, I would like to know if it is applies to both Silverlight and WPF. If so, does it apply to the union of their interfaces?
Finally this represents the unified abstract architecture and can displace PresentationFramework.dll. If you see this applies as a control architecture, please comment.
That depends on what you mean by ".net". The term covers many kinds of applications. Web apps, Web Services, Windows Forms apps, WPF apps, etc...
MVP is used a lot in ASP.NET Web apps. See:
http://msdn.microsoft.com/en-us/magazine/cc188690.aspx
The article How to: Implement the Model-View-Presenter Pattern of the MSDN patterns & practices section seams to be what you are looking for...
We have created a complete MVP framework for .NET, based on the Taligent ideas. It took us some time to get right but now we can create applications by writing business classes, creating a new form and drag-dropping the properties of a class onto the form.
The framework is very sophisticated and allows for the customisation of forms at runtime, as well as automatically hooking up validation in the business classes to edits on the form.
We also wrote an OPF (Object Persistence Framework) to complement it, so avoiding the need to manage database code as well.

Resources