An opinionated Enterprise Application Framework based on different Patterns, Principles and Practices of Domain Driven Design.Although not all tactical and strategic Patterns, Principles and Practices of DDD are in place but the most important ones(the ones that are used almost in any Enterprise app) are in place.Will try to connect most of the dots in future with time.This being a Framework, any application specific stuff is not there and will never be there in the Core code.
This framework is also helpful in scenarios wherein one needs to interact with different Integration technologies using different .NET based access technologies(can be DBs, SOAP or RESTFUL Web Services or MQs or File Sysstem or an LDAP or any other imaginable data source).Another possible scenario can be in a CQRS(Command Query Responsibility Seggregation) environment wherein the commands are processed in an RDBMS like SQL Server whereas the queries are executed to fetch data from NOSQL DBs.Also, once this framework is completed and if someone uses this framework, atleast for the development of a SPA based Web Application or Website or a Mobile Web application, ideally he/or she should need to work only on Domain Modelling(i.e. mainly Domain,Domain Services and Application Services) and UI stuffs(there might be some requirement for extending some extensibility points which are already provided out of the box or creating new extensibility points all-together or some other configuration stuff changes required like DI container specific stuffs or ORM configurations if RDBMS is used etc).That doesn't mean that all these can be applied only for Web apps or Websites or Mobile Web Application only but in-fact, parts of this framework can be applied to Business Process Management and Integration projects as well.
But please don't use this framework for some simple domain.DDD is more about domain modelling for complex domains using concepts of Entities,Value Objects, Aggregates etc and separating out your Business functionalities from your technical functionalities. Although this framework provides(or will provide) most of the technical functionalities(out of the box, including the source code) used in an Enterprise app and some base level classes for dealing with Entities,Value Objects, Aggregates etc but it's not necessary that one is going to need every bit of it. So use this framework(or may be just parts of the framework) deligently after analyzing the requirements for your app meticulously.
Implementation Overview-> Here the CommandRepository(for persisting data) and QueryableRepository(for querying data) are in-memory representation of some external source - mainly DBs(but can be extended to Web Services or MQ interactions as well or any other imaginable data source for that matter). The CommandRepository class needs instances of concrete implementation of BaseUnitOfWork and ICommand which can be injected using some DI Framework like Unity.
UnitOfWork (implements IUnitOfWork members) - De-couples the logic to do atomic transactions across Dbs(can be extended to use Web Services/MQs or some other data source as well to be part of the Transaction) using different DB access technologies(again can be extended to use Web Service/MQs or any other data source). UnitOfWork based transactions can be applied at the API or Domain Services or Repository layer.
ICommand & IQuery- Provides contracts to deal with different DB technologies viz. ADO.NET,Enterprise Library or ORMs like Entity FrameWork Code First etc and different DBs(current implementation supports mainly SQL Server - but as mentioned eralier also, can be extended to support other DB types as well).
N.B.-> If one wants to think of any imaginable data source as Repository then atleast for the query side it's better to have a IQueryable provider for the same(atleast to use this framework seamlessly). For an exhaustive list of open source IQueryable providers, one can visit Linq to Everything (well, it's almost EVERYTHING).If some imaginable data source is not mentioned in the afore-mentioned list then one can build his/her own IQueryable provider and hopefully the articles viz. LINQ: Building an IQueryable provider series, Building Custom LINQ Enabled Data Providers, Creating LINQToTwitter library using LinqExtender and Writing A Custom LINQ Provider With Re-linq can be helpful in doing the same.And if anyone builds any LINQ to Something(or "Anything") provider, then please don't forget to share it with the world.
Pending Tasks ->
• Incorporation of some tactical DDD stuffs(mainly the common framework elements).
• Trying exploring and incorporating Dapper(a Micro-ORM - Micro ORMs may not provide you some functionalities like UnitOfWork out of the box like that of an ORM but performance wise they are way better compared to ORMs), Event Stores and Grid Based Storage.
• Incorporation of some Restful stuffs which are commonly used in most Enterprise Apps.
• Whatever done till now is all Orchestrations rather than Event Driven Choreographies.Even the async await based request reply
mechanisms are also actually Orchestrations. True Fire and Forget Event Driven Choreographies(may be with some nominal acknowledgement sent to the requester) following Eventually Consistent approach WILL ALSO BE TRIED, at the Web API Layer using "Event Driven Rest" and at the Business Layer using Zero MQ.Zero MQ was designed from the ground up, keeping in mind stock trading apps wherein very high throughput and very low latency are required, as discussed here.
N.B. -> One can refer the paper - Your Coffe Shop Doesn't use 2 phase commit(written by the Integration genius - Gregor Hohpe, co-author of the Integration Bible viz. Enterprise Integration Patterns) to see how apps can be implemented without using Transactional Consistency.
• Testing BulkOperations using SQL Express Edition.
• Fixing WCF related Unit Test Case(s).
• Redesign Caching stuffs to support in-memory caching or some scalable option like Windows AppFabric or Redis(a scalable NOSQL option). Ideally, should be designed in a pluggable way to support any cool Caching mechanism coming in future as well.Also should use some AOP or attribute(annotation) based approach to apply Caching or invalidating the Cache else it becomes very hectic to apply these cross cutting concerns everywhere within a large application.
• Exploring Single Page Applications and building a Fluent UI Framework using which the UI layout(HTML + CSS) and UI
Behaviours(using Javascript) can be coded in a fluent way using Javascript.IF POSSIBLE, will try to have plugin features wherein SPA Frameworks like Angular or React can be plugged in as and when required.Will also try to incorporate Offline-First capabilities.All these probably will have a Github Project of its own and that will be used in this project.This is going to take quite some time since lots of exploration needs to be done in this area.
• Ultimately building a SAAS Framework based on all the above stuffs.
• Fixing or suppressing the Warnings generated by MS Code Analysis Tool (currently, Code Analysis Settings is set to "Microsoft Basic Design Guidelines").
• Also need to Run the Code Metrics to check everything is as per standards.
References(not that everything mentioned below is referred to build this framework, but atleast some bits of each of these awesome resources mentioned below have been referred or will be referred) -
- Patterns, Principles and Practices of Domain Driven Design
- Implementing Domain Driven Design
- Javascript Domain Driven Design
- Coding for Domain Driven Design
- Domain Driven Design Wiki
- Some very good samples to look out for DDD are Domain-Driven Design Using a Trading Application Example, DDD E-Commerce Sample, Domain Driven Design Using SpringTrader and Click's Hexagonal Domain Driven Architecture. Some other good open source DDD apps are like- I and II.
- CQRS Wiki, How Eventuate Works, Rinat Abdullin On CQRS, CQRS Myths, When To Avoid CQRS and CQRS Examples
- Building MicroServices and MicroServices in .NET(mainly the source code)
- HTTP: The Definitive Guide, Restful Web Services Cookbook, Restful Web APIs and Rest in Practice
- Almost Anything and Everything about ASP.NET Web API(including ASP.NET WEB API 2: HTTP MESSAGE LIFECYLE) and Designing Evolvable Web APIs with ASP.NET
- Some good Hypermedia Resources(needed for Event Driven Rest) - The value proposition of Hypermedia, Level Up your Web API with Hypermedia, Generating Hypermedia links in ASP.NET Web API and Building Hypermedia Web APIs with ASP.NET Web API
- 24 Deadly Sins of Software Security, Federated Identity,Guide to Claims based Identity and Access Control and An Updated Look At Choosing Between OAuth2 and SAML
- SignalR Programming in Microsoft ASP.NET and SignalR Blueprints
- Single Page Web Applications
- Telerik Academy's ShowcaseSystem(having a quite good SPA sample using Angular.js).Some other resources which might be looked out are Awesome Angular JS, Awesome Angular 2, Awesome Angular,Awesome React, Awesome React Native, React Flux vs React Redux, Awesome React Redux,Building realtime collaborative offline-first apps with React, Redux, PouchDB and WebSockets and Awesome Offline First
16)FluentHTML, Fluent Bootstrap, Fluent HTML for PHP, HTML Object and Tag Builder - Offline First Web Development
*** Also, if at all this codebase is migrated to .NET Core then hopefully ASP.NET Core Documentation and Porting to .NET Core will be pretty much helpfull.But currently lots of .NET Framework stuffs are not supported by the current .NET Core version as verified by .NET Portability Analyzer Tool.Also don't have any plans to have a mix and match of .NET Framework and .NET Core environment working together since that would have it's own challenges(didn't do any thorough analysis though) and the whole point of using .NET(wholly) for LINUX/MAC is missing in such an approach(although one might suggest to deploy .NET Framework code as a Web Service deployed in a Windows machine while the .NET Core code deployed in some LINUX/MAC machine consuming the Web Service but for sure, that would have it's own challenges).Anyways, that's secondary and so MIGHT be taken care at some later point of time.
Other Good Resources – Most of the references mentioned above are really good(especially for developing this Application Framework) but the resources mentioned below can hopefully make you a better Coder/Designer/Architect/Systems Programmer –>
-
Coding -> Some good resources in .NET space are C# 6.0 in a Nutshell, C# in Depth, CLR Via C#, .NET 4.0 Generics Beginner’s Guide, MetaProgramming in .NET, Pro DLR in .NET 4.0, Concurrency in C# Cookbook,Learn Roslyn Now Series,[Domain Specific Language in .NET] (http://udooz.pressbooks.com/), .NET Reactive Extension Resources, Akka.NET Resources and Awesome .NET. Some very good DSL(Domain Specific Language) resources are like Domain Specific Languages by Martin Fowler and Language Implementation Patterns by Terrence Parr(author of ANTLR) but probably before going into the depths of DSLs(by going through the afore-mentioned texts), a refreshing overview would be to go through Implementing Programming Languages using C# 4.0. A coder/programmer/developer can also opt for peeking into other languages/paradigms as well (via which one can use some unique aspect of some programming language into his/her favorite programming language to develop something cool or can become a Polyglot Programmer) and for that, one can refer [Pragmatic Bookshelf’s 7 in 7 series] (https://pragprog.com/categories/7in7). A programming paradigm which is in quite hype nowadays is Node.js and for that, one can refer - You don’t know JS Series,Stoyan Stefanov's JS Books,Nicholas C. Zakas' JS Books, Learning Javascript Design Patterns,Almost Anything related to Node.js,Node.js in Action,Node.js Design Patterns, Node.js Architecture slides from Slideshare and JS material available at MDN. Although the Javascript world has been moving towards Object Orientation(ES6 and ES7) but the irony is that the traditional Object Oriented languages like Java,C# have been moving more towards the functional side and for functional approaches, one can refer(mainly JS and .NET based language resources) - So you want to be a Functional Programmer, Functional Programming in C#, LINQ and Functional Programming via C#, Learning F#, Functional Javascript, Functional Programming in Javascript and Persistent DataStructure.For Patterns on Functional Programming, refer FP Design Patterns, Where are all the Functional Programming Design Patterns(Check for the answer by Corbin March) and Does Functional Programming Replace GoF Design Patterns.And for Unit Testing, The Art of Unit Testing seems to be the best resource.
-
Design, Architecture and DevOps – Some good resources in general for this space are Patterns Literature, UML Guide, UML Notations, RDBMS Data Modelling, Data Access for Highly-Scalable Solutions: Using SQL, NoSQL, and Polyglot Persistence, NOSQL Data Modelling, O’Reilly’s Beautiful X Series, Anything from WSO2(is just awesome), The Architecture of Open Source Applications, Application Architecture Posts by Martin Fowler, Application Integration Posts by Martin Fowler, Enterprise Architecture Posts by Martin Fowler, Practical SOA For the Solution Architect, Almost anything and everything on SOA from Manning,Anything On SOA by Thomas Erl et al, Microservices Architecture, O’Reilly’s Software Architecture Series, Architectural Styles and Patterns (including Hexagonal Architecture, Onion Architecture and Microkernel Architecture), Multi Layered Architectures in .NET, Are you a Software Architect, Infrastructure as Code, The Art of Monitoring, [DevOps in Practice] (https://pragprog.com/book/d-devops/devops-in-practice), Concurrent Programming for Scalable Web Architectures, Enterprise Architecture Frameworks, Gartner's Hype Cycle For Enterprise Architecture and Gartner's Hype Cycle For Emerging Technologies. Some good resources in this space from the Software Engineering perspective are Architecting High Performing, Scalable and Available Enterprise Web Applications, Just Enough Software Architecture(some recommended texts by this author), Software Architecture for Developers, [Architecture Principles : The cornerstones of Enterprise Architecture] (http://www.amazon.com/Architecture-Principles-Cornerstones-Enterprise-Engineering/dp/3642202780/ref=sr_1_78?s=books&ie=UTF8&qid=1308252595&sr=1-78 ), Non Functional Requirements, Scalability Resources, Architectural Tradeoff Analysis Method, Capacity Planning Resources, DevOps : A Software Architect’s Perspective and Other Software Architecture Resources.Again from the Systems Programming and Distributed Computing perspective, some good resources are like Distributed Computing for Fun and Profit, Awesome Distributed Systems, High Scalability All Time Favorites, High Scalability Real Life Architectures, All Things Distributed(Amazon CTO’s blog), Mechanical Sympathy(blog of one of the brainchild behind the superb LMAX Architecture), Operating System Support for Warehouse Scale Computing, BigData and The Not so Small list of almost all Distributed Computing Resources. And last but by no means the least, from a Cloud Computing perspective, some good resources are like Cloud Computing Patterns, Cloud Patterns, MS Azure Cloud Development resources from Patterns and Practices, MS Azure Solutions, Azure .NET SDK Capabilities, MS Azure Certifications, AWS Architecture Centre, AWS .NET SDK Capabilities, AWS Security Centre, AWS Solutions, AWS Certifications and Guide to Open Source Cloud Computing Software.
*** Also,one can refer Udacity Courses(alongwith Downloads), Coursera Courses, eDX courses, Recurse and Developer Y's CS Video Courses for overall breadth and depth of Computer Science and Engineering.
**** One of the best way to learn SPA,REST/MicroServices and DDD(including CQRS and Event Sourcing) is to grab some
existing good open source projects and then gather the requirements (from the source code), analyze the requirements, architect/design/implement the requirements(alongwith unit and integration testing) using priciples of SPA,REST
/MicroServices and DDD(may be if needed, can apply parts/whole of this Framework for the same). Some intriguing
open source projects in this regard are -
a) ASP.NET - ASP.NET(& .NET in general) Open Source Projects and ASP.NET Samples.A good article with regards to comparison of various ASP.NET Technologies is WEB FORMS, MVC, SINGLE PAGE APP, WEB PAGES COMPARISON.
b) E-Commerce - NopCommerce, SmartStoreNET and Virto Commerce
c) Trading - StockSharp
d) CMS - Orchard and Umbraco
e) CRM - SplendidCRM
f) Personalization - My Web Pages Starter Kit
g) Web Portal - DropThings and ASP.NET Portal Starter Kit
h) Social News - Kigg
i) Blog - BlogEngine.NET
j) SOA - .NET Stock Trader
k) Workflows(along-with some Utilities) - NeoVolve.Toolkit.This project is more of a toolkit, the utilities and concepts of which can be used to build REST/DDD based Workflow projects.Also watch out for WWF based PageFlow samples like Rule Driven Pageflow / Workflow and ASP.Net Page Navigation using Workflow 4.0.
l) Concurrency - Parallel Programming Samples and Parallel Programming Extras. Again,please note that these projects are not mentioned for learning SPA or REST or DDD principles directly but the underlying principles can be used for some REST/DDD based projects at the server side.
m) Angular.JS - Telerik's Showcase System.Probably the best resource to learn SPA using Angular.js.
N.B. -> It’s not that I have read/viewed everything mentioned above but yes, I have read/viewed a few of them (partially or completely) and many are yet to be even started(for reading) but all the resources mentioned above are some of the best resources(as per my interaction with some beautiful minds and my own exploration). Also, something not mentioned in the above list doesn't mean that it's not good - only that I am not aware of(or not my preference).
P.S. -> Once completed, this DDD framework can be considered (as a whole or in parts) as a Reference Architecture for quite a variety of application scenarios. Ultimate goal is to build an Omni-Channel Offline-First Single-Page-Application based SaaS Framework using DDD and Restful API concepts (although parts of the framework can be used for a BPM and Integration Project as well).