155 comments

[ 2.6 ms ] story [ 46.3 ms ] thread
I've focused on backend for the last 7 years or so, so I've been kind of out of contact with the frontend world. Recently I started working on a personal project, and I thought it would be a good time to learn some of the modern tools people have been using for frontend dev.

I was completely baffled by the myriad of options out there, how complex they look (note I've been working on very high performance, distributed backend applications, so complexity on itself is not an issue), and how it's very unclear when to use any one of them or what each one is good for. I tried Angular and React, and both feel like almost a different language. You have to learn their internals to work effectively with them, and it often looks like they create more complexity then the original complexity they were trying to reduce. I have no problem learning new things, in fact, I love it! It just feels like there are other things to learn that will stick around for longer - JS frameworks/libraries seem to be very hype-driven these days. What are your thoughts on this?

Just learn vue.js, and use the associated vue libraries, vue-router, vuex, etc.

Start with: https://nuxtjs.org/

And go from there, I wouldn't waste my time with Angular, and React is much more complicated than Vue.

This is very subjective. I feel React is conceptually simpler (no custom templating language) and less opinionated (no official state management system like Vuex for example).
Vuex is no more tied to Vue than Redux is to React.
Your response is a bit disingenuous.

> no custom templating language

JSX may not be a templating language but you still need to consider it when comparing with other framework's languages

> less opinionated

The community is though, if you don't do things with redux, react-router, etc then you're considered odd. Any job you pick up with react is sure to use those.

> The community is though, if you don't do things with redux, react-router, etc then you're considered odd

A bit disingenuous there. In general people find Redux quite complicated and it everyone acknowledges it requires quite a bit of boilerplate when used in the default way. Quite a few like MobX, or using their own state management.

I've found the community to be very open to alternatives and helpful.

I've used neither of those libraries in any of the production React apps I've made.
You've mentioned one of the exact reasons why I found Vue.js so much simpler. It's highly opinionated, which for 95% of the time, in my experience, is exactly what I want.

I found myself much much more open to JS library fatigue with React; the ecosystem is so vast that it's hard to figure out which particular store I need, or which routing library I want or what form library I need and so on. I've seen a number of people complain about this, especially new comers.

I find the opinionated nature of Vue.js so refreshing, especially for newcomers, which the OP is, hence why Vue.js is a much better option to begin with. And continue with, but that's a decision I guess the OP can make further down the road.

You don't need a route library. You don't need a form library.

What do you need a routing library for? Have a single controller component (usually the most outer shell app component) and sprinkle in further functionality (e.g. history pushState) as necessary. Don't build it out until you actually need it.

I've never needed a "form library" because forms are almost always interactive in some specific way. Using a form library is almost always guaranteed to just get in the way.

You don't need to have a global state management library either if you have a good grasp of your apps data structures and how they need to be passed into components.

I find with React I get the opposite of javascript fatigue: it's so easy to build anything you need once you understand react that you won't need to search for all those libraries and code snippets.

I guess we have completely different approaches to software development.

I really hate reinventing the wheel, especially when good quality production tested solutions are out there. React libraries, quality wise, I've found hit or miss.

I find Vuex a very nice global store and the tooling (chrome plugin etc..) is top-notch.

You won't be reinventing the wheel for things like global state management and javascript routers. I promise. These libraries are huge solutions to problems that may or may not be huge - and in most of the cases I've seen, YAGNI.

The concept of maintaining application state is nothing specific to SPA's. What is new is the idea that every application must have a global data store where all state is saved. This is a trend and not always necessarily a best practice.

This isn't a matter of reinventing the wheel, it's a matter of using an oversized solution for an undersized problem.

Don't start with nuxt.

Start with the Vuejs tutorial on their website. Vuejs docs are amazing and one the big reasons why people enjoy starting Vue.

Nuxt docs are so-so and can be quite confusing.

Agree with this.

I tend not to use "quick starts" especially when using something new since you a) don't learn the internal gubbins b) are more fucked when something breaks.

When I started with WebPack and TypeScript I deliberately started from an empty webpack.config.js and an empty tsconfig.js and added in stuff as I went at the end I had a decent understanding of what everything in both files actually did and they only did what I wanted.

I've never found a quick start that helped me (in terms of total time) since the time spent fixing it when it breaks always exceeds the time taken from just doing it manually the first time, after I understand what I'm doing then I'll consider the quick starts.

Poi is a good webpack wrapper for vue. Is a webpack with zero config
I guess I should have been more specific here, my bad.

Reading the Vue.js docs online is of course the first port of call; the documentation is very good, so much better than Reacts. One of the few occasions I've been able to learn a good majority of the project without resorting to googling for tutorials and other community contributed resources.

I recommended Nuxt as a good "this is how you put a enterprise ready Vue.js project together" so the OP would learn some good habits in project layout early on.

I tried to like VueJs but just couldn't. Seems just like another Angular 1.x like framework. I am done with HTML template API's. So many failed attempts using this concept. Anyone remember Polymer? That's what I thought.
Nuxt is the Vue version of Next, which I highly recommend for quickly bootstrapping a production-ready React app with server-side rendering and so on.
For me I picked up React pretty quickly but I was using old school includes in the browser with the babel compiler.

I tried moving to a newer version and start using with npm and webpack and I got a little lost.

Started using the php framework laravel it has a mix package build in that makes everything very simple.

My advice for backend developers is to use either the laravel framework or standalone npm laravel's mix package.

With a simple command preseyts for vue, react, bootstrap come out of the box to allow you to focus on writing code vs setting up webpack or gulp or grunt and managing that yourself

There is nwb and create-react-app that takes care of initial configuration now. Unless you're gonna write everything from scratch you're gonna need to learn npm though.
hi, im helping build a fairly vanilla ecommerce site in either reactjs/vue. I want it to be entirely server-side rendered with high SEO visibility. However.. (and this is the big point), have the same APIs exposed for mobile apps as well.

How do I do this ? Any templates to explore this pattern ? It is fairly straightforward to do this in rails, but in the world of react/vue, it seems that the whole community is geared towards rich client-side applications with low SEO.

There are many examles, like next.js. Or search for isomorphic or universal js.
Yeah, there is a lot of (developer driven) hype around new tools. I see it as both negative (hard to keep up, confuses those new to JS) and positive (lots of innovation and people trying many ways to solve things).

If you want to learn a front end framework, pick one that's got a lot of community support (Angular, React, maybe Ember or Vue) and focus on it. Don't get distracted. Even when things change, it'll be good for a long while.

I feel the same way about backend development. I stick to express.js because I know it, but I'm aware of at least a dozen other Node frameworks, and hundreds for other languages. Frontend is far from unique in growing in complexity as the web has changed.
As a desktop developer, I rarely ever touched backends. Though they are not "modern js", it was close enough to that madness to stay away from it. Otoh, I can't remember a time when I couldn't easily grasp any of Qt, Gtk, whateverTk toolkits in few hours. A month ago we started a project with a custom backend (on me) and had to choose a frontend option for our frontend-employee to use. It feels like hell, really. We picked Angular2 randomly after few probes and it seems that out project has more quirks, hacks and LoC than if we just coded it in pure js with heavy templating help from e.g. perl backend. I don't know where it all goes about the web. Before, when I heard about new cool js framework, I thought "well, guys do The Technology". Now that I'm forced to dive into it, I see that they just reinvent square wheels in a wrong ways that were polished a decades ago in regular desktop apps.

Not to blame or insult good frontend people here and everywhere, but it feels like en masse they don't understand the programming essence at all. Sorry, but UI development was never HARDER than today. My colleague feels the same, having more than 15 years of html/css/js experience.

My thoughts are we're throwing it out next week and generate all ui with decent server-side scripts, leaving /js/util.js of 1kloc as a broker and generic table sorter.

(comment deleted)
I hate to be that guy but you are confusing simplicity and familiarity.

> I can't remember a time when I couldn't easily grasp any of Qt, Gtk, whateverTk toolkits in few hours

When I tried those things, I had a hard time making an hello world app in two hours because of dependency/build/tooling issues.

However I was able to grasp angular 2 in two hours probably because I am more familiar with the frontend ecosystem.

It would be like saying that because you knew english & german and was able to quickly learn swedish, you should be able to learn russian easily.

> Not to blame or insult good frontend people here and everywhere, but it feels like en masse they don't understand the programming essence at all. Sorry, but UI development was never HARDER than today. My colleague feels the same, having more than 15 years of html/css/js experience.

15 years ago the js applications were nowhere as complex as they are today. So obviously things are a bit more difficult IF you want a rich application. If you just want to make a simple document you don't need all those librairies.

> We picked Angular2 randomly after few probes and it seems that out project has more quirks, hacks and LoC than if we just coded it in pure js with heavy templating help from e.g. perl backend

This is your first project with a very unfamiliar tech. This was an expected outcome.

> My thoughts are we're throwing it out next week and generate all ui with decent server-side scripts, leaving /js/util.js of 1kloc as a broker and generic table sorter.

And that's a perfectly reasonable option, especially if you don't have someone with more experience in frontend tech to keep things sane.

> When I tried those things, I had a hard time making an hello world app in two hours because of dependency/build/tooling issues.

I'd be interested to know how you tried.

For instance, for GTK:

https://developer.gnome.org/gtk3/stable/gtk-getting-started....

For Qt, the IDE itself comes with examples that can be built and run in two clicks.

Or maybe you want to use python ?

  virtualenv --no-site-packages .
  source bin/activate
  pip3 install pyqt5 
  echo "import sys
  from PyQt5.QtWidgets import QApplication, QPushButton

  if __name__ == '__main__':    
    app = QApplication(sys.argv)

    w = QPushButton('Hello world')
    w.show()
    
    sys.exit(app.exec_())" > main.py
  python3 main.py
I fail to see how this is more complicated than using npm or bower to fetch the relevant libraries.
It's great that Qt works with virtualenv and pip, Wx does too.

This is a quite recent phenomenon and to be applauded.

Minus sides -

Neither of these work with pypy yet (ideally the bindings would be rewritten using cffi for best benefit).

The downloads on these are quite big, but maybe this isn't the end of the world.

Gtk still doesn't work with pip like that yet.

Pyimgui may be worth a look if you want a small download that works everywhere, though it does look like it's own thing.

Our node_modules are 100Mb too, not counting a browser itself. Gtk recently quit building for MSW at all and relies on MSYS2, and it works now via 'gi', like any gir-enabled libraries, no custom wrappers needed. I ran complex Gtk3 Windows widget galleries last month, for Lua and Python at least.
Fair points, generally, but LoC and deadline arguments still kicking my ass. I'm counting days, not hours, that we are spending on magic issues instead of programming our direct business. No rant, I have an example right before me.

Our CEO, also programmer in distant past, took his macbook, asked me "where do I get Xcode", and in his free time did anything we did in web, including animations, itunes-like header/progress area, etc. With my "intensive kickstart", obviously, but the shocking fact is that he never touched Objective-C, Cocoa, AppKit and HTTP. Never. In. His. Life. (Though he has very strong background of sockets, threads, C, widget frameworks, coreutils, evaluation models and general software engineering). It took about a week or two in between of management and negotiations to simply write that thing by all canons.

I don't think we'll hire another frontend master on the middle of the road anyway, but that has something to do with complexity, not competence.

(Fun thing, he started with Swift but quickly "downgraded" to Objective-C, because Swift was getting in his way too much with no clear benefit.)

> Now that I'm forced to dive into it, I see that they just reinvent square wheels in a wrong ways that were polished a decades ago in regular desktop apps.

