What Learning Javascript in 2016 Feels Like...

Discussion in 'Programming & Software Development' started by antipody, Oct 10, 2016.

  1. antipody

    antipody Member

    Joined:
    Jul 28, 2001
    Messages:
    5,040
    Location:
    Small World
  2. wwwww

    wwwww Member

    Joined:
    Aug 22, 2005
    Messages:
    6,287
    Location:
    Bangkok
    Am I the only one who still uses code written in javascript without additional big libraries like JQuery with server side stuff done with CGI scripts written in C?
     
  3. w0ng

    w0ng Member

    Joined:
    Dec 17, 2006
    Messages:
    126
    Location:
    Sydney
    nope 10char
     
    Last edited: Oct 11, 2016
  4. OP
    OP
    antipody

    antipody Member

    Joined:
    Jul 28, 2001
    Messages:
    5,040
    Location:
    Small World
  5. theSeekerr

    theSeekerr Member

    Joined:
    Jan 19, 2010
    Messages:
    3,605
    Location:
    Broadview SA
    To some extent I agree with the original article - if you are a slightly obsessive type (like me) who wants to do it right from the start, learning frontend web dev JS is overwhelming in a way that, say, backend work in Golang is not.

    There are a million solutions to every problem, things that were best practice six months ago aren't anymore, and the stack seems just ridiculously tall.
     
  6. deepspring

    deepspring Member

    Joined:
    Jul 8, 2002
    Messages:
    3,601
    Location:
    Maitland, NSW
  7. Nitephyre

    Nitephyre Member

    Joined:
    Mar 31, 2007
    Messages:
    1,532
    Location:
    ormeau@gc.qld.au
    I read that whole thing... and have NO FUCKING IDEA what was said aside from "I want to show data in a template".

    I remember when it was as simple as banging out some HTML in Notepad on Win 3.11. :thumbup:
     
  8. w0ng

    w0ng Member

    Joined:
    Dec 17, 2006
    Messages:
    126
    Location:
    Sydney
    The article is specifically describing only the state of front-end JavaScript in 2016.

    tl;dr: Managing front-end state in 2016 is fucking hard.

    Maturity of the web over the ages:

    20 years ago,
    there were no established design patterns or agreed-upon principles for web development. What we had was a bunch of arbitrarily placed HTML, inline styles and Java applets placed in sequential order. Websites were procedural. This was the age of Geocities homepages, "pLz sIgN mY gUeStBoOk~*~*" PHP scripts, flaming skull animated gifs and trailing mouse cursor stars with Java applets. HTML lacked semantics. Everything was thrown onto a page in <table></table> tags.

    15 years ago,
    CSS and JavaScript caught on as a way of separating styling and interactivity. We started seeing <div></div> beginning to take over <table></table> as the way to structure a webpage. The problem with JavaScript was still too immature to provide useful interactivity and was more often than not just spam or annoying when placed on a page. Instead, what we got was the rise Macromedia Adobe Flash as a cool low-bandwidth way of animating websites and providing online games. The problem was attempting to manipulate the outer HTML and manipulations between embedded flash files was cumbersome. Having to run a third-party plugin in a browser made Flash a security and accessibility clusterfuck for legit businesses trying to operate online.

    10 years ago, database-driven websites on the backend became the shit. Enter ASP for .NET, Zend/Symfony for PHP, Rails for Ruby, Django for Python. While tech giants had been building similar things in-house, these open source MVC frameworks greatly reduced the barrier of entry of being able to build and maintain secure web applications where all business logic happens behind the scenes. To this day, concepts learned in any one of these backend MVC frameworks are transferrable between each other. Two major things starting pop-up around this time that would cause an explosion in front-end development: Ajax and Android/iOS devices.

    5 years ago,
    with the growing demand to support different views for desktops, phones and tablets, nerds began vomiting the terms "Responsive design" and "User experience" all over the place. No longer is it suffice to predominately focus on backend work. jQuery was cool for a long time by providing a layer on top of JavaScript to make writing simple scripts and animations easier. But as we're moving to more interactive websites, more events, more user actions, then re-using and maintaining jQuery becomes a clusterfuck a la using plain old PHP back before MVC frameworks were available. Furthermore, jQuery was nice when we only had to handle one or two Ajax requests, but the increasing blur and communication between backend and frontend means we're starting to work with a shitload of sequential and concurrent Ajax requests and pretty soon we've got "Callback Hell". Enter the next trend of SPAs (single page applications).

    Today,
    We still don't know what the best ways are to manage the front-end. More specifically, we don't know how to manage view state. Angular and Ember.js were initially introduced to try and tackle managing the view state in a MVC-like manner, but many believe it's conceptually flawed. You're essentially trying to tackle one problem (managing View state) by re-architecting a pattern designed for something else (managing Model/View/Controller actions where the source of truth is stored permanently in a database or a file). As a result, it's difficult to separate concerns and you'll often find yourself hacking bits together or bloating up your models with no real alternative.

    React?
    Throw away all the things they taught you at school. Forgot object-oriented programming. Forget all those design patterns and forgot SOLID principles. Remember DRY. Instead, the React way of doing putting stuff on a page is by combining multiple components together. Each component is self-sustaining, making abstraction and testing easy. State flows in a single direction rather than being bi-directional. If anyone's done any graphical work, the concept is similar to OpenGL's state machine. Rather than handling the logic of how to update the display after an event, you instead describe what state has changed from an event. React then does magic behind the scenes, and optimally re-renders only the elements on the page that have changed. All other unchanged bits on the page do not get re-rendered. What this means is that you do not need to concern yourself about interacting with the DOM and instead should structure of your state to fit the business logic of your app. The only problem is that structuring your state to fit the business logic of your app is the most difficult problem in creating a React app.

    Redux?
    React itself is actually easy to pick up. If you know JavaScript, you will know how to code React within a week. Managing state is fucking hard. The trend at the moment with modern React apps is to use the Redux container to manage state. Redux was released in August 2015. With redux comes a shitload of more learning. The basic Redux concepts are "Actions" that are triggered, which are then passed to a "Reducer" which then updates a single "Store". The problem is that there are no universal standards for concepts beyond that. Anything more complex than a TicTacToe game or Todo app will require integrations with more third-party redux libraries. If React took you one week to learn, Redux will take you another month.

    Is Redux the future?
    I don't know. Ask again in 3-6 months when another new library starts trending. One of the annoying things about all this level of abstraction is the huge number of files you have to touch to get shit done. For the past 3 weeks I've been working on "Make a search page and display the results". Front-end only. The pull request has 54 file changes of containers, components, services, actions, constants, sagas, reducers, selectors and its tests. And it's not finished. Either way, I don't mind if it's not the future. I'm happy learning new ways of doing things, throwing it away later and learning more new things as they come, whilst getting paid for it. That's what makes JavaScript fun.
     
  9. deepspring

    deepspring Member

    Joined:
    Jul 8, 2002
    Messages:
    3,601
    Location:
    Maitland, NSW

    Hence the reason I have dumped that thing called: Web Development.

    I seriously don't see the appeal of something that changes so radically in a month. I don't need the ulcers either.
     
    Last edited: Nov 5, 2016
  10. Wolfje

    Wolfje Member

    Joined:
    Jul 9, 2007
    Messages:
    938
    Location:
    Brisbane
    Ignore the hipster bullshit, and stick with one of the more well known stacks. There are lots of everything that do everything in javascript, but usually only a few are worth knowing unless you have a specific need for more.
     
  11. deepspring

    deepspring Member

    Joined:
    Jul 8, 2002
    Messages:
    3,601
    Location:
    Maitland, NSW

    I know. I am just over being a hockey puck for arseholes. There is an oatmeal comic that explains what I mean... but I can't seem to find it.

    I am out of IT now anyway, and can't remember half the shit I used to do.
     
  12. mr camouflage

    mr camouflage Member

    Joined:
    May 25, 2012
    Messages:
    1,095
    Location:
    Perth
    Is this the one?
    http://theoatmeal.com/comics/design_hell
     
  13. deepspring

    deepspring Member

    Joined:
    Jul 8, 2002
    Messages:
    3,601
    Location:
    Maitland, NSW
  14. Wolfje

    Wolfje Member

    Joined:
    Jul 9, 2007
    Messages:
    938
    Location:
    Brisbane
  15. RnR

    RnR Member

    Joined:
    Oct 9, 2002
    Messages:
    16,572
    Location:
    Brisbane
    The thing with React and the flux pattern is their ability to scale with the number of devs banging on the code base. Facebook's codebase has over 15000 React components. If you know how to React, you know also how to React Native. Facebook estimates something like 80% code sharing between their iOS and Android deployments for one of their Apps done in React Native.

    If you are just a single person banging away, sure vanilla js maybe sprinkled with jquery could be fine.
     
  16. w0ng

    w0ng Member

    Joined:
    Dec 17, 2006
    Messages:
    126
    Location:
    Sydney
    What does this even mean? There is no 'well-known' front-end stack. If you don't care about interactivity, there is nothing wrong with sticking with one of the backend stacks and using jQuery for a few animations/ajax tweaks - it isn't going away anywhere anytime soon.

    If you care about where the web is heading, LAMP vs MEAN, which was a popular argument 5 years ago, simply isn't a viable argument anymore.

    Expect more frameworks to pop-up soon, where PWAs (progressive web apps) are your next hipster modern web dev trend expected to be the norm within the next 5 years: https://youtu.be/J2dOTKBoTL4?t=758 https://www.youtube.com/watch?v=3tb-1MWg44Y ... or you can just ignore this as another fad.
     
  17. Jlirv

    Jlirv Member

    Joined:
    Dec 10, 2013
    Messages:
    172
    It's a nightmare I agree. I'm teaching myself and I'm like a lost puppy.

    My take is this get as good as I possibly can at core JS as possible. Learn the underlying principles of the language. More than anything I want to be a student of the art.

    My 10 cents.
     
  18. RnR

    RnR Member

    Joined:
    Oct 9, 2002
    Messages:
    16,572
    Location:
    Brisbane
  19. g4r3th_b

    g4r3th_b Member

    Joined:
    Sep 11, 2013
    Messages:
    17
    Location:
    Gold Coast
    I've been sticking with AngularJS mainly. Using it properly does make the good ol days of asp.net webforms for me seem a little backwards. Yes, you can do the same things, but not doing it in Angular now doesn't feel right when I'm doing full stack.

    Now that I know Angular, I can learn and understand all the other things out there much easier. Eg: I had to learn Aurelia for work and was extremely thankful I spent the time learning Angular! Made it that much easier since I already knew npm, grunt, bower, requirejs, observables, redux, etc.

    I would say learn one framework well AFTER you are comfortable with vanilla javascript (if you haven't, do this before looking into any framework https://javascript30.com/)
     
  20. andydev

    andydev Member

    Joined:
    Jun 28, 2008
    Messages:
    1,621
    This sums it
    [​IMG]
     

Share This Page

Advertisement: