Thoughts of Front end: AngularJS 2.0 & border of front, back end
Frontend Learning Curve
Everyone learning Angularjs would find 1.x self created so many concept, so the learning curve become so deep. But as for a whole front end project, what you need goes without saying is not simple, but Angularjs as a “big and do it all” framework, self included a whole solution, once you learn it, then you be free, just like python web framework Drango & flask, people have their own cup of tea. Of course, light-weight framework brings us flexibility, but as a beginner, they will always get shit on their hands. Just like the React Wave, I just hold my opinion, as a frontend newbie, what should they choose?
As a frontend newbie, I would still recommend to get your hands dirty with a full and do it all framework, a goo d framework will not only force you to not make mistake, and the “Convention over configuration” will let a guy who don’t know to make constraint, to make constraint, when you have learnt that thing, you can go rock and roll. Just like in the youth of us, we learn the skills we should have before we grow up, when we have what it takes, we begin to think, decide where to go.
On the opposite way, it is obviously difficult to pick your own road. As for React, the concept it brings is short and giliverble(给力 in Chinese it means give you the force, kind of like may the force be with you, haha…). At the same time, if your gole is the whole frontend project, what you need is not only react, you will face the problems like build, router, data flow and a series of problems. Just like when you meet AngularJS, you will then begin to be tortured by various of concepts that so many 3rd parties library give you. At this time, do you still think the the combo skills is still better than do-it-all solution?
When we get to a degree of height and see the problem, it sound the problem is so simple that it doesn’t exist. But how could you get to that height? Just try both. When you have an amount of exp, then you feel following won’t give you the final answer, only by experiencing can you have your own knowledge. Then take my word, just do it!
AngularJS 1.x to 2.0
From the migration docs of angular 1.x you can see, Google has simply the content of the core modules, and have the least concepts. AngularJS have so many features, people love: dependencies injection, modularity, two-way binding, semantic directives and so on. But if you are used to wring backend code, the so-called DI and modularity is very common technique you use for code layers, and two-way binding is just a simple version of VM, the core and the most fancy concept is directive, which give html more power, same as let the browser learn new syntax.
But at the same time, the directive become so complex, giving too much function to template will only let people to remind of the old fashion way like JSP & ASP, they use the content of database and logical judgement to fill the html template. But now AngularJS give too much power like JSP, it let and even encourage the programmers to write code that are disorder, the template once again become a grey area.
One of the founder of AngularJS, Misko Hevery said, Angularjs make up the lack of power of html semantic, by letting use of directives, to expand the html vocabulary, let the developer to use html to create dynamic content, so make the development & test easy.
When AngularJS come out, it’s not for developer, it’s just a tool, more lean to the designers who need to create persistence html form content. As time passed by, it make adjustments to adapt to various situations. Developers use it to build even more & more complex apps, not only do incremental changes based on the foundation, it’s far from the destination. This is the motivation of AngularJS 2.0. I intentionally go to the blog & twitter of the author Rob Eisenberg. And find out that he is:
Creator of Caliburn.Micro & Durandal. Former Angular 2.0 team member. Currently building a new tech startup, Durandal Inc., whose first product is Aurelia.
Aurelia have many similarities with Angular2.0, you can reference Introducing Aurelia, post-Angular era, the features they all mentioned.
And you can find more about its features like module, web components, observe, promise features. It is saying that the denounced performance is optimized yamedeyamede(in Japanese, it’s what girls yell), after all, I’m looking forward to Angular 2.0!
Divide the front-end and back-end?
In an article about angular, author ppk and translator have mentioned, angular is more or less oriented to IT department of corporation, not front-end developer, and many AngularJS developer come from a background of Java. In the field that lack workforce of front-end field, there must be a lot of java developer need to write JavaScrip, but at the same time, because JavaScrip lack constraints, make the java developer more “have no idea”. At this time the constraints of Angular, dependencies injection comes out, particularly to those backend developer, if they obey to the rules of AngularJS, their production rate will raise.
At the same time, the unique coding style AngularJS has, that way more lean to serverside, not the browser-side, the way it ruin the performance drives some original front-end developer away. As for many front-end developers, the biggest problem is AngularJS force yourself a designated way to do things.
Another problem about shitty front-end code xufei mentioned is: front-end lack architecture thought, or project leader & architecture(usually backend) don’t have enough front-end knowledge, and without these two points met, only shit can be done by any framework. And the point we should object is it has a big relevance to the usability and difficulty of the framework. If the developers can have clear architecture thinking, then you can write back-end beautifully in pure Java, or you can do a nice job using only JS, CSS, HTML?
And here we have a more interesting problem, and either end, we have the corresponding “template” concept, then which should do handle the html dynamic content, that is, divide the front-end and back-end? There are two guru arguing each other, I personally support calidion’s view, we shouldn’t tell the absolute front-end & back-end, the more info is, what’s the border of front-end & back-end? The conclusion is the runtime is the only border of front-end & back-end.
Original by 2016–02–06 吕靖 ThoughtWorks