Being a desktop and embedded developer myself, I share your sentiment. My personal explanation of the state of the art of web UI tech is, that there can only be wrong ways of doing it if the basic abstraction at the bottom of the stack is wrong. HTML was invented as a hyperlinked semantic document markup language with presentation largely left to the browser's interpretation. Presentation (CSS) and interaction (JS) aspects were only added (dare I say "glued") to it later, which seems like a design afterthought.

> whateverTk

> Now that I'm forced to dive into it, I see that they just reinvent square wheels in a wrong ways that were polished a decades ago in regular desktop apps.

If you're talking about tcl/tk, decades ago it had a motif look to it (raised 3d borders, lots of grays). There was no theming engine. Font sizes were integer only (and that only recently changed). I'm not sure what the status of antialiasing was, but it probably wasn't good.

The event loop was (and is) slow. Unicode support was new.

Oh, and then there was the documentation. Seems like everyone who installed tcl/tk on a university machine made a public copy of the docs. So if there were bugs in a topic of the doc (and there were), and you searched for something related to that topic, you'd get back 100 links to copies of that same doc which all had the same error. What you wouldn't get were in-depth blog entries explaining that topic, complete with inline, cross-platform working demos which you can read, write, modify, and-- with a single shortcut-- inspect using one of at least 3 completely different implementations of the same standard from competing companies.

Oh, I almost forgot-- if you were making a cross-platform application for MacOS, Windows, and X11, you would spend a lot of time on at least one of those platforms trying to figure out some crazy workaround for a bad UI decision.

For example, for a file dialog under Windows and MacOS a call to the native libraries is made to get a native dialog widget. But in Linux of the late 1990s/early 2000s there was no such thing as a native dialog. So some tk developer coded their own file dialog.

Let's say you started in a deeply nested directory and you wanted to climb out. You see a button that goes one level up the directory tree. Great. You click that button and on Linux now the window shrinks because its width is set to be as wide as the directory being shown. So you couldn't do multiple clicks in a row to climb up the tree without moving the mouse to the left for each click.

You might be able to dig into the internals and muck around to get that dialog to have a better UI. But then you notice that the window menus in Linux-- unlike the ones on MacOS or Windows 95-- don't toggle the menu display on click. They only display on click. Not sure about Gnome 1, but Gnome 2 window menus definitely toggled on click. If you want that standard behavior now you've got to dig into yet another implementation-specific codebase for your tcl/tk installation. And since you're mucking around inside the implementation there is no guarantee that what you change will still work when you upgrade to a newer version.

If Firefox rolled their own weirdo file dialog on Linux and required an extension to get something that looked better, you can bet every new release would be met with complaints and sneers about just that. Yet whenever people bring up whateverTk it's some kind of antediluvian paradise.

Tcl/Tk never clicked for me, because it had no decent business table view (or I just didn't find it). When Borland died, Gtk and Qt were the only viable alternatives, though I can remember some shallow experiments with early Wx, Fox, FLTK and pure GDK/Cairo :)
I hear you brother. Sometimes I think with emscripten, web assembly, and WebGL, I should just write the thing in C++ using a UI toolkit that is older than my coffee...
The only thing that really sticks are the fundamentals like algorithms and design patterns. The tools always change. If you want to be a stronger developer down the road focus on the fundamentals.

JS may seem hype driven because it is very active. I think you're right that it is hype driven as well simply due to human nature. We all fall for it on the rest of the internet. We fall for it when working with frameworks too. I mean, how many of us didn't really read the React license before building an app with it?

I've been doing frontend for several years and largely agree with what you're saying.

It's not just frontend though; the entirety of all ecosystems springing around dynamic languages seem to suffer the same phenomenon.

I actually blogged about exactly this topic last year.

As a backend developer (and a new entrant to the JS world), the one thing I was looking for from a JS framework was that it should scale with my application. And somehow none of the frameworks do well on that metric, except VueJS.

Here's the post if you're interested -https://sgoel.org/posts/non-technical-reasons-why-i-like-vue...

React can do it, and any other virtual-dom framework. Your problem is that you're looking for a framework, but these are just libraries.
Actually I'm just looking to get things done. I'm pretty sure React can do all those things and much more. But speaking as a backend dev, getting to a state where I can write useful code was faster with Vue than with React.
This is why Web Components are so important.

It's great to have so much innovation, but when each innovation is incompatible with the next it makes it very difficult to actually use the better things. You can't incrementally adopt them, you have to port an entire application.

This in turn makes it harder for new entrants to get adoption, even if they're better in some ways, because they need to reach a critical mass before many people are willing to put in the effort to, and accept the risk of, porting a whole app.

If we establish the base component layer and interop with the platform and other components - which Web Components does - then people can innovate on the internals of components, things like how and when DOM is updated. This is mostly what's being focused on anyway, the component models themselves are usually pretty comparable.

Not to mention that Shadow DOM is incredible and just fixes CSS.

If Firefox finishes up their Web Components implementation soon, we'll be at 3/4 major browsers with native Web Components support. I think more people will take them as a given for basing their UI libraries on.

I did look into web components and google polymer, great idea, still somehow not gaining much traction as they should.
I work on Polymer, and I think we're well on the way to fixing that. Our uptake with large enterprises is quite good already, we're just not very popular with the HN crowd... yet.

Our annual summit starts Tuesday, and the talks are live-streamed, check them out for some updates: https://summit.polymer-project.org/schedule

Thanks. Looking forward to the live stream.
I tried to push polymer at my work (I use it for personal projects).

The problem I came into is I am a backend guy trying to convince that polymer and web components are the only sane way that I have ever seen to do web dev.

To many people were set it their own ways had just flat out did not want to learn something new. They could not put down react and redux for two seconds. Admittedly I am not a front end developer, but when I did get some to have conversations many of them went like this -- How do you do xyz in polymer / web components -- Umm seems to be a concept your framework had to create at a work around, that is not something you will need to worry about any more.

So what did we end up with? Some use react, some use ZK!?!, some just stick with straight up html/css/js -- oh and we have some angular too, but that fell apart because the guy doing it tried to do some weird shit with making some sort of tight integration with zk...

Side rant, if I have somebody send me that video about how react just had to be created to fix unread notification count at facebook one more time...

Webdev is a mess in my opinion and coming from the backend / systems side of things polymer / web components is the only thing that looks sane to me. Beyond what the component looks like I think a push in this direction will hopefully remove the requirement for a "web developer" vs just another developer who can work on any part of the project.

I've been using Polymer for several years on my side projects - Based on pure technical merit, I've always liked it the most of all other front end frameworks (though I have to say that in the early days performance and cross-browser compatibility were issues; but it's no longer the case though; now it's just great).

Most companies these days are using React or Angular 2 (that's what I've been forced to use as part of my contract work). VueJS is getting traction but I don't feel that Polymer is getting the recognition it deserves just yet (it's very hard to find Polymer contract work).

