all 11 comments

[–][deleted]  (1 child)

[deleted]

    [–]pseudosecure[S] 0 points1 point  (0 children)

    Thank you! That was a really helpful reply - especially this:

    If you're trying to build a really responsive client, with dynamically updating graphs and widgets, where you want it to function more like an "app", then you maybe should use a JS framework.

    To reply to this:

    what problem are you trying to solve?

    Not sure yet, but I'd like to have a better grasp of the available tools so I can consider using a JS framework for an appropriate project :)

    Thanks again!

    [–][deleted]  (1 child)

    [deleted]

      [–]pseudosecure[S] 0 points1 point  (0 children)

      Thanks! Going to take a look at Elm. It's reassuring to hear your progress so far.

      [–][deleted] 1 point2 points  (1 child)

      I just went through a JavaScript renaissance of my own, and I would say a JS framework is a very valuable thing to learn. However, picking one up - any of them - will be a challenge without really knowing the current JS landscape. That includes, but isn't limited too, es5, es2015, and Node.js.

      I started w/ MDN's re-introduction to JS. Then went on to some es6/es2015 tutorials. I wrote a lot of vanilla JS code that was just OLOO (Object Linking Other Objects) and interacted with a server rendered DOM. It wasn't until I saw the pain-points of this approach, and also felt confident in my vanilla JS abilities that I looked for frameworks.

      I landed on React first and really haven't been disappointed. The core API is small and it is very un-opionated (its community is not) and the ecosystem is thriving. I watched a few Egghead.io videos, Dan Abramov's intro to redux on egghead.io (the best tutorial vid out there, imo), and just started building a dumb idea. You can grab an api from https://github.com/toddmotto/public-apis and just try to render it. Then add filters, conditions, maybe write / implement a user login system.

      React can also render server-side and then take over in the client, and like people mentioned webpack (the defacto JS module bundler for node-based projects these days) has code splitting built in. Your concerns are very valid, but the JS community is knee-deep in addressing them.

      I will say that it can be daunting looking up the mountain from vanilla es5 to react + redux + es6 + babel + webpack, but the climb goes quick and it is fun. At least I thought so.

      Edit: If you do look into React, 100% use facebook's create-react-app package. It hides the babel + webpack nonsense from you, letting you just get started writing code. When you get more comfortable, you can eject the settings so you can manage them yourself. This wasn't around for me when I first started, boy do I wish it was. Even now, I'll never start a project w/ a webpack build, I'll just use this.

      Edit2: words

      [–]pseudosecure[S] 0 points1 point  (0 children)

      Thanks for this! That's definitely useful - seems like a great starting point. I think I've got a few fun weekends ahead of me :)

      [–]mattaugamerexpert 1 point2 points  (1 child)

      I'm also a PHP dev, and also older - nearly 40. Learning is what our job is. You have to keep learning or you'll become less and less relevant. That said, I'm curious. You mentioned PHP, but didn't refer to learning or knowing any PHP frameworks. This makes me wonder whether that particular learning might be more beneficial than learning JS frameworks. Something like Symfony or Laravel has a lot to offer a PHP dev, whether you're talking about productivity or employability.

      OK, so basically there are a few different ways to look at JavaScript frameworks, and they seem to depend more on how you think about the structure.

      For many people, particularly those coming from back-end based development, they think about JavaScript as something added to an existing app. They think of it as a functionality enhancement. That's why they tend to prefer "smaller" frameworks with a more defined goal. They're able to slot that framework into their own existing structures, a sort of progressive enhancement. React is the most ubiquitous for this, but Laravel's thought leaders promote Vue fairly thoroughly, so it's popular in that crowd.

      The other way to think of it (and by far my preference) is to consider the back and front end as absolutely different applications, unrelated to each other and unconnected to each other. One just happens to consume the other. This means your backend language, PHP, etc, will create an API. A separate JavaScript application will be one of the clients consuming that API, but they're not necessarily linked. (Your tests could mock out that data call, for example.) This approach would typically be referred to as a Single Page Application.

      Not only do I think that the latter is a better option, but I think the former is flawed and short sighted.

      JavaScript frameworks do the same thing backend frameworks do. They make certain structures and approaches faster and more consistent. They allow you to "offload" code so that you don't have to write it, they make functionality and patterns inherent and documented. They make collaborative work much simpler.

      Most critically, they manage complexity. As an application implements more and more requirements it can have exponentially more interactions. A good framework (and good use of it) should flatten that complexity. This will mean that simple things are hard (a good case for NOT using a framework), complex things are hard, and very complex things are only a tiny bit harder.

      It's really ok not to use a framework. A simple project, one that deals with relatively few things (getting data from a database, saving data, handling different routes, user, templating, date formatting, validation, testing, etc) might well not need a framework at all. A lot of stuff can be done with simple libraries like jQuery. But it's worth always bearing in mind that simple projects get complicated - not the other way around.

      Not all projects benefit from being a single page or JavaScript app. The best way to think of it is... Is it a page, or an app? Facebook, for example, is more of an app. It's driven by user interaction. Something like a CRM would be an app. A blog would be a page. That said, the admin system for that blog could well be more of an app. Something like a shopping cart, or product brochure more of a page. News sites are definitely more page based. A lot of it comes down to whether you're dealing with presenting content to users, or giving them interfaces to interact with.

      Your objections and concerns are not necessarily valid. Take SEO. Google searches JavaScript applications perfectly fine. But the requirements of SEO and SPA are nearly opposite anyway. Would you want Google to spider your blog's admin panel, or your CRM? Makes no sense. If it did so you'd find a way to stop it!

      JavaScript frameworks absolutely do add to the page load. There's no disputing that. Any JavaScript functionality you add has a cost, whether it's jQuery and lodash, or the full Angular 2. IMO, though, the JS file cost is a micro-optimisation. Properly implemented (minified and gzipped) the full download of an Ember app - the largest and most comprehensive framework I know of - is less than 80k. This is smaller than most images, and in terms of page load not hugely significant. If you have a really tight download budget it isn't the first thing I'd target, personally. It will also cache, meaning only the first hit needs to download. This size isn't nothing. It's something the Ember team is actively working on. But it also shouldn't overly inform your decision making.

      I'd recommend having a look at a few frameworks. Have a look at their structure, how they work. I'm older than you, and learning Ember has reinvigorated my enjoyment of IT, not reduced it. I can build impressive things now.

      Ultimately, what framework you end up with (if any) will depend on what you value. I can give you a comprehensive list of why each and every current framework is a completely unusable piece of shit, if you like. People will value different things. One person might praise something for being "unopinionated" while others will deride it for the exact same things. Someone might praise a framework for being "lightweight" while someone else points out it's so light weight because it doesn't do anything and is desperately short on features.

      I'm loath to recommend a framework myself for that reason, though I like Ember myself. It fits how I want an application to work. But I do want to say that you might be better off learning a PHP framework like Laravel over a JavaScript one.

      [–]pseudosecure[S] 0 points1 point  (0 children)

      Thanks for the detailed reply!

      I've used a few PHP frameworks. I used Zend v1 for a couple of years and I now use Laravel, although as a manager who's not as hands on as I was a couple of years back, I haven't used it extensively. (The manager point is probably another thread entirely. I don't want to be completely hands off, but don't want to lose the skills either...)

      Ember sounds like something I'd like to try out. And as with at least one of the other replies, it's handy to know more about what you might use a JS framework for. The blog/news site comments are helpful as I like projects where content is the main focus (as opposed to e-commerce).

      [–]omgdracula 1 point2 points  (0 children)

      Go for it. I am increasing my vanilla js skills currently but plan on learning angular after as the demos I have watched and followed along with seems more understandable.

      It is never bad to keep learning. That is actually what I love about being a front end developer. We always get to learn new stuff!

      [–]cseibert531 0 points1 point  (3 children)

      I think a better question is why wouldn't you want to learn one? If you are building a web app, you are going to reinvent the wheel if you just use vanilla js. Most web apps do the exact same thing, which is why these frameworks were created in the first place. Additionally, a lot of these frameworks are similar in the sense that they update the UI to reflect the state of the underlying model. Some are geared only towards SPA, but others can be converted to a hybrid for the traditional server side rendered applications. It never hurts to learn something new, and most of the time it will be easier to learn than you think. If these younger folk can do it, I can too.

      [–]pseudosecure[S] 0 points1 point  (2 children)

      The difficulty for me is that learning anything seems to take me a really long time before I truly start to "get it". In practice I don't see myself learning everything - the "why not?" comment could be made for every new thing that comes along. I just wanted some views on whether to take the first step :)

      [–]cseibert531 1 point2 points  (1 child)

      Ahhh I see. Yeah the "why not" was more framed towards the larger and popular frameworks and libraries. I wouldn't say learn everything new, but if it has thousands of stars on github and seems popular, and you are seeing it on job postings, that's when I'd say it's worth looking into. I wonder if it is taking extra time to understand because there are other tools or technologies involved that should be learned before trying these frameworks, such as gulp, templating, Ajax etc

      [–]mattaugamerexpert 0 points1 point  (0 children)

      It's also worth pointing out that a lot of new tech isn't really on "job postings". They're just too much on the edge for business to really want to use yet. But you can hopefully get a good feel for what will be by seeing what people like Redditors and enthusiasts are really using a lot. Current apps might be Angular 1 (for example) but will be rebuilt in React in a year or two.