Get rid of some concerns and unnecessary waste when coding for Continues delivery with ASP.Net mvc

I love simplicity I love the creativity of doing things as simple as possible, with the knowledge I have today. I know my knowledge is limited so therefore I always try to get new ideas, networking with people to get new input to create something even better or simpler than I did before. It is my way to continue learning and to improve and grow within my domains.

I do like source control frameworks like Git but I do not love the idea of spending too much time on management of branches, migrations and so on. Therefore I’m in love with the idea of creating SRP modules (single responsibility Principle). I want the integration part within continuous integration to work as smoothly as possible in order to get rid of unnecessary waste from merge-management and so on. This is another reason why I love the idea about Kanban regarding work on one task at a time combined with DoD (Definition of Done) before you start another one. When doing that, you will have finished components, which you can release without any problem. There is no point in not releasing, or there is no harm if doing so, unless it’s a change request of already existing feature that can’t go live at the moment.

No other users will use your components as long it’s not connected to an existing released feature. So in theory there is no problem to work with your main branch most of the time, you do not need to create a new feature branch and handle merge if that branch comes behind and such. It’s just bad waste.

Think of ASP .Net MVC Controllers, the only feature the controller gives you is the action you call, right? So if you release a controller that no one knows exist then the feature can’t harm the system right? Each controller has its own view, its own code, and if you use CQRS or Micro Service Architecture you mostly do not share functions with other controls or modules. The same should be true for other design-patterns like DDD-modules. What happens if you release a controller and all the parts are not fully done yet? Nothing right? It’s just there, it occupies some bytes on the server but it won’t break anything. Why spend time on administrations, configurations, management work regarding different branches when there is no need? You can let those controllers and features go live in your continuous integration, delivery and deployment workflow. OK, if someone manipulate the URL they might trigger this controller and that’s not OK. So I made a tiny little Action Filter that can handle this for me.

What about release you Controller module and only get access to it if a debugger is attached or you are in debug mode? and as soon you put the code in release mode, your controller will simply return 404 status back? That would be great safeguard if someone accidentally figured out the url to the not-done-but-released-feature.

This can be done easy with an [NoRelease] action filter attribute for the control.

1

As soon you try to access this isolated controller action it simple give you a “404 page not found” page if you try to access it in release mode. And gain full access if in debug mode. Other developers can also access your code it you want them to test something for you. I also made this action filter testable and loosely coupled. Which means you can create your own components that need similar functionality.

Maybe you love the idea of reading a configuration that says “release” or “debug” mode. Maybe you want to use as I do in the code example below; check if a debugger is attached or not.

2

I created my own DebuggingService (you can call it something else off course) that just check if the code runs under Debug Mode if it does it’s just returns and code will be executed as normal. If it runs in other modes like “release” mode it will throw an HttpException with the 404 status.

3

Since I started using this attribute I have had no problem to commit and push my features to the main branch and get it release with the nightly build. I spent less time on branches, merges and other stuff and I could focus on delivery rather than management. This because I love the idea of  low complexity in my source control structure. I know it’s not much, it’s no rocket science but a nice to have feature for a more safe integration and deployment of code in your continues delivery life cycle without spend to much concerns that code got released and spend time to prevent that.

4

Who is Johan Normén?
Johan Normén is 37 years old, work as a speaker, mentor, team leader, agile coach, and senior .net developer at Softhouse in Gothenburg Sweden. He has over 18 years business experienced and worked in many different projects and roles. Was one of the creators of Swenug (Sweden .Net User Group) with over 3000 members all over the country. He started the computer era as game designer at the age of 12 with his Amiga and team. He has been nominated as the top 10 developers in Sweden in the Swedish version of Computer Sweden 2015

Twitter: @johannormen

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s