Juan Barahona
5 min readAug 11, 2020

--

Nowadays there are tons of options when it comes to starting a new project

  • Should I use microservices or should I explore serverless applications?
  • How should I build my front-end? Angular, Vue, React?
  • What database should I use, Relational databases or Document Oriented Databases?
  • REST, GraphQL or GRPC?
  • Do I need to use docker? everybody does!

See, I am not a particular expert on any technology, but still, I have been able to excel in my previous jobs (at least is what I believe), but the thing is that I was able to excel on those jobs because I was building solutions on top on an already working infrastructure, and now I know, that was relatively easy.

Yes, I built some projects while I was learning and even did some interesting things on my free time, but I never needed to think about scalability or maintainability, I didn’t even know what those words mean at that time. So, that signifies I never did an enterprise-level project from scratch.

Well, I tried one time, in the final project for the University and guess what, I failed! Why? because I got excited seeing real experts on conferences like NDC using those new and attractive technologies that I just wanted to use them on my project at all cost and … I ended up spending about 4 months configuring and learning only the tip of the iceberg of those technologies, and so I failed.

Now, with those learnings in mind and the experience I gained working in the Industry, I decided to start my own enterprise-level project, but I know this will not be easy and If I really want the project to flow, I need to build a good plan, and after seeing and reeding lots of awesome videos, courses and books, one day I just said myself, I must…

Build a working but clean prototype as soon as possible

It’s a prototype, so I primarily want it fast; But as a dream I also want this to be evolvable so I can simply take the code of my prototype and start adding more and more things to it until it finally becomes an enterprise-level application without the need to sacrifice the scalability or the maintainability, even better I want this evolution to guide my decisions about what technologies I need to use, when, and more importantly why.

And if I can ask something else, I would like to build this prototype with my existing and quite common skills which consist of:

  • Able to program in any programing language although I am not an expert on any
  • Able to express my UI in terms of HTML and CSS

I you look at the principal requirements to build the prototype the most obvious answer could be: Build it using JavaScript, HTML, CSS, and possible Node.js and I was about to do that until my mind just said…

What about Blazor?

I like the C# Language for no particular reason, just like it, and again… after seeing videos of the pros using Blazor I got excited and I wanted to give it a try at least for a couple of days.

Blazor for Fast Prototyping

Without the intention to fully learn it I came up with a hypothesis:

It looks like I can use Blazor as a simple host of my application

It couldn’t be that easy right? At this point I stopped doing questions and started the journey

Building my knowledge on the business

After researching about Design Sprint and Event Storming I ended up picking the simplest for me which was Domain Storytelling.

A few snapshots of the process

Designing the UI of the prototype

I made some designs on Adobe XD in the past, so I used it to build my UI prototypes:

The application is POS system, here some snapshots of the UI

Building the Business Logic

I created a simply dotnet library without any other dependencies where I built my code free of infrastructure concerns.

Blazor to wire things up

The time to pass that point where I got stuck when I was doing the University project arrives.

  1. I created a new Blazor Wasm project and deleted everything related with the sample
  2. I wrote normal HTML and CSS code to reproduce the UI and I needed to put my HTML code into a .razor file but that was the only thing I did related with Blazor until this point
  3. I referenced my core project and starting the process of merging everything and it was amazingly easy, let's see the result:

As expected, I was able to use Blazor as a host of my application keeping the use of its features to the minimum (at least from code point of view):

  • Lots of what I considered complex behaviors where resolved by simply adding a for or an if to the .razor
  • The state of the app was managed by a relatively small class called AppState which is registered as Singleton so it can be shared across pages.
  • Everything else is simple HTML and CSS

Conclusion

I must start this by saying thank you to the Blazor Team and the entire Dotnet ecosystem to make this fast prototyping possible. 🥳🥳🥳

Now for me the application is in a beautiful state that can evolve:

  • I can keep enhancing the Core project without the need of any other technology at least for now.
  • Other technologies will not rule how should I need to write my code (I hope this last until the end of this project but looks difficult).
  • Whenever the time comes, I will be able to simply move the Core to the server side (this is what I would like to achieve).
  • I can start adding technologies to my project that really make sense for it.
  • I feel that whenever the time comes, I will finally be able to answer me those weird questions in my mind like: Why do I need to add weird ids to business logic? or Why do my classes need to look so anemic? or even Do I really need to use those popular databases and ORMs?

Feel free to look the entire code of this iteration on Github.

--

--

Juan Barahona

A software engineer that focuses on research and teaching and would like to discover and share more about the field.