News for hackers. Stuff that matters.
Re:Do you really want a single-page application framework? by jasonkester on Tuesday November 15, 2016 @02:52AM (#12956348)
I find that when you start rolling your own framework, you just end up making crappier versions of what's in Angular, Ember, etc.

And that's a good thing.

The distinction is that you're making a crappy general purpose framework, but you're making a really good problem specific framework that exactly fits the thing you're building.

The reason those frameworks you list are so "bloated" is that their developers have spent so much time polishing them up and general-purpose-izing them so that Everybody can use them for Everything.

Your thing is only for You to do Your Thing, so it can be much lighter and to the point.

Re:Do you really want a single-page application framework? by mklim on Tuesday November 15, 2016 @03:07AM (#12956400)
>The distinction is that you're making a crappy general purpose framework, but you're making a really good problem specific framework that exactly fits the thing you're building.

Strongly disagree.

Your hand-rolled framework is undocumented besides whatever comments you've put in your code, full of bugs besides whatever you've personally stumbled into, and lacks anything except the features you've needed thus far. It's a means-to-an-end to get the actual features you need done done, instead of built for its own sake and tested and polished for its own sake.

The second your application grows in an unexpected way, you need to augment the entire framework to suit. If there's a bug, you can't search stackoverflow or the github page and just read the answer that 500 other people have found before you, and neither can anyone who has to take over the code after you and try to maintain it--you are the sole author, your internal comments and notes and email chains are all the documentation for the framework that exists in the entire world, there's no hope for the maintainers besides slogging through the source and discovering the solution from scratch. There is no cheerful dev community contributing PRs for the buggy edge cases that break your code on obscure browsers. There's no helpful blog posts out there on how to tweak it for performance optimization. It's all just you trying to maintain what really should be its own full time project while you're trying to build a real product on top of it at the same time.

IME, hand-rolling your own framework as you're building a product gets you the bare minimum (read: extremely poor) mess of code that could possibly address your core use case, not something good for your specific problem. Using multiple libraries instead of monolithic frameworks I think is generally a good idea, depending on context--but completely hand-rolling your own framework from scratch while you're actively developing a product, no, I've never once seen this work well.

Re:Do you really want a single-page application framework? by treehau5 on Tuesday November 15, 2016 @07:41AM (#12957506)
> The second your application grows in an unexpected way, you need to augment the entire framework to suit

The second you need to do something your framework doesn't, the same rule applies. Frameworks are really good for covering most things, but almost everyone runs into that last 5-10% or so that it doesn't do. That ends up being the most difficult, in my experience.

Re:Do you really want a single-page application framework? by jakub_g on Tuesday November 15, 2016 @08:47AM (#12957902)
To be a devil's advocate: That's true, but still it's the last 10% that is hard when using a well-known framework, compared to 100% when you handcraft everything in a basement.

If you use a well-known fwk, you can tell junior devs and new devs to google stuff when in need (as a first line of help), otherwise, you need to write a ton of documentation and/or devote hours per week on support, at the times when you have the least will to do that.

There's no one-fits-all solution, depends on the project, team, constraints etc.

Re:Do you really want a single-page application framework? by treehau5 on Tuesday November 15, 2016 @08:54AM (#12957944)
> To be a devil's advocate: That's true, but still it's the last 10% that is hard when using a well-known framework, compared to 100% when you handcraft everything in a basement.

I am saying they are about the same. The last 10% is about as much work as bootstrapping a specific solution.

The new junior dev point is irrelevant if you stick to plain vanilla javascript, and hire junior devs that actually know javascript. Your devs should know how to read code and tests.

> otherwise, you need to write a ton of documentation and/or devote hours per week on support, at the times when you have the least will to do that.

No I don't.

Junior dev: "hey how does this work?" Me: "Did you run the tests?"

Re:Do you really want a single-page application framework? by dismantlethesun on Tuesday November 15, 2016 @10:04AM (#12958542)
Whilst this may be true in general, I find that when it comes to Javascript, things are already so sandboxed and reliant on the DOM api, that there's little you can do to shoot yourself in the foot.

At worst, your site won't be cross-browser compatible, but it's not like it's serverside where the framework is legitimately doing heavy lifting in a high performance environment.

Re:Do you really want a single-page application framework? by Cthulhu_ on Tuesday November 15, 2016 @03:03AM (#12956390)
> but you're making a really good problem specific framework that exactly fits the thing you're building.

Except when you don't. A lot of people, when they realize they're building a framework, start over-engineering (YAGNI). Another issue is that they, for example, build a template renderer but miss a lot of edge cases, opening their application up for script injection and other such nasty things.

Ten or so years ago, PHP had the same disease - people thinking they're hot shit, building their own frameworks, writing wrong tutorials on how to e.g. connect to a database because they thought they knew how that worked. This resulted in a huge amount of SQL injection issues, millions if not billions of hacked accounts, and billions in damages.

TL;DR don't write your own framework, please.

Re:Do you really want a single-page application framework? by dreistdreist on Tuesday November 22, 2016 @08:25AM (#13013908)
PHP did not have a useful package manager back then. It has now.

Custom solution built on top of stable components > general purpose framework

Re:Do you really want a single-page application framework? by geebee on Tuesday November 15, 2016 @01:39PM (#12960874)
Id agree, but add my own plea: please dont write an spa if you dont need one.

Yes I left that a bit ambiguous, but it is harder to manage and work witha rails and ember app than a reg'lear ol rails app. Thats cool if are genuinely getting something out of it. "Ember experiece" on your resume doesnt count.

Except that it does, bummed, but i do understand.

Re:Do you really want a single-page application framework? by matt4077 on Tuesday November 15, 2016 @03:37AM (#12956522)
Well, every app is a snowflake, but there's now a pretty good snowflake framework. Meaning: programming is all about abstractions, and if you hit the right level, all applications pretty much converge.

Considering the manpower invested into today's frameworks and tooling, any single individual or small team doesn't stand a chance.

Though the learning curve is much too steep at the moment. It's improving, mostly because 10-level deep callbacks are being replaced with promises/await/async, but especially the tooling is still a daunting challenge for many.

There are now a few promising methods to get something running fast (create-react-app), but that seems to lead to opaque systems that usually work, but are prone to end up completely broken and incomprehensible when you're trying to customize them – because, for example, they do not validate their config files, use inconsistent naming, or deeply nested json where any deviation from the expected structure leads to silent failure.

Re:Do you really want a single-page application framework? by stickfigure on Tuesday November 15, 2016 @03:20AM (#12956449)
you're making a really good problem specific framework

You really aren't. Well -- I don't know you personally, but speaking statistically, your homegrown one-off framework only makes sense to you and will require a major rewrite to accommodate that feature you want to add next week. And you're going to spend all your time until then debugging a glitchy state transition.

Re:Do you really want a single-page application framework? by matwood on Tuesday November 15, 2016 @08:28AM (#12957765)
> The distinction is that you're making a crappy general purpose framework, but you're making a really good problem specific framework that exactly fits the thing you're building.

But are you really? I'm not against rolling my own framework, but there needs to be very specifics reasons. The are so many reasons why using a popular framework is a good thing, that there have to be some very good reasons to roll my own.

> Your thing is only for You to do Your Thing, so it can be much lighter and to the point.

Unfortunately every time I have seen this reasoning used, it falls apart after starting. Rarely is software static, and instead it continues to grow. The custom framework may be lighter and to the point when you start and 6 months from now it is a bad copy of a common framework you could have just used off the shelf.

Re:Do you really want a single-page application framework? by thewhitetulip on Tuesday November 15, 2016 @03:16AM (#12956436)
I understand that rather than rolling out your own web framework we can just use existing frameworks. What are your thoughts about using libraries and not frameworks, like what what is popular with the Go language?
Re:Do you really want a single-page application framework? by mwcampbell on Tuesday November 15, 2016 @11:40AM (#12959579)
> Your thing is only for You to do Your Thing, so it can be much lighter and to the point.

And also doesn't handle things that didn't occur to you, like accessibility. Some of that bloat is actually useful, even necessary, to someone.