Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm making a large scale MVC application using Orchard. And I'm going to be separating my logic into modules. I'm also trying to heavily decouple the application for maximum extensibility and testability.

I have a rudimentary understanding of IoC, Repository Pattern, Unit of Work pattern and Service Layer pattern.

I've made myself a diagram. I'm wondering if it is correct and if there is anything I have missed regarding an extensible application.

Note that each module is a separate project.

Architecture diagram


Update

So I have many UI modules that use the db module, that's why they've been split up. There are other services the UI modules will use. The UI modules have been split up because they will be made over time, independent of each other.

share|improve this question

migrated from stackoverflow.com Oct 18 '12 at 15:53

This question came from our site for professional and enthusiast programmers.

    
one thing is: it looks more like MVP than MVC (because your view layer is not connecting directly to model) –  Cyprian Oct 17 '12 at 10:36
    
Segregating UI and DB access into separate modules makes little sense to me unless that DB code is going to be used by more than one module. And even so, it may be better to make it a library rather than a module. Separating data access code is of course a good thing, but that can be done within the module. A module in Orchard is a self-contained set of features that preferably makes sense on its own. I think that DB module fails that test. Then again, I'd need to know a whole lot more about the specifics of the project. This is all way too vague and general. –  Bertrand Le Roy Oct 17 '12 at 16:21
    
Sorry it is so vague, I'm trying to make it as clear as possible using the graph. I've updated the question to provide a bit more information. If there is any more information that will help please tell me –  MrJD Oct 18 '12 at 3:22

1 Answer 1

Correct in terms of what? Your question is vague so it is hard to answer. I think you may have some misconceptions about what Orchard is. Your diagram shows Orchard as as what seems to be a web server, and it looks like you plan to do all this architecting of your modules, separating ui from db, and using all the patterns you mentioned, etc on top of Orchard. But Orchard already provides all that, Orchard provides a method of data access, dependency injection, content management, versioning, Theming, uses asp.net MVC which is your flavor of MVC, etc. The point of it is that you can use Orchard's existing extensibility to build your application. People using Orchard have even discussed whether or not "framework" might be a better description for Orchard than "CMS", because of all the things it does, and the variety of apps that can be built with it.

There is already a pattern for how to build applications with Orchard, which is different from your diagram. You are free to do your own type of db access, and customize everything, but if you find yourself building a new app from scratch with Orchard, and from the get-go circumventing all the patterns that Orchard provides, you may want to rethink things.

You should read or re-read the documentation at http://orchardproject.net. You will find that to build a site with Orchard you just need to make one or more modules, and a theme. The modules can be as granular as you want, and if you build things the way the Orchard docs suggest, and using existing modules (both core Orchard ones, and 3rd party ones from the gallery) as examples, your app will have a good separation of concerns. You will be able to takes pieces in and out, replacing them with different implementations without too much effect on the rest of the system, etc. If you just follow the docs to build a super simple module, you will have used pretty much all the patterns and architectural concepts you mentioned whether you are aware of it or not.

share|improve this answer
    
I realise I was a very vague. Having said that, you mentioned some people refer to orchard as a framework rather than a CMS, that makes me feel better about orchard because to me it never felt like a CMS. I'm concerned with how to build an extensible application with a pre-existing db. You mentioned there was already a pattern to build web applications with orchard, could you by chance point me towards that? –  MrJD Oct 18 '12 at 3:28
    
With a preexisting db you will be more constrained. I have built one app that was a mixture of pre-existing db and asp.net-mvc code, plus new modules and features. I didn't bother trying to do cool design patterns to the preexisting stuff because it already worked, and it was way too big. You can search around on stackoverflow, there are one or two questions about porting preexisting apps into Orchard. As for the pattern for building apps in Orchard, just read the documentation, and look at the code for other modules from the Orchard core, and from the gallery. –  Giscard Biamby Oct 18 '12 at 12:19
    
For example, orchard comes with a wysiwyg editor module, TinyMce. On the gallery I put up a TinyMceDeluxe module that replaces the functionality. You can disable TinyMce module, and enable the TinyMceDeluxe one, and it just works. All the places in Orchard that used TinyMCE continue to work, but with the new functionality. Or look at Piedone's Combinator module. It handles javascript and css minification and bundling. It works on top of Orchard's resource management, replacing some pieces of it to hook in it's own new features. –  Giscard Biamby Oct 18 '12 at 12:21
    
I also made a syntax highlighter module that extends the existing Orchard.Blogs module by attaching Google code prettify javascript onto blog posts, to add code syntax highlighting. THat syntax module attaches itself to blog posts on the fly, without modifying the code of the Orchard.Blogs module. It's pretty awesome (i think Orchard terminology for this is "welding" parts onto Content Items). These are all examples of taking advantage of Orchard's extensibility. –  Giscard Biamby Oct 18 '12 at 12:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.