Live data from Hacker News

Frameworkless JavaScript

moot.it

31–40 of 190 posts

Re: Frameworkless JavaScript

#31
>Why not Angular?

The author points out that they just want two-way databinding, and don't want the entire overhead of Angular. Most of the Angular overhead is directives that you probably would use /anyways/, and are actually just written in Angular.

Ostensibly, you could fork Angular, take out all the custom directives, and end up with a much smaller starting codebase.

But then you'd end up re-implementing a lot of the default Angular directives (like ng-loop), and likely have a buggier application for it.

Re: Frameworkless JavaScript

#32
post #15

I've just gone through a similar process of reviewing and discarding a number of JavaScript frameworks. I've settled on React, and I can't recommend it enough! React handles mostly the V in MVC, and does an admirable job of it. It even provides a cross-platform event abstraction, which would've saved the author some trouble. http://facebook.github.io/react/ http://facebook.github.io/react/blog/2013/06/05/why-react.ht…

React is a view + template, not a framework. From the React site: "React as the V in MVC". It's perfectly normal to combine react with something like Backbone as more complete solution.

React components are controllers too. "componentDidMount" == controller event. They are lightweight controllers, though.

Re: Frameworkless JavaScript

#33
post #15

I've just gone through a similar process of reviewing and discarding a number of JavaScript frameworks. I've settled on React, and I can't recommend it enough! React handles mostly the V in MVC, and does an admirable job of it. It even provides a cross-platform event abstraction, which would've saved the author some trouble. http://facebook.github.io/react/ http://facebook.github.io/react/blog/2013/06/05/why-react.ht…

Hey, we're listening. The source code to all of those sites is actually already public, in the gh-pages branch of each of their respective repos:

https://github.com/thoughtbot/bourbon/tree/gh-pages

https://github.com/thoughtbot/neat/tree/gh-pages

https://github.com/thoughtbot/bitters/tree/gh-pages

I hope that helps! -Chad

Re: Frameworkless JavaScript

#34
post #15

I've just gone through a similar process of reviewing and discarding a number of JavaScript frameworks. I've settled on React, and I can't recommend it enough! React handles mostly the V in MVC, and does an admirable job of it. It even provides a cross-platform event abstraction, which would've saved the author some trouble. http://facebook.github.io/react/ http://facebook.github.io/react/blog/2013/06/05/why-react.ht…

[deleted]

Re: Frameworkless JavaScript

#36
I've used Backbone for a couple projects. Then I used Angular because I liked the two way binding and easy access to history. Still, I generally find that these frameworks get in the way for most of my projects. I tend to use the following structure:

    (function () {
        'use strict'
        var n;

        $(document).ready(function () {
            // Event listeners here
            $('#some-id').on('click', n.Product.respond_to_some_click);
        }

        // Sometimes I omit the n variable and just pollute the global namespace because I'm BA like that.
        n = {

        Product: {
            respond_to_some_click: function() {
                // Do some stuff
            }
        },

        Cart: {
        },

        Whatever: {
        }

        }

    }());
This structure keeps things pretty well organized without a real need for a framework. So far this has been a really comfortable alternative to a heavy framework. I can't wait to get it ripped to shreds and see how I can improve :)

Re: Frameworkless JavaScript

#37
post #32

Earlier quoted context omitted.

React is a view + template, not a framework. From the React site: "React as the V in MVC". It's perfectly normal to combine react with something like Backbone as more complete solution.

React components are controllers too. "componentDidMount" == controller event. They are lightweight controllers, though.

@Touche True. It's perfectly reasonable to add a model/data layer to React as a final/complete solution. In such a situation a heavy weight controller can be skipped.

Re: Frameworkless JavaScript

#38

Really interesting post for sure. I'm not really seeing the size advantage here. All of the mentioned frameworks are cached on popular CDN's and I just don't think you're really getting much of a win out of creating your own, smaller files. Also, I'm always wary of companies that want to re-invent the wheel as opposed to using open-sourced, well-documented projects. If I start at your company and you use Backbone, no…

It's not just the download size and CDN utility in caching JS on the client side for reuse -- on older machines or devices with less than shiny new execute power, all that code make for a sluggish UX experience. Maybe not in seconds, but even a hundred milliseconds can make for a huge difference, even if it's not readily apparent.

Re: Frameworkless JavaScript

#39
post #17
post #4

Suggesting that frameworks are too complicated because they "add tens of redundant methods, adding complexity for the end user" is ridiculous. The number of methods in something doesn't always add to the complexity - in a lot of cases a framework vastly reduces the difficulty of using something by abstracting away the hard stuff so the user doesn't need to worry about it. That's pretty much the point of a framework.…

I think the 'redundancy' here is more just unnecessary complexity. Eg, the primary value of Angular is binding DOM -> data. As a developer, I want to specify: - The template for the DOM - The data That's all. I don't care about $scope.$apply, a second module system (even if it's better) or anything else I have to read about. Ractive.JS (The Guardian's framework) does this. It's just mustache templates you bind to dat…

Ractive.JS doesn't need $scope.$apply because it uses it's own model system. AngularJS doesn't use it's own model system, the model is a plain old JavaScript object. The author of 'Frameworkless JavaScript' criticizes the Ember way of using a "complex model system".

$scope.$apply exist because of limitations in JavaScript. Apparently this will be fixed in ES6, so ES6-version of AngularJS theoretically won't need $scope.$apply.

Ractive.JS's data-binding looks similar to Ember.js, which also has it's own model system to learn (learning complex frameworks was criticized in the article).

Re: Frameworkless JavaScript

#40
post #3

Not using a JS Framework? Congratulations, you've just built your own ad hoc JS Framework. Suddenly, anyone who joins moot will have to invest tons of effort in your custom framework instead of being able to hit the ground running.

Congratulations, you've just built your own ad hoc JS Framework.

We used to call that part of software development “design”, and learning basic design skills and becoming familiar with the common strategies and techniques were prerequisites for being a useful developer. Perhaps losing that baseline is an unfortunate side effect of having readily available black box code to do many common jobs in the Internet age and being able to get moderately good results just by joining up those boxes. I don’t think this is a good thing, though. The idea that learning to find your way around a design when you start working on a new project might be considered difficult and not just something everyone routinely does is not a happy one.

Post reply on HN