News for hackers. Stuff that matters.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by narrator on Friday January 08, 2021 @02:38AM (#25682506)
Just wait. You are going to start adding modules and eventually you're going to have a whole ecosystem. Someone is going to complain about the bloat and then build the new simpler JS framework that's basically your version 1.0. I've seen this movie several times over the last 10 years.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by lucideer on Friday January 08, 2021 @08:05AM (#25684255)
I don't understand how this is the top comment. It's so generic and lacks any investigation or insight; I could copypaste this as a reply to any software project post on HN and it could vaguely apply in the same way (but not specifically apply).

Case in point with JS libs and the following line: "You are going to start adding modules and eventually you're going to have a whole ecosystem". This happens with individual JS-built products using libs, but definitely does not happen universally with most JS libraries. Take React, the first comparator referenced in the post title: its ecosystem is entirely 3rd-party addons and the core is focused and single-purpose to this day. They've added a lot of internal complexity to their vdom implementation which adds code bloat, but it isn't what this commenter is describing.

Vague comments like this never apply to all cases (often apply to no cases). It's a lazy comment that contributes nothing without being specific to this new library. You need to read the code and develop some genuine insight to have this type of commentary.

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by chiefalchemist on Friday January 08, 2021 @08:36AM (#25684563)
> I don't understand how this is the top comment. It's so generic and lacking of any investigation or insight; I could copypaste this as a reply to any software project post on HN and it could vaguely apply in the same way (but not specifically apply).

Yes. And that is _exactly_ the point. These anti-bloat libraries either die or become the enemy they set out to defeat. We've been to this rodeo before, yes?

Nothing wrong with that per se. But we gain nothing by pretending this cycle doesn't exist.

Perhaps a smarter approach would be: I've replicated 80% of X's features with 20% of the weight. Here's what's missing.

Then if Library X puts on weight, so can you, if you want. But feather weight in and of itself is not a benefit per se (especially when it's likely temporary). It's a feature. And too often we all gets sucked into the feature trap because we forget it's ultimately about benefits.

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by lucideer on Friday January 08, 2021 @12:40PM (#25687321)
> These anti-bloat libraries

This probably isn't true, but more importantly this statement misses the point because you're bundling a bunch of stuff into the "anti-bloat libs" bucket with no consideration for the individual architectures of each.

To come back to the example above—React—the core react library is 3.2kb[0] gzipped. (and it hasn't died out). What I'm selectively omitting here is the architectural detail that React have separated their API implementation (core), their renderers (DOM, Server, Native) and their templating (JSX), all of which are loosely coupled optional components. That's a very effective approach to omitting bloat, and is a model that can be copied in an approximately compatible way (see e.g. the anti-bloat Preact and Inferno, further examples of anti-bloat approaches that have not "died out")

[0] https://unpkg.com/[email protected]/cjs/react.production.min.js

[1] https://preactjs.com/

[2] https://infernojs.org/

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by lhorie on Friday January 08, 2021 @10:00AM (#25685324)
> die

This idea puzzles me. It's not like the code suddenly breaks or the world changes so much as to render it completely obsolete.

It's borderline madness to keep chasing new and shiny things and then complain that things keep changing.

Stability is a feature, not a bug.

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by Pick-A-Hill2019 on Saturday January 09, 2021 @11:05AM (#25701460)
Call it Grey-Beard Cynicism if you will.

To be Clear; The submitted ShowHN is a welcome effort and espouses (imo) fantastic ideals and objectives. I'm glad that people like the developer take/make the time to contribute to the greater good of the open source community.

It is also great/fantastic/good/{some other positive superlative} that people like the submitter keep on fighting the good fight when it comes to program bloat.

While I'm not trying to read another persons thoughts here - Perhaps their comment was indeed meant as a 'oh another thing that's gonna end up bloated due to feature request creep' (which was my initial jaded reaction too although I just didn't think it was an opinion worthwhile posting as a comment that contributed something worthwhile to the conversation so didn't do so).

Call it a measure of the current global mood within the HN that the comment became the top voted comment.

As to what my point was? Uhmmm I forget.

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by defx on Saturday January 09, 2021 @12:10PM (#25702127)
Thanks for the kind words. I completely understand the cynicism, especially when it comes to the front end / javascript scene. I'm not entirely sure if the title I chose has helped or hindered more, but it has fuelled some discussion at least and I've got some good feedback and even a first contribution, so it's definitely been worthwhile.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by slumdev on Friday January 08, 2021 @09:07AM (#25684840)
History rhymes. Noting a pattern is insightful.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by lucideer on Friday January 08, 2021 @01:04PM (#25687624)
Only if there is one. Which it takes at least a modicum of time spent on analysis to ascertain.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by devwastaken on Friday January 08, 2021 @04:24AM (#25683032)
It's a fun thing to do that lets you learn the core issues frameworks try to solve. People then post their work because we have to legitimately market ourselves and our work somehow.

There's lots of avenues that can be taken with things similar to react - and trying and experimenting can create some better methods. It's not as if react or vue were built in isolation from all the previous software.

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by LandR on Friday January 08, 2021 @05:54AM (#25683436)
> because we have to legitimately market ourselves and our work somehow.

Do we ?

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by lhorie on Friday January 08, 2021 @10:06AM (#25685370)
You don't. But I did and now get paid 3 times more than I did before. There aren't enough high paying bay area jobs to go around for all developers in the world, so as they say, early bird gets the worm.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by cy_hauser on Friday January 08, 2021 @09:31AM (#25685045)
If we went to be "better than average" then yes. You must do something to stick out in order to get better jobs, more money, more fame, more power, etc.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by ForHackernews on Friday January 08, 2021 @05:27AM (#25683303)
> People then post their work because we have to legitimately market ourselves and our work somehow.

Wouldn't it be better if we experimented with radical new ideas for development instead of reinventing the same JavaScript wheel for 300th time?

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by Xevi on Friday January 08, 2021 @05:37AM (#25683360)
We are though. One of the current shift that is happening is that frameworks are moving away from using Webpack and so on during development. Vue now has Vite, Svelte is moving to Snowpack, etc. This can speed up development iteration time by orders of magnitudes.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by worldsayshi on Friday January 08, 2021 @06:55AM (#25683726)
I agree that that would be swell but sometimes you have to practice the same movements as those that came before to learn something new?
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by nailer on Friday January 08, 2021 @05:37AM (#25683359)
Svelte did this by throwing away virtual DOMs and using a compiler to directly bind elements to data.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by defx on Friday January 08, 2021 @08:12AM (#25684320)
I've seen that too, but there are also tons of projects that stay true to their original intentions and it wouldn't make sense (to me at least) to morph synergy into a "one size fits all" framework. It has a clear set of responsibilities and my ultimate hope for this library is that it will be eventually become redundant as all of the features it provides become a part of the web platform itself.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by lhorie on Friday January 08, 2021 @09:42AM (#25685162)
Counterpoint: mithril.js has been feature complete for years, and the culture around it is to resist change for the sake of change (e.g. it didn't jump into the react hooks bandwagon like vue did, even though it's arguably more similar to react than vue is)

Ecosystem-wise, it encourages integrating with high quality vanilla libraries directly instead of having a react-this or vue-that for everything under the sun.

This approach has worked well, IMHO.

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by oofoe on Friday January 08, 2021 @11:01AM (#25685975)
Three cheers for mithril.js! I've used it for a number of things, including a complete rewrite of a heavy old app that used Ext.js. It was very simple to set up dynamic page assembly for very fast and flexible UIs.

I've tried mentioning it to friends in web dev, but they don't seem to be willing -- if they even look at it, they never try it out. At this point, I just shrug and go back to my simple, reliable and fast pages which load in KB instead of MB...

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by prox on Friday January 08, 2021 @06:28AM (#25683597)
Is it weird if I still use vanilla JS most of the time? And some jQuery where absolutely needed?
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by jailbird_bd on Friday January 08, 2021 @06:49AM (#25683695)
If you're not trying to build an SPA with them, not weird at all. For basic crossbrowser compatible interactive elements, vanilla JS and/or jQuery are/is more than enough. As long as it's easy to maintain, just use what you are familiar with and gets the job done.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by FpUser on Friday January 08, 2021 @08:55AM (#25684724)
We've built SPAs as a part of the larger project using exactly this. Plain JS with a couple of libs that address specific needs (graphics for example). All work fine, simple to maintain and does not require that insane amount of infrastructure.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by kikimora on Friday January 08, 2021 @09:18AM (#25684927)
Can you share some insight about your project? React and redux didn’t happened for no reason. However I think they are too heavy and there are ways to solve same problems with basic tools. Your case may shed some light on to how this can be achieved without react/redox overhead.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by FpUser on Friday January 08, 2021 @11:01AM (#25685983)
>"Can you share some insight about your project?"

Not sure what particular insights. Well here is some example: state management. It is basically split into 2 parts. One part is the actual business object that matters and is a slice of full data on backend. It is a class with methods that take parameters and modify state when executed and broadcasting fact of said modifications so that the UI is aware. Executions of said methods also causing data exchange with the backend using JSON based RPC. Simple example would be Customer with get/set Name/Alias/DOB etc.

Then there are web components and those keep their own state that is limited strictly to presentation issue. For example Currently active form of the application.

It is a big area in general with lots of details and requires way more than a simple post to describe. Unfortunately we do not contribute to open source so can't really share any code.

So structurally the app is fairly simple. Some JavaScript files that are being merged when posting to production and backend server written in C++ accessible through JSON based RPC that can serve thousands of requests per second on single computer with few real cores without breaking much sweat.

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by pstadler on Friday January 08, 2021 @06:41AM (#25683655)
This IS weird, because of the jQuery part.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by jailbird_bd on Friday January 08, 2021 @06:55AM (#25683724)
Could you please describe why? jQuery is basically just a bunch of helper functions which makes your JS code a bit more readable and takes away the worry about browser (in)compatibility. Is that bad?
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by rendall on Friday January 08, 2021 @07:24AM (#25683935)
No. It's not bad. As with everything in tech, there are:

1) tradeoffs, preferences, exigencies of use-case

2) devs who conflate their specific use-cases with universal truths

3) fickle winds of fashion affects tech as much as any human endeavor. Right now jQuery is out and React is in

As for jQuery specifically, there has been at least 2 trends militating against it: a wider industry move away from patterns of direct DOM manipulation into virtual DOMs (i.e. using frontend frameworks); and a more widespread acceptance of functional programming techniques while jQuery is inherently "impure"

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by FpUser on Friday January 08, 2021 @08:59AM (#25684761)
>"As for jQuery specifically, there has been at least 2 trends militating against it"

Using virtual DOM does not give much benefit if at all on modern browsers.

Functional programming is just one of many existing paradigms and not a silver bullet. One does not need to plug every hole with it.

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by rendall on Friday January 08, 2021 @09:31AM (#25685047)
Of course!

I would note in passing that a description of industry trends is not an endorsement of them. There are lots of reasons for trends beyond pure rational technical strategy.

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by FpUser on Friday January 08, 2021 @11:50AM (#25686613)
So far I was fortunate that in most cases I am free to choose the tech stack for the products I make. I pay very little attention to "industry trends" (basically what FAANG tells us to do) and choose what works best for my business ROI wise.

As for developer pool - when I need to hire subcontractor I've never had problems finding one with enough qualifications in whatever area I would need. Btw all subcontractors I've ever had are remote since year 2000

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by jerrygoyal on Friday January 08, 2021 @07:51AM (#25684132)
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by nicwolff on Friday January 08, 2021 @04:19PM (#25690660)
Wow, just looking through that tells me jQuery still adds a lot of value.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by prox on Friday January 08, 2021 @09:54AM (#25685277)
That’s a pretty cool site, thank you, I like how it’s very to the point with comparisons.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by zappo2938 on Friday January 08, 2021 @05:11AM (#25683231)
I'm going to stick with React until web assembly frameworks are common in 5 - 10 years.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by mekkkkkk on Friday January 08, 2021 @01:04PM (#25687622)
As long as it's flagged "Show HN", it's all good. You shouldn't be taking it more seriously than it is. I bet you don't have the same response when someone posts some other pet project of bouncing balls in WebGL and WASM Rust or something.

I've been working as a frontend developer most of my life, so I see what you're saying. Still, it's a just a fun thing to do. I've made some hobby libraries myself with no intention of it "catching on". And even if it's reinventing the wheel, perhaps one of the spokes is improved .

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by bryanrasmussen on Friday January 08, 2021 @04:41AM (#25683109)
A lot of bloat however, is caused by uptake of the frameworks and having to also support older versions etc.

As long nobody but you uses it you can add/rewrite as needed while keeping bloat to a minimum.

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by Cthulhu_ on Friday January 08, 2021 @05:48AM (#25683410)
Plus things like performance optimizations; people have been building lightweight alternatives to React for years now, the core concept is not that difficult. Making it performant is the one though.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by Existenceblinks on Friday January 08, 2021 @12:26PM (#25687110)
I do not see this happens with https://github.com/WebReflection/uhtml/blob/master/DOCUMENTA... family. They are around for quite awhile, and their philosophy is clear from start, do one thing well, small and no tooling.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by mhaberl on Friday January 08, 2021 @07:59AM (#25684200)
> I've seen this movie several times over the last 10 years.

When you take into consideration other languages and their ecosystems this was happening from the start. It is just evolution. If this lib gets enough traction and goes into the right direction, whatever that may be, it will become popular. Ofcourse chances are small, but..

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by jbergstroem on Friday January 08, 2021 @04:48AM (#25683133)
Most of us watches movies all the time, but without the movie makers there’s nothing for the rest of us to review.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by raj_khare on Friday January 08, 2021 @11:12AM (#25686105)
Second law of thermodynamics, sigh
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by otar on Friday January 08, 2021 @07:28AM (#25683967)
This!