S#arp Architecture - c#

Can someone share their experiences with s#arp architecture. we have decided to follow mvp pattern for the project. Is this okay to go with it ? The size of the project is medium. we are going to follow the tdd and ddd.
Can anybody explain how to use this architecture means explain about the layers. we don't have enough time to go through with entire documentation. if anybody expalin particle with small example in short.
please help me out!!!
Thanks,
Milind

The S#arp Architecture combines ASP.NET MVC with other frameworks and tools like
NHibernate 2.0.1
NHibernate.Validator
Fluent NHibernate and
Castle Windsor (IoC).
It also makes use of the T4 templating engine of Visual Studio to create view scaffolds.
So you could also ask yourself whether you would like to use these tools, libraries and frameworks in your project.
Frankly, if you don't have the time to read the S#arp documentation, then building a project on top of it is probably not a good idea.
One could also say the S#arp arch doesn't hide the complexity of each of the above library and framework from you, so you have to be prepared to look into each of these as well.
The S#arp documentation and the enclosing sample app explains the purpose and structure of the different layers quite well.

The S#arp Architecture project home page links to an active discussion group. I suggest you browse the group messages and ask any questions you have there.

S#arp Architecture is a neat combination of some other neat tools, but you really need to take the time to go through the documentation and some examples. The time you spend reading and learning is a lot less than the time you'll spend refactoring and bug-fixing if you don't study.

Related

Sharp Architecture alternative

I am looking Sharp Architecture alternative which use Entity Framework code first as ORM. Is there any mature project like Sharp Architecture with EF code first ?
Architecture is a blueprint. Once you see Sharp Architecture you should be able to simply think about it and change it to work with EF. If you are not able to do that you probably don't have enough skills with required APIs - that is th first thing you have to change before start dealing with architecture. No architecture will save you from understanding APIs and without understanding them you cannot do a good architecture correctly using features of your APIs.
Architecture should be driven by needs of your application. The approach where you want to bend needs of your application to fulfill some architecture blueprint is terrible wrong. First you have to define what should your architecture solve for you and after that you can ask if there is any blueprint already doing it (and nothing more).
Most of articles and sample architectures are just pushing a lot of patterns without actual need for them. Number of patterns and layers don't make a good architecture. In most cases it just makes the system overachitected and hard to maintain. These samples are mostly for explaining how to implement some patterns.
Bad news there is no exact replacement, Good news its easy to create something your own like I did.
I have been using S#arp for a long time and it is a good Architecture, I developed lots of applications with it but it looks like there is no more movement with that open source project so late last year I decided to move on an recreate something similar using the same principles but with Entity Framework.
Key components such as NHibernate, NHibernate.Validator and Castle Windsor was replaced to use Entity Framework, LINQ to Entites, System.ComponentModel.DataAnnotations and Autofac respectively. The layers remained the same like the Domain, Presentation, Task, Framework and Infrastructure.
On how I created it please have a look at this post on its detailed explanation.
http://www.macaalay.com/2015/10/20/creating-a-solid-architectural-foundation-from-scratch-is-not-really-that-hard/
I also created a code generator which I called Effinator, which generated CRUD operations and basic UI from your database design

How to write a good core architecture for a project in ASP.NET MVC