I really like that I don't need a separate compile step to build an app (almost no setup). The way the components compose together is also really nice. The CSS style encapsulation of Polymer 2.0 is another great feature - It might upset a few people due to lack of automatic backwards compatibility with external stylesheets but I do think it's the right long term decision.

If someone is starting an app from scratch today, I think that Polymer 2 is the best choice.

Wow, this couldn't be better place and timing for me. I can actually make it. I can't find anything about price. Is it free to attend? Would love to come.
Yeah polymer summit is free, I was going to attend this year but some thing collide for me :/
Also, take a look at SkateJS, a Web Components library that takes a more JavaScript-centric approach than Polymer: https://github.com/skatejs/skatejs

By default it uses Preact to render components, but you can switch it out for any renderer.

The author of SkateJS is speaking at the Polymer summit too.

If you run into Trey at the conference tell him we're all waiting for it! With excitement :-)
The [Aurelia](https://aurelia.io) framework is also aligned with Web Components and other web standards.

Aurelia extends beyond Web Components, and comes with a lot of features built-in, such as routing, validation, and internationalization. This saves time from having to assemble/build your own framework.

Can I pick your brain for a minute? I'm vaguely aware of what the shadow DOM does, how on earth does it have anything to do with, let alone "fix," CSS?
It "fixes" it by (sort-of) hiding the styling from the parent CSS. Shadow DOM is kind of like OOP in that regard: it encapsulates a bunch of data (styles, other objects) and makes it seem like one object.. er, sorry, I mean component :)
Shadow roots - where components put their internal DOM - create CSS scopes with both upper and lower bounds. This gives both encapsulation and perf benefits.

1) You don't have to worry about selectors for your component internals accidentally matching somewhere else in the document. As a result you can write simple selectors, often just tagname or id selectors, and have much smaller stylesheets. It's just a lot easier to read and reason about.

2) Perf is better, partially because of smaller style sheets and simpler selectors, but also because there's much, much less tree invalidation when DOM changes because you only invalidate inside the scope of the change. There's also huge parsing benefits because browsers deduplicate <style> tags that have identical text, so if you put the same style in many shadow roots, it's only parsed once, and one stylesheet object among all the roots.

I often hear that "DOM caching, DOM invalidation" talk, but being non-web guy can't figure out what's the issue is. Seems like Santa didn't deliver cell renderer conception into DOM? :) Afaik, you basically draw table rows and cells via distinct widgets, no doubt it's expensive as hell.
Universal web components are a pipe dream.

Even within a community using the same framework or library, there is disagreement on how to solve certain problems. For example, the folks behind React Router removed parsing of querystrings, because people wanted the flexibilty of using alternative solutions [0].

It's hard to imagine something more trivial than parsing querystrings, yet no consensus exists among users of the same library (which itself is not officially-sanctioned by FB yet, and even React, while stronger than other libraries, is not loved and used by all client-side web devs) on how to do it best.

Yet people think someday in the near future, these differences will just disappear magically, and we will be able to author web components that snap--like Lego bricks--into whatever environment a developer wants?

[0] https://github.com/ReactTraining/react-router/issues/4410

If you look at the component models themselves, they're incredibly similar to Custom Elements. Most of the lifecycle hooks are the same, and things like setProps() in React are replaceable by reactive setters.

So yes, I do think it'll work.

(comment deleted)
querySelector() and querySelectorAll() are similar to jQuery, but they are not what unseated jQuery. It took a new library with compelling new features (unidirectional data flow, no need to use a special, crippled language just for templates) to get people to abandon jQuery.

React is the dominant client-side web framework, but its preferred template syntax has a method for inserting components into the document which is totally different from the "standard" (and Ember) way of doing things. JSX uses CapitalizedComponentNames, while the standard uses dasherized-component-names. JSX has self-closing tags with slashes before the closing angle bracket, while the standard does not.

There are perhaps tens of thousands of devs using React, Preact, and Inferno. How can these differences be smoothed over in order to enable universal web components?

100% agree. Plus web components are underpowered, imperative turds.

Reusable = Reusable within ONE family of applications using a similar stack. That's already pretty nice.

UX guidelines keep evolving too and it will remain a business advantage to be able to provide a better experience (and quickly so) than your competitors. Who seriously like the crappy <select> or <input type="date"> desktop web browsers provide?

I do when they work. I really hate when someone reimplements select without supporting things like typing to skip select an option. And honestly, on mobile, the built ins are the best.

There are react components that provide a good experience that replicates the features of most built ins, but it's a constantly moving target considering native widgets vary between platforms.

In general I agree with you and gp though. I would love for web components to one day be the standard but I'll believe it when I see it.

Web Components would make me finally be happy again when doing web development, but sadly I don't get to code only for latest browser versions and polyfills many times hinder more than help.
They are super hype driven, now let me hype you for my personal fav.

