I also hated the fact that I was essentially repeating code a lot. I don't know if anybody else has had this frustration of repeating code before, but I was definitely over this frustration. My particular pain point was data validation rules. I remembered back to my computer science schooling years before, that one of the principles, one of the maxims, that I learned in my first programming 101 course is what we now call the DRY principle.
And so I developed this idea of middle-end architecture. It's a tongue in cheek idea. What comes between the front end and the back end? Of course, the middle-end. I defined it as the top 10% of what's happening on the server and the bottom 10% of what was happening in the browser, and everything in between, and I called that the middle-end. It involved all of those tasks that I was talking about. So at the time, there was no such thing as Node.js. We had a couple of things, like in the Java world, we have Rhino, which still exists today and it's being rewritten, I think, to a different engine or whatever, but we had Rhino, which was a way to do it but that only worked if you happen to be in a Java shop.
Could be a mobile app, could be a website, could be another API server, it doesn't care. The back end simply becomes a headless black box state machine. It manages the session, it knows what state it's in, you give it some data, it gives you some data back. That was attractive to me because I didn't want to have to relearn every single back end system to figure out how to manage the headers and the cookies and the HTML files and all that stuff. I just want you to give me some data. I'll figure out the presentation layer. That's the job of the middle-end.
So even though today I'm not going to espouse, specifically this middle-end architecture, I just want you to have that as the backdrop for what I'm talking about when we go into this code.
Note: This course was created on 03/29/2016 by Frontend Masters. We are pleased to host this content in our library.
- Carousels, panes, and modules
- Middle-end architecture
- Secure phrase generator
- Routing functions
- Calling the API
- Rendering on the page
- Shared data validation