I'm going to have to write a big system in January with ASP.NET MVC3 / C#, and need to know how to write a system that will WORK. I do have a bit of experience with ASP.NET MVC and C# but would not call myself an expert. It needs to be extensible so that I can extend it later with new features. How would one go about this? Is there books that explains this topic in detail or should I use trial and error?
In short I need to know good design practice in my code thats extend-able for the future.
Regards
RaVen
The System will be a community portal with forums ratings etc. Cant say more than that << Company Policy>>, The forums I can manage because of plenty open source options... But the rest is up to me.
SOLID == Great Success
Follow SOLID principles in any project and you'll do well.
With regards to core infrastructure/architechure, SharpArchitecture is a good place to start. It is by no means the perfect solution...BUT they give you a good framework to play with and you can have a working system quickly while learning the concepts that work and don't work over time. Take a look and see what you think. It uses NHibernate, Castle and MVC.
Test Driven development will ensure quality for your project. Be strict with yourself, red green refractor. One of MVCs strengths is that it's easier to test.
Professional ASP.NET MVC 2 is a good starting point, though, I would assume that they'll come out with an MVC 3 edition as well. The NerdDinner tutorial contains a lot of ideas on how to structure your application.
Basic advice: work with the MVC architecture, not against it. Understand your application, especially your data model, and layer that onto your application structure. Typically you'll have a controller per model, but not always.
If you want more detailed advice, you'll need to be more specific about your project. I'd suggest coming up with specific questions about various details of your design as you have them, rather than a single question covering the whole project. The latter probably won't get the kind of response you desire.
you can use my "awesome" demo as a start
http://awesome.codeplex.com
If it's going to have to be extensible, make sure you write tests. You'll save yourself sleepless nights in the long run when you fix something, but ended up breaking the entire system.
As far as how to make things "WORK" - that depends on your ability. Read, and look to improve things, but don't get caught in premature optimization or it will leave you dead in the water.
Based upon your edit and your abilities, it might be wiser to select an open source CMS written in ASP.NET MVC and support it. Your skills are good enough, it sounds like, to learn how to write modules and be part of a larger community. You do not sound like you really want to write the whole thing because you are timid about your skills, deadlines, etc. Whilst learning the ins and outs of a well written piece of software, one day you may choose to write your own or contribute to a core piece of the software. There are several to choose from see my comment above under your question.
edit: I also think this will allow you to just start and not worry about every design paradigm people will throw at you for success.
WhoCanHelpMe is a nice reference application. It's built upon S#arp Architecture which is a good starting point for an MVC-application using domain driven design. That will also help you on the way with wiring IoC and db-stuff.
Remember that not every example and framework will fit your requirements, so do as jFar said, think SOLID and make your own decisions based on principals.
You should also look into MEF for extensibility.

Any Alternatives to NCommon?

I like the way NCommon saves me from dealing with all the plumbing required to do DDD with NHibernate.
I like it so much that it I am seriously considering it to be part of my default architecture in new projects.
I'd like to ask if there are other DDD alternatives (aside from coding from scratch) to what NCommon does.
Thanks.
I haven't used it myself in production, just skimmed the source code, but there's an overlap with S#arp Architecture. In addition to the NHibernate basics, you also get ASP.NET MVC basics, since the goal is "building maintainable web applications".

How to design the application to conform to the n-tier architecture? (Winform sample in .net with linq?)

Rather a simple question. But the implications are vast.
Over the last few weeks I've been reading a lot of material about n-tier architecture and it's implementation in the .NET world. The problem is I couldn't find a relevant sample for Winforms with Linq (linq is the way to go for BLL right?).
How did you guys manage to grasp the n-tier concept? Books, articles, relevant samples etc.
UPDATE: I kind of wanted a sample app not just theory. I like to get into the specific implementation and then iterate the principles myself.
It isn't technology specific but this is a very good book about n-tier architecture: Patterns of Enterprise Application Architecture
No, Linq2SQL in the BLL is not the way to go for n-tier architecture. I would use it in the DAL.
I would suggest you start here, and keep reading. It is a simple concept, but there is a lot of literature out there to help understand it.
Try to understand the concepts first, without putting proprietary technologies into the mix. Once you understand the concepts, then think how to use things like Linq2SQL.
There are also about a billion posts on SO about this already, follow this link and cherry-pick the relevant bits from them

What are some good open source c# examples of quality domain models [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'm a pretty young developer, and still in the emulation phase of my career. I have read a lot about some topics like concurrency, and using unit of work to allow your business layer to control persistence transactions. I have even implemented some painful, but functional code that implements these topics. But I have not really ever seen a real world example of a truly elegant implementation. I don't have a lot of good TDD, pattern focused role models around me, so I'm forced to look at the outside world for guidance.
So, I'm looking for some stellar examples of open source enterprise app domain models. Preferably written in c#, but other languages would be fine as well as long as they are good examples of clean elegant domain model solutions.
Some of the things I would really like to see are elegant solutions for Concurrency, Business Rules and Object Validation, Transactions / Unit of Work, and semi transparent logging mechanisms. I'm also curious to see what some of the real world best practices are for exception handling in domain model code.
I know I could just start tearing into some open source projects at random, and try to decipher the good from the bad, but I was hoping the expert community here would have some good ideas of projects to look at to stream line the effort.
Thanks for your time.
Edit
I'm not really interested in frameworks that make design and construction easier. My choice of framework, or whether to use a framework is a necessary consideration, but is entirely separate from my question here. Unless those frameworks are themselves open source, and very good examples to dig through.
What I am looking for is a project that 'got it right', solving a real world problem with code that is flexible, and easily maintainable, so that I can see with my own eyes, and understand an example of how it should be done that is not a trivial 50 line tutorial example.
I liked lot the architecture of oxite cms at http://www.codeplex.com/oxite. I learned lot from that project. I use nhibernate for data access instead of linq2sql and it works good for me. Of course its not a large scale project but its a perfect start. CSLA does not follow the DDD paradigm.
The above book ".NET Domain-Driven Design with C#" by Tim McCarthy (Wrox Press)" is really good one.
The best book for understanding DDD is Domain-Driven Design: Tackling Complexity in the Heart of Software by Eric Evans. This book is the "bible" of good DDD design.
Beyond that many resources can be found on http://dddcommunity.org/. There you can find more videos and articles from DDD experts including Eric Evans and there is a sample application of good DDD design but unfortunately its in java :(
You could check out nopCommerce i used it to try it work really nice and it has a good implemantation of DDD and BO, quite generic and fast, the install pattern is olso a classic so if you aiming a web apps you could check this out too.
Have a look at Martin Fowler's book, Analysis Patterns. It's an old book, so the class diagrams are not UML but something ancient (fortunately, the front and rear cover contains a description of the diagrams symbols).
And it doesn't have C# code. In fact it doesn't have any code at all because it is not a book about code, but a book about domain models. But it does have domain models to die for!
While it's not exactly what you asked for, Juval Lowy of iDesign has coded up some wonderful WCF Samples that tackle many of the situations you mention above.
The book ".NET Domain-Driven Design with C#" by Tim McCarthy (Wrox Press) might also be of interest.
I'd take a look at CSLA and its sample application, ProjectTracker. Here at work I've done a few projects using CSLA and it really does help your BOs be much more powerful & useful.
While ProjectTracker is not a real-world domain model it does cover a lot of the situations that a real domain model would need to. So if you look at the features offered by BO layers utilizing CSLA you'll get a good idea of what good domain models should look like.
Rob Connery (of MVC Storefront and Weke Road blog) http://blog.wekeroad.com/ has been getting into DDD of late. The MVC Storefront app may be modified to reflect his learnings, or so I believe. Regardless, he has some good material on this topic.
The website http://www.domaindrivendesign.org has a C# sample app.
One thing about DDD; it tends to be tightly coupled (in the positive sense) with the bsuiness for which it is written. As a result, the best examples are probably tied up in IP and unlikely to be available as OS.
The kind of design I tend to see is usually the anaemic domain model.
I wish I could tell you that I had a great recommendation, since I would love to see this question answered with a consensus home-run choice. But as objektivs observed,
... the best examples are probably tied up in IP and unlikely to be available as OS.
However, there's one domain for which we have abundant open-source code: software development tools.
This is a cop-out (I haven't done the legwork either), but if this question fails to produce a solid choice and you want to pursue this yourself, I would recommend starting with some of the more mature tools that many of us already use: NUnit, DotNetNuke, ScrewTurnWiki, NAnt, etc.. They have several distinct advantages, not the least of which is that their domain models will already be (relatively) accessible to you.
I recently come across tutorial on building Forum application with MVC, nHibernate, AutoMapper, and I find source code really good written and structured, with nice examples on using NH/FluentNH in web apps, domain model and repositories/services:
http://mattias-jakobsson.net/Item/45/Building%20a%20forum%20application,%20Part%209
Have you considered reviwing the Castle Project?
From the Castle Project "Castle is an open source project for .net that aspires to simplify the development of enterprise and web applications. Offering a set of tools (working together or independently) and integration with others open source projects, Castle helps you get more done with less code and in less time."
I would take a look at the dofactory GoF site. They have a bunch of examples that you can purchase for a pretty small price including:
* MVC -- ASP.NET Web Application
* MVP -- Windows Forms Application
* MVVM -- WPF Appication
It also includes two very good books: "Enterprise Design Patterns" and "Head First Design Patterns"
I'm currently working on a project using StuctureMap, Fluent NHibernate, Asp.net MVC, AutoMapper, Castle, and xVal frameworks. I've been getting help from the sample projects Nerd Dinner and Code Camp Server. Please let me know if you have questions about any of these frameworks.
http://code.google.com/p/codecampserver/
http://nerddinner.codeplex.com/
Take a look at my complete Visual Studio solution on GitHub that you can use as a jump start because it includes a very simple but layered architecture.
I've published detailed videos on object persistence on my blog at http://thomasjaeger.wordpress.com where I go into the reasons of the why and how of a centralized domain model in the solution.

Categories

Resources