Vue is the most similar to vanilla JS that I've used so far. It stays out of your way and works like you expect it to. I like that it only handles the render layer. It says to you "Give me a template and give me data. The data is up to you, I'll handle keeping the template up to date."

I'd love to use webcomponents but they're not going to totally replace these toolkits and right now the polyfill you need is atrociously slow.

> polyfill you need is atrociously slow

The polyfills haven't been slow since Polymer 0.8/1.0 when we switched away from the "full" Shadow DOM polyfill and to the much lighter-weight ShadyDOM shim (which trades a little spec compliance that Polymer hides, for speed).

Polymer demos, like for HNPWA, are consistently among the fastest, even beating the speed-focused React clones.

(comment deleted)
I keep reiterating this point, but people keep calling React complex, it's not. React is raw simplicity. As far as I'm aware it's the most minimal API for creating sufficiently complex UIs. It's so minimal that it's hard to build full apps in because it says "not my problem" to questions such as routing, global state management, you name it. And that's fair. I still maintain that it's a tool for pros. But the responsibility that it does take on, I believe it does so in the most simple way possible. And you don't need to be aware of React internals to use it effectively. The details of the component lifecycle are not internals, but part of the public API.
It's easy to say React is simple if you are looking at, say, a barebones create-react-app. But most production React apps I have worked on (I work at an consultancy) seem to accrete complexity faster than functionality.

I used to chalk this up to me not "getting it". Now I think it has more to do with the desire to incorporate newness into React apps. Stuff like ripping out routers to replace with another router but then the old router was rewritten so lets replace it with that one again. That kind of stuff happens, and even it is preferable to someone deciding to incorporate something like [shudder] styled-components half way through a project. This kind of stuff almost always incorporates new abstractions that will increase surface complexity. In the interest of avoiding a rant, I won't start with people monkeying with context or not understanding the effects of setState.

React should be judged by the quality of it's ecosystem and extant production code, and I would argue that if you survey these things often you will find plenty of unnecessary complexity.

I have to agree w/ lopatin overall: React is a tool for professionals. And I think it addresses your arguments very well. Being open source and powerful, its reached for by people left and right who do not (yet) understand how to architect well constructed applications. And the results are predictable: Needless complexity, bloated apps, bad ui. Personally, I don't read any more into it than that.
If you're rebuilding aspects of your production system for the sake of "incorporating newness" then the problem is poor engineering not react or any other tool. If things are working fine as they are, you only have yourself to blame when you introduce new technology that you find too complex to manage.
Its the overall ecosystem that makes it complex. You can use it as is but everyone is using webpack and babel, so you have to use it too. But once you are into those tools (and all the others that they come with) then it becomes too complex.
> You can use it as is but everyone is using webpack and babel, so you have to use it too.

No you don't. You can absolutely use your own build system, or no build system, and still make use of open source components and libraries from the React ecosystem.

So which is it: "not complex" or "hard to build full apps"?
It's like LEGO's. The blocks are sturdy and the rules of how blocks fit together are simple. But building a mini Taj Mahal is still not easy. You do have to know basic physics & structural engineering, but if you do, the task is very do-able. Even fun.

Unlike if you were building a mini Taj Mahal out of match sticks, Elmer's glue, rope, and playing cards. Even a professional structural engineer would have a hard time with that. The rules of gluing a match stick and a playing card together are already complex (not to mention uncertainty about where to rope fits in), and it that makes it that much harder to make a final product.

This video goes into "simple" vs. "easy" https://www.infoq.com/presentations/Simple-Made-Easy

Consider facts: React is over 40k lines of code, there are 30+ classes/methods to be aware of though maybe 10 of them are commonly used. Would you call it "minimal"? There is still a lot more that could be done with a smaller API surface and much less code.

Compared to Angular, it might as well be a micro-framework, but by objective measures it's not so simple.

