Shift to functional
The advantages are obvious: better testability, simpler application structure, performance improvements. The greatest disadvantage is that it requires some non-trivial effort for established OOP programmers to move to functional programming. Not surprisingly, as we have observed ourselves, junior developers without much experience are quicker to adopt functional ways and use them actively from project start.
React + Redux is still a great way to structure and build a web application from the grounds up using FP principles. And it will continue to be in 2017, that’s for sure.
Elm is a purely functional language that compiles to JS, and might be a nice way to compete with the above. It thrives in code cleanness, user friendly attitude, and a complete set of development tools. Note: It’s not a framework or library which you use in ES6 - it’s a brand new language.
If you like functional programming and want to use it actively in web development, it should be really easy nowadays. Choosing the solution you are most comfortable with is the hardest part, it seems.
Frameworks: is there a real choice?
Of course there is, one might tend to say when looking at pages like TodoMVC.
But that playground aside, let’s ask: is it really a valid argument to search for a new framework just now, in 2017?
React is and will be there for a long time, undeniably because of Facebook’s influence on the rest of the web. Although it was released for public just a few years ago, the sheer size of the community and code spread is huge. You simply cannot fail choosing it today.
Of course, there are important issues regarding React that you need to answer before you proceed:
React with… what? React is not a complete MV* framework. It is mostly concerned about the view and partially about the controller responsibilities - with the right components. So you still need some other library to be plugged in to do the business logic stuff. As above, your primary choice would be probably Redux, or MobX (more on it below).
React is still Facebook’s property and as such has some surprising terms and conditions that you need to meet. Did you know you cannot use it if you sue Facebook in the future? Or that you cannot make a product in React that would compete with said company's activities?
React needs quite a lot of tooling to work comfortably. But you probably will use Babel/WebPack to power all the transpiling and modules… so no biggie there.
AngularJS is the second contender. Actually, according to many sources, it’s number one through usage. Currently, you need to be aware if you are planning to use Angular 1 (probably due to backward compatibility) or 2 (recommended if you are starting a project), as they are completely different.
There are good reasons why you would choose Angular 2 over React:
If your project is composed of a lot of “standard” MVC pages - CRUD templates,
if your project is huge, but relatively trivial and repetitive,
If you want a lot of the “common” web application bells and whistles to be in place already, compared to React.
MobX, Vue.js: watch them carefully
MobX caught the attention last year as a nice replacement for the beginner-demanding Redux on data management. It is really simple and follows nice structural logic. MobX integrates very well with React and there are many strong proponents arguing that it’s a much better fit for most cases than Redux.
MobX adds observable features to existing data structures and is based on what can be called “functional reactive programming (TFRP)”.
It is much easier for complete beginners - last year our junior dev completely coded a non-trivial school project in it without prior MobX / React knowledge, delivering the resulting app quickly.
It is however often argued by many Redux proponents that MobX makes it easier to write bad code. The final choice is probably a question of which style is more acceptable to your style.
Vue.js directly competes with React and is chosen by many, not only because of Facebook’s terms. It’s unlikely it will ever be more widely adopted than Angular or React, but it’s still an interesting solution.
Speaking of React alternatives:
Preact- 3kB minified, very small library using the React API,
Infernojs - 9kB minified, insanely fast React-like library for high-performance apps
Atom – a full-featured hackable editor, as its tagline implies, grew to wider adoption in just two years. Built in Electron, which in turn translates into JS and HTML, many people love it for the level it allows itself to be changed prior to the needs of the developer.
VSCode is growing popular, being also not even 2 years old. Based on the same technology as Atom and built by Microsoft, it is strangely not related to Visual Studio as you would expect it to - but exists in a stand-alone version as a source code editor, for many platforms.
Yarn. Replaces npm in speed, reliability and security. You probably already migrated to it in your project, so explaining makes no sense, right?
WebAssembly is the most interesting concept you would probably hear of nowadays. We can imagine right now how you shake your head: Web and Assembly? But it’s actually a pretty good idea, as it turns out:
Of course the adoption of this W3C standard is another question entirely. But, because Chrome, Edge, Firefox and WebKit have reached a consensus recently, this technology is going to be there, soon.
Service Workers offer complete control of your browser file fetching, which is a great tool for offline control. When AppCache is considered obsolete as of right now (thank God), this should have been there, like, yesterday. But, apparently, the only problem today is the current browser support: only Chrome and FF have it ready. Edge at least in development. And Safari has “brief positive signals in a 5-year plan”… let’s hope all the browsers have it in production by 2018.
Another interesting reads
And more stuff by Stack Overflow - according to Stack Overflow Developer Survey 2017, 64.000 developers talked about their tools, education and habbits. Interesting finds:
- 62.5% respondents can code in JS,
- developers love to learn: 90% say they are at least partially self-taught,
- by far, reading official documentation and using Stack Overflow Q&A are the two most common ways developers level up their skills,
- on Stack Overflow, Angular triumphs over React by 44.3% to 19.5%,
- React is however No.1 in the "most loved frameworks, libraries or other technologies" by far. Speak about forbidden love :-)
A Bright Future