I have recently been experimenting with Node Js and some other languages which compliment NodeJS.
I will attempt to give my explanation (to the best of my knowledge so far) so it may help some others to get started with this beautiful new approach I am working on.
Node Js – Is like Apache, handles a lot of processing, web/network etc…
ExpressJS – is a so-called middleware, which acts I suppose like PHP does on top of Apache.
Jade – Well this is a template language (markdown as oppose to markup) which will allow people to create pages and apps very fast.
The Problem with Forms
Many years ago, we did not put much thought or effort on the frontend and most importantly was influenced by really smart backend developers, who did not care much about details or design aspect. I feel that today’s modern browsers suffer from one idea which has haunted us since the beginning of the www/browser revolution.
The main problem is the data structure, I want to emphasise data structure as this is really important.
We don’t pay much attention to it, most of us use forms, to submit the data back to the server, and then let the server or the Controller (the C in the MVC world) deal with it; I think it should be dealt with.
When we use forms we have to flatten our data structure to suit the form, and then send the data to the server as the browsers dictate it should be in yet another different structure, then yet again change this structure to suit the database structure, this is a problem why do we have to change the structure of our data or manage it in multiple places? especially when we have to manage it in all these places the frontend, server/controller and database. So now we have a bigger problem when the data structure goes out of sync and it is really, really annoying when we need to change the data structure as this happens often especially in the commercial world.
Why, What, why is this a big deal?
Well some of us know of this problem, and ignore it, some of us do not even recognize it as a problem. The big issue is there nonetheless, if one asks you as a developer he says, I would like a date, or a title, or a checkbox, or whatever input capturing method you have.
They are asking to capture data, a piece of information of a certain type. so we think, quick, we think easy, we think what we already know because this is safe and comforting for you and the people above you asking in the first place.
But think about it, if you could gather the right information “data types” all you have to do is compare a boolean answer is it true or false, instead we push the problem to the backend or the processor to handle this for us, it’s no longer our problem.
Starting from the frontend, we have to stop using forms, period. As scary as this sounds and as far-fetched as this sounds, the benefits of not using it far outweigh the comfort and safe bubble you have created.
We get the data from the server as an object with the right datatypes and we should not change the datatypes, if we use forms we just simply manage this strings of inputs convert back and forth wasting time on something we really should not, it should be defined in one place and one place only.
Say we make a request to the server asking for some data to use on our frontend, manipulate it by changing the “values” not the structure (“keys”). Then pass it back to the server.
Trying to solve this very problem, I have worked on a project to get it to a decent standard and usable for all.
I will soon be publishing this new tool which will handle this problem very well, and a few other features.
Do check back soon for new posts and I promise you will love this, it will save you so much time on your next project and give structure to front-end like never before.