> I was completely baffled by the myriad of options out there, how complex they look (note I've been working on very high performance, distributed backend applications, so complexity on itself is not an issue), and how it's very unclear when to use any one of them or what each one is good for. I tried Angular and React, and both feel like almost a different language. You have to learn their internals to work effectively with them, and it often looks like they create more complexity then the original complexity they were trying to reduce. I have no problem learning new things, in fact, I love it! It just feels like there are other things to learn that will stick around for longer - JS frameworks/libraries seem to be very hype-driven these days. What are your thoughts on this?

I hear this sentiment a lot, but it always irks me. There seems to a general feeling amongst programmers new to front-end development that the current popular libraries have been over engineered and that the constant changes are driven by more by hype than actual need.

From my view, the complexity in these libraries is mostly a reflection of the complexity of the underlying platform. Browsers and their JS engines are now monstrously complex and implement a horrifying number of web standards. When compared with browsers, something like the C++ compiler or the JVM suddenly looks childishly simple (and I'm not saying those things are simple). For example, it may not be apparent at first why something like React is a good idea, because it takes some knowledge of the performance characteristics of browser rendering to understand that.

As for the churn, the libraries have been changing because the world has been changing. Back in the day, HTML was rendered server side and people used jQuery with little snippets of JS to modify small sections of the DOM. It only made sense to do that. But JS engines started to get really fast. Browsers finally started to use the DOM standards. People started working on solutions for all of JS's many warts, like not having any sort of module system and there being no good solution for package management. All these things came together in just a handful of years and suddenly it was possible to do actually cool stuff in browsers. Writing a browser based photoshop or itunes was no longer just the domain of tech giants like Google. When the world is literally turned upside down, that does shake things around a bit.

So, if you are coming to web development from the backend, I don't think there is an easy path. The platform is complex. And just the idea of writing single page applications is only about 7 years old. That the first handful of years were somewhat chaotic is not surprising.

But that aside, I would recommend to start with React and Redux.

If you are looking for a matured and easy to use solution, which follows convention over configuration pattern, so it helps to be the job done, I would highly recommend Ember.js Especially useful for us who come from backend world, so many concept will be familiar. You can learn the whole framework in a few days from www.yoember.com or from www.emberjs.com

Especially the toolset and addon ecosystem will suprise you, so easy and fast. You will love it.

i feel like i would've had similar feelings had i not learned (and pretty much fell in love with) clojure some years ago. now whether it's backend or frontend or even seamless code sharing between both - i am totally covered. react wrappers in clojure get unreal synergies with language design choices (immutable by default, convenient nested data structure manipulation, etc), things like this one - http://maksm.net/crypto-calculator/ is 100 lines of code including html templates.

obviously this all means having to learn another language but i dont need to touch js ever again and i'll take that trade any day.

Web components do not have a great story about passing complex data. If you want to pass typed data (not just strings) then declarative HTML suffers since HTML parses all attribute values as strings. You can use JavaScript properties to provide typed data to Web component custom elements, but properties cannot be provided declaratively in HTML and now you have two ways of providing data. With that said, I think there is value in building UI components in Marko and offering web component custom elements as one option for embedding your Marko-based UI component into a page (using a small UI bridge layer... something that we plan on open sourcing). --Marko author
Take a look at IntercoolerJS. It's just a simple library, not a framework. I found it as the easiest way to deal with modern frontend programming.

http://intercoolerjs.org/

Ecosystem is so important these days, there might be technical reasons for choosing this but considering the support (knowing stack overflow answers will be available) and pre-existing component ecosystems for Vue & React, I can't see a reason anyone would pick this.
Same reason someone picked up vue in first place?
I've discovered Marko in one of the various react-alternative topic that emerged yesterday and it looks like something sane, which is rare in the js ecosystem. I'm wondering if anyone on hn used in in a real world project and how it was.
Yes we've started using it a couple of months ago. What attracted us is how easy it is to build an isomorphic app with Marko.

I would not recommend it to anyone though. There is a world of difference between what they advertise on their website and the reality of using it as your framework.

Some key take-away for us so far:

Pros: - the idea and principles behind marko are brilliant. - it does render relatively fast

Cons: - it is bug ridden with inexplicable error messages. Not beta version bug ridden, not alpha version bug ridden but pre-alpha version bug ridden... - top level elements can't have a state, which made templates impossible to use (still need to make sure that's completely true, we haven't tried everything we could). - when doing back-end rendering, the browser still waits for the JS bundle before rendering. Almost completely defeating the purpose of an isomorphic app... - Marko does not come with a state manager. We had to build our own. - We haven't started using their router yet but having a quick look at it it seems to have an utterly bad API. They could have gone all the way and embed the path definition into the marko files but no, we get some awful JSON to work with...

My guess is that some very talented engineers at eBay rightly decided that the current state of UI frameworks is terrible and started remedying it. Then, deadline and other commitments made it hard for them to support the framework enough for it to be usable by third parties. It is still a great achievement and I find marko interesting but cannot possibly recommend it against React (haven't used enough of Vue.js to have a valuable opinion on it).

Hi nherment,

I appreciate your feeedback. To follow up on some of your concerns:

Top-level UI components can have state now:

    class {
      onCreate () {
        this.state = {
          count: 0
        }
      }
      increment () {
        this.state.count++;
      }
    }

    <html>
      <body>
        <div onClick('increment')>Count: ${state.count}</div>
      </body>
    </html>
If Marko's built-in component state management is not sufficient, you can of course use Redux with Marko. Here's a sample app: https://github.com/marko-js-samples/marko-redux.

Marko does not have an "officially" supported router yet, but this is the one we've been pointing people to: https://github.com/charlieduong94/marko-path-router. If I understand your statement correctly, you mean that you would prefer to export the path directly from the component? I agree that this should be supported. Currently, Marko does not support exports, but it's actually on our issues board https://github.com/marko-js/marko/issues/538. We'd like to support the following:

    export var route = '/about';

    class {
      ...
    }

    <div>About!</div>
This actually would be fairly easy to implement, but we've been focusing on other things. I think that we should reprioritize this issue though.

It's definitely true that we have a lot of features that we'd love to focus on and a very small team of engineers working on Marko/Lasso. I welcome you and anyone else to jump in and help if you'd like! Any contributions are extremely appreciated. Additionally, feel free to drop into the Marko Gitter chat with any concerns and we'll try to help https://gitter.im/marko-js/marko.

I am very happy to hear that top level components now support state :) It's a major pain that is now relieved.

For state management, we have built https://github.com/Portchain/markojs-shared-state. The main problem with this solution is that it's a singleton. Being able to have state at the top level will help in allowing us to pass the state manager to children.

Router wise, maybe it should not be a component's responsibility to know their route but rather the parent's ?

Marko already comes with an elegant way of doing conditional forks in the HTML. This is a huge strength of Marko. What is displayed is defined in the template (.marko files). We currently have input and state defining what needs to be displayed. Adding to these two a `route` object and simple state management is made easy.

This is something we'd be very happy to do as we could use it immediately. However it's not urgent because we route server-side*

eg.

  <html>
    <body>
      <if(route.path === '/about' || route.path === '/about/*' /* matches 'http://www.example.com/about and all subpaths' */)>
        <about-content />
      </if>
      <else>
        <home-content />
      </else>
    </body>
  </html>

With each component getting a nested value of the path but also being able to access the whole URL. For example, in about-content.marko:

  <div>
    <!-- get the 'nested' path only -->
    <if(route.path === '/company' /* matches 'http://www.example.com/about/company' */)>
      <div class="company">Lorem ipsum...</div>
    </if>
    <!-- or access the full path -->
    <if(route.fullPath === '/about/career')>
      <div>Get hired !</div>
    </if>
  
    <!-- being fancy now ! -->
    <if(route.path === '/:mySubsection')>
      <div>Get hired ${route.params.mySubsection}!</div>
    </if>
  </div>
```

However, there is probably no need to re-invent the wheel. While I like the idea of embedding routes in the templates, Vue.js approach seem quite sane too: https://vuejs.org/v2/guide/routing.html

Something I love about Vue is having official router and state management modules.

You should seriously consider making and maintaining those.

I have just been using the state for a top level component.

While it is true that this is now working, updating the state in the component that contains the <lasso-head/> and <lasso-body/> tags will cause the dependencies (defined in browser.json) to be lost. Unfortunately, the stylesheets are included in the dependencies... This means that playing with state at the top level removes any styling on the page.

This is EXACTLY the type of insanity that makes me recommend AGAINST using marko...

Example code here: https://github.com/nherment/marko-css-error

(comment deleted)
> it looks like something sane, which is rare in the js ecosystem

Could you elaborate?

There are plenty of comments in this thread (and others related to React) and js devs haven't coined the expression "javascript fatigue" by accident. The craziest thing being the VC funded package manager...

I hope something will emerge from this quagmire.

Ebay sounds like a real world project to me.
Is eBay.com built with Marko?
Not sure how much it's used on ebay.com but from this presentation it seems to imply that it's used extensively on the site and other projects at the company.

https://www.youtube.com/watch?v=i6eZA8Y_GgA

(their front end stack is presented at about 4:00)

BTW it's a great introduction to Marko compared to React and Vue.

Yes, there are other companies using Marko. Just to name a few, eBay, Lowes, Blizzard, Yahoo, Genesys, and gov.uk are using Marko for at least one project. Marko was created at eBay and eBay.com is built using Marko. There are some other European companies that are also heavily invested in Marko for their main UIs.
Meanwhile in real reactive environments:

    import QtQuick 2.7
    import QtQuick.Controls 1.1
    
    Rectangle {
      property real count: 0
      
      Column {
        Text {
          text: count
          color: "#09c"
          font.pointSize: 24
        }
        Button {
          text: "Click me!"
          onClicked: count++
        }
      }
    }

Also the so-called "60fps smooth" animation has noticeable stutters on Firefox on linux.
How is that related to the topic? (apart from the last sentence)
isn't the topic reactive JS-based UI frameworks ? Marko compare itselfs to Vue; it should be compared to other UI frameworks in the same problem domain too.
Saying 'this is what a "real" (whatever that is supposed to mean) reactive framework looks like' without saying anything else, is not really a constructive comment, and to me looks more like bashing or an attempt to start a flamewar.

Apart from that Qt is a non-web framework, rarely used in combination with Javascript last time I checked, so even inside the problem domain it is barely related.

> Apart from that Qt is a non-web framework, rarely used in combination with Javascript last time I checked, so even inside the problem domain it is barely related.

http://qmlweb.github.io/

QML (the language in my snippet) is based on javascript; "rarely used in combination with Javascript last time I checked" has been false since roughly 2008 (wrong, actually 2010) when it was introduced.

It works entirely fine on Firefox on macOS and Windows though. It seems more likely that has something to do with how Firefox interacts with the graphics stack on Linux than Marko.

Have you tried it in a different browser, like Chrome or Midori?

Works fine for me on Firefox on Linux. Not a weak laptop though.
Me neither. Intel 6900k and GTX 1080. Works fine in Chrome though.
how does it know that onClicked: count++ should be evaluated on a click and not save count into onClicked and increment it afterward?
`onClicked` isn't a field. The Button object has, somewhere in its definition:

  signal clicked()
  ...
  /* on some raw mouse event handler */
  {
    clicked(); 
  }
Then, when `clicked()` is called, if you have put somewhere in your code `onClicked: { some JS expression }`, the expression you put there will be called.

Unlike JS objects, fields cannot be reassigned. Instead properties and signals are declared beforehand.

  property real count
  signal foo(arg1, arg2)
  ...
Firefox on Fedora 26 here, silky smooth for me.
The animation was smooth for me (Firefox on KDE on X11 on Arch Linux; 5-year-old notebook with Intel graphics).
Oh hi there, yet another awkward not-really-html-not-really-js templating language

    class {
        onCreate() {
            this.state = {
                count:0
            };
        }
        increment() {
            this.state.count++;
        }
    }
     
    <div>The current count is ${state.count}</div>
    <button on-click('increment')>Click me!</button>
Given how little boilerplate there is for the actual code, I'll take the templating language.
(comment deleted)
Nowadays I only consider switching front-end frameworks if there is a substantial conceptual improvement. React did this for me due to its uni-directional dataflow and component-based architecture. There is nothing new here conceptually.
I feel the same way. It's a huge investment picking up an entirely new tech stack, and I'm not throwing that investment away every bloody year.
I find that this is the most sane tactic as well. If you just limit yourself to frameworks with conceptual improvements (that _also_ show at least signs of substantial adoption, and preferably already are widely adopted), then the churn really is not that high. It used to be jQuery, then Angular around 2012, and now React. That's perfectly doable in terms of keeping up, at least as long as you're an actual front-end developer rather than someone who also has to do the front-end. (And perhaps it's less so when you're older and I'm one of those darned millenials now, but I wouldn't know.)
I feel like React has hit that tipping point that Rails did several years ago: it's no longer cool but it's still incredibly productive, and literally every new hip library that is currently flavor of the month is modeled after it in some way.
In another comment I mention that the biggest conceptual improvement that Marko offers is async and streaming rendering. Async changes how you think about passing data to your view (you start rendering immediately and you can retrieve backend data asynchronously to start rendering parts of the page asynchronously). Also, Marko is not tightly coupled to a VDOM (while React is) and because Marko is not tightly coupled to VDOM rendering we can achieve significantly better performance (sometimes over an oder magnitude faster than React on the server) and this absolutely can make a difference. The slowness of React (and the sync rendering) were huge blockers from the very beginning when we considered using React at eBay. --Marko author
Don’t abuse the term “isomorphics”. To prove 2 groups are isomorphic mathematically you have to show there exists a product preserving map between the groups.

Just kidding.

So many new UI frameworks, yet no one really mentioned SmartClient.com (LGPL licensed).

I've been using it for almost 10 years and some of the concepts they pioneered have only recently been discovered by the new kids.

I still use it, though some of the 'fixes' they had to put in place to support old browsers are often polluting the DOM unnecessarily in modern browsers (this is something I hope they fixed).

My favourite aspects of it are that I can declare components declaratively, it has a technique called autoChildren that allows managing a tree of components as a flat set (useful for complex components like tabsets), and the data binding layer. The documentation is top notch (which it needs to be given the depth of stuff in there).

Again, all of this was around in 2009 since when I started using it - and not sure how many years before I found it they'd been going.

Here's a great introduction to Marko by its main dev:

https://www.youtube.com/watch?v=i6eZA8Y_GgA

You can see on the 21-24 minutes the bad idea of implicit imports which is being presented as a great idea:

- Explicit import is a much better idea than the Marko's folder structure based implicit import thing. Explicit import makes the code base more maintainable, reduces the side effects probability and "magic" stuff.

- "Counter" there is not a "word" as author says, but the component's file name. So it's not the word that you can misspell, but the file/module, that will not be imported in case of file name misspelling. Import by file name is not repeating, it's the explicit module importing by the file name, not by a some word - no DRY ideas violation here.

- Author says on 21:51 that "imports is kind of terrible" due to the relative path. There is no issue with the relative path - use Webpack's aliases. He says imports (explicit relative imports in that case) makes code more fragile...

- I like Vue's idea of separation computed/methods/data blocks more than mixing all together. It for example helps the green devs to better understand the framework's lifecycle/internals and separation of concern ideas.

I stopped watching the video after the 24 minute.

> use Webpack's aliases

You are contradicting yourself there. There is really no difference in clarity between an automatic path resolver and using aliases.

> I like Vue's idea of separation computed/methods/data blocks more than mixing all together

It's really a matter of taste.

> You are contradicting yourself there. There is really no difference in clarity between an automatic path resolver and using aliases.

No difference? In case of explicit importing you get the "import" thing in the sources code and it's a huge difference in comparison of not having it there.

> It's really a matter of taste.

Not really, but a matter of separation of concern and good design. Besides Vue is a reactive thing, and such structure I guess makes it easy to apply reactivity observers where they are needed in a more explicit way.

> No difference?

If you are using aliases you are not using explicit imports.

    import something from 'something';
Where does 'something' come from? No idea unless you peek at the webpack configuration file.

You don't even know if the module is actually called 'something'.

> Not really, but a matter of separation of concern and good design.

Then I'm guessing you consider all OOP languages badly designed since none of them have properties for 'methods', 'getters' (computed), etc. Yes?

> If you are using aliases you are not using explicit imports.

You are as you have the "import" code line in the code sources. If you get rid of that code line, you make it happen implicitly and this is the case of undesirable "magic" happening.

> No idea unless you peek at the webpack configuration file.

Some IDEs do support automatic Webpack's aliases resolving, so you can navigate to the module by ctrl+click.

> Then I'm guessing you consider all OOP languages badly designed since none of them have properties for 'methods', 'getters' (computed), etc. Yes?

Don't be silly, we are talking about JS that has a room for adding some structure as it's being too flexible by default.

Anyway thanks for the Youtube link, it helped me to realize that I'm not going to use this Marko thing.

There's really no magic with implicit imports. The imports are resolved at compile-time and fully resolved imports are used in the compiled code. I see developers making mistakes with explicit imports all the time (using the wrong path or forgetting to change the variable name or moving a component to a new directory and forgetting to update all relative paths).

Webpack aliases are a Webpack-only feature that I would consider a bad practice since it relies on globally configured aliases. Implicit imports in Marko are resolved relative to the template file (not global). Marko can be used server-side under Node.js with no need for a JavaScript bundler.

> I like Vue's idea of separation computed/methods/data blocks more than mixing all together. It for example helps the green devs to better understand the framework's lifecycle/internals and separation of concern ideas.

I see separation of computed/methods/data as unnecessary boilerplate. Methods are just functions on the component definition. On a related note, In Marko there's no need for "computed" properties and there is no need for a "data" block.

Yay, another front end framework! /s
This looks pretty decent.
I don't believe the marketing when it says that working with something is "fun". Working is maybe enjoyable sometimes, but it will stay hard work if you're doing it right.
Building web apps is definitely hard work, but it can be fun if you are instantly rewarded with working components/pages that didn't require a ton of code :)
Quick question, is there anything conceptually interesting about Marko thats different in ideology and structure from Angular and React or Vue?

For background to why I'm asking: I'm an IOS mobile dev and was a web dev before and I often use web dev structures and ideas as there is less structure, frameworks (unless you count RxSwift) and general philosophies I find in IOS mobile dev aside from best practices and tips like avoid Massive View controllers, etc.

Async and streaming rendering is probably the biggest conceptual difference since it changes how you think about providing data to your view (in a good way). The paradigms of how you build UI components is very similar across all of the major UI libraries, but Marko aims to reduce boilerplate and offers what I think to be a superior syntax. --Marko author
I just skimmed the page and seen that sort coloured of sine wave... Then read «The above animation is 128 <div> tags. No SVG, no CSS transitions/animations. It's all powered by Marko which does a full re-render every frame.».

Well, as soon as my browser renders that thing, the browser process reaches 122% cpu usage (according to htop). And i'm using a 4th gen core i7 processor. I can literally (literally in the literal sense of the word) hear my fan spin up. That hurts battery so much.

Ouch. I had a look and according to the Chrome task manager that page is sitting at 12-18% cpu usage while looking at the animation.

For reference, a 5000Kb (720p) twitch stream I had open was sitting at 3-4%.

Isomorphic UI? WTF??

What's next, homotopic web frameworks and commutative app diagrams???