
Links to tutorial parts
- Building a Website Like a Boss
Background
This series of blog posts will cover how I am building my side-project web application. I am documenting it because I am using some technologies and methodologies that are really powerful when used together. And hey, it might be useful to someone
.
It all started off with me learning ASP.NET MVC and then trying to apply Domain Driven Design (DDD) to it. I conceptually got the ideas talked about in DDD, but found it really troublesome applying the theory to a physical implementation. I spent a good deal of time playing around and researching how this could be achieved. I don’t think I was the only one struggling with this – I found a really good series on MVC by Rob Conery where he also struggled with trying to architect a perfect solution.
Soon after my fruitless attempts at creating a text book example of DDD in a web application, I was pointed to CQRS and Event Sourcing in a passing conversation with a colleague. From initially learning these two new words, I went away and did a lot of reading and learning. Learning these new technologies and processes made everything click together and I think that the architecture should really excite you for the following reasons:
What The Architecture Offers
- Any interactions with the system are persisted. This means you can replay the entire system to any point in time. Say the business people come to you with a hypothesis that website users are 95% likely to buy an item that they removed from their shopping cart within 5 minutes of placing their order. You can include this logic, replay all events and see whether it is true or not. Its Business intelligence on roids! Or if a client reports a weird bug that you cannot see, you can just replay the events and step into the code at any point in time!
- Data is stored in the database as JSON, which means it can be handed straight to the UI. E.g. a jQuery AJAX call to a URL which MongoDB services the request and returns straight up JSON. No need for request -> back end code -> more back end code -> goes through an asp.net repeater -> rendered in html.
- Data in the website is all de-normalized, which means there are no queries going on for requests
Yes you read that right. Begone Get.all.stuff.where.blah.isnot(5).insersects(something).on(lame==true); (Disclaimer: That wasn’t code – but you get the idea).
- Utilizes a NoSQL document database which is seriously fast
- The system broadcasts all events, which gives you a true SOA foundational architecture
- True data ignorance – start modelling the domain first, you can ignore what the data model looks like
- Using BDD you can communicate what the application will do in a format that any one can understand (this really helps with documentation too)
- The domain objects will not have unnecessary CRUD methods/information in them. They will be purely used for modelling business logic. Nothing more.
- I’ll never need to worry about transactions (in business logic)
- The underlying Enterprise Service Bus means that no user intention is lost and everything is transactional
- You implicitly get a full blown audit log from the previously mentioned fact
- Fully Asynchronous – which means scalability and speed
- Software becomes more scalable – Faster reads from data lead to a far more responsive website
Sneak Peak/How Do We Do This?
In the upcoming posts I will be covering the following technologies and approaches (don’t worry if you are not familiar with some of them – all will become clear with time).
- ASP.NET MVC
- Domain Driven Design – DDD
- CQRS
- MSMQ
- NServiceBus
- Event Sourcing
- Behaviour Driven Development – BDD
- MongoDB & Fluent Mongo
- JSON
- Knockout.js
- JavaScript and jQuery
- Some form of caching
Personal Goals for the Web Application
- Implementation of best practices
- Implementation of some new technologies (might as well try out some of these new technologies that have been coming out)
- Robust
- Logging/Audits
- Scalable
- Testable
- Localization
- Secure
- Promote synergy – Like a Boss
- As cheap licencing costs as possible
We’ll drill down into the details in the second post.