News for hackers. Stuff that matters.
Re:Modern JavaScript for Ancient Web Developers by tedunangst on Thursday March 23, 2017 @12:50PM (#13941505)
> If you don’t have a human expert at hand, at the very least, check the date on that Medium article or tutorial or the last commit in that GitHub repository. If it’s more than a year old, it’s almost certainly not the way to go.

The logical conclusion then is to wait a year and ignore everything this article says. Saves a lot of time. :)

Re:Modern JavaScript for Ancient Web Developers by gbuk2013 on Thursday March 23, 2017 @01:01PM (#13941623)
I'm still using Make for all my minification / bundling / test running needs. Now and again I think to learn some trendy tech then never get round to it. Next time I remember it's already something different. :)
Re:Modern JavaScript for Ancient Web Developers by noir_lord on Thursday March 23, 2017 @01:05PM (#13941676)
Same with me except I'm using bash and the CLI to all the modern tools.

In 6 months I'll still remember how bash works and I get super simple debugging since I can just echo out the command it was about to run and start poking.

I'm still not sure why the JS community seems determined to slowly bootstrap an OS in javascript.

Re:Modern JavaScript for Ancient Web Developers by zaptheimpaler on Thursday March 23, 2017 @02:49PM (#13942867)
>I'm still not sure why the JS community seems determined to slowly bootstrap an OS in javascript.

Oh if only this was a joke. No.. its happening.

https://www.os-js.org/

https://node-os.com/

Re:Modern JavaScript for Ancient Web Developers by nitemice on Thursday March 23, 2017 @09:14PM (#13945776)
Re:Modern JavaScript for Ancient Web Developers by jryan49 on Thursday March 23, 2017 @07:19PM (#13945239)
We'll know os-js is finished when they finally put in a web browser. :)
Re:Modern JavaScript for Ancient Web Developers by Animats on Thursday March 23, 2017 @05:24PM (#13944454)
Right on schedule. Mandatory XKCD: [1]

[1] https://xkcd.com/1508/

Re:Modern JavaScript for Ancient Web Developers by adamsea on Thursday March 23, 2017 @01:22PM (#13941841)
For projects with not-overly-complicated builds, I have had success writing each desired script as a shell script, but then calling said shell script with an npm script.

The shell scripts are nice for longevity, self-documenting, and if you have to call them with non-javascripty things.

Calling them with npm scripts is nice for consistency, readability for many devs, and some of the path-setting/node.js process.env-var stuff that you are able to do in an npm script.

Re:Modern JavaScript for Ancient Web Developers by clock_tower on Thursday March 23, 2017 @02:37PM (#13942728)
I'm guessing it's the inner-platform effect in action, but I could have sworn that there's a more detailed name for it in reference to Javascript in particular -- something about systems always existing on the edge of acceptability or of legibility, or thereabouts. I think this was on Ward's Wiki, but I can't find it...
Re:Modern JavaScript for Ancient Web Developers by adrianratnapala on Thursday March 23, 2017 @03:58PM (#13943648)
> I'm still not sure why the JS community seems determined to slowly bootstrap an OS in javascript.

Well it worked for Emacs didn't it?

Re:Modern JavaScript for Ancient Web Developers by marcosdumay on Thursday March 23, 2017 @04:28PM (#13943940)
You joke, but Emacs commands just interface the standard tools on your system, not replace them.

And yes, Emacs programs get deprecated fast (compared to UNIX programs, they are way, way slow compared to JS code), but somehow people don't suffer to update them (mostly because people developing for Emacs know about that "compatibility" word).

Re:Modern JavaScript for Ancient Web Developers by TeMPOraL on Thursday March 23, 2017 @04:24PM (#13943904)
It works for Emacs because it gives everything a consistent yet very powerful user interface, that facilitates heavy interoperability. In fact, that interface is more consistent and more powerful than most people have in their operating system.

Browsers, on the other hand, promote the exact opposite - inconsistent and weak interfaces, and no interop.

Re:Modern JavaScript for Ancient Web Developers by dasil003 on Thursday March 23, 2017 @01:13PM (#13941748)
> I'm still not sure why the JS community seems determined to slowly bootstrap an OS in javascript.

Portability.

Re:Modern JavaScript for Ancient Web Developers by Cacti on Thursday March 23, 2017 @01:21PM (#13941838)
That's a load of crap, there's nothing portable about a JS environment that requires build xyz of browser pqr, plus the hardware requirements, bandwidth requirements, etc. Take any ONE of those away and you're hosed (e.g., try loading even a single web page from Amazon on 56k).

Every technology of the past 40 years has claimed "portability" as its mantra, and yet here we are still.

Re:Modern JavaScript for Ancient Web Developers by dasil003 on Thursday March 23, 2017 @01:29PM (#13941926)
Sure, but the web is a unique portability story in the history of computing. Has any other platform been an open standard that ends up being table stakes for any new entrant? Think about it, if you try to make a computer without a web browser today, you'd be laughed out of the market.
Re:Modern JavaScript for Ancient Web Developers by ktRolster on Thursday March 23, 2017 @02:36PM (#13942722)
Has any other platform been an open standard that ends up being table stakes for any new entrant?

C, Java. Far more computers run C than run Javascript.

Re:Modern JavaScript for Ancient Web Developers by esrauch on Thursday March 23, 2017 @02:51PM (#13942893)
Number of machines that can run code written in the language isn't really the best metric for realistic portability. Sure, your toaster might run C and not JS, but it isn't going on run your C anyway.
Re:Modern JavaScript for Ancient Web Developers by TeMPOraL on Thursday March 23, 2017 @04:29PM (#13943947)
My browser isn't running my JavaScript, it's running yours. In fact, the capability to run my own code in my own browser is being slowly but systematically removed from the browser.
Re:Modern JavaScript for Ancient Web Developers by esrauch on Friday March 24, 2017 @08:15AM (#13948363)
When I said "you" I meant "the developer" not "the user": the class of devices that run C and not JS is also a class of devices that generally don't run third party code. If you aren't a hardware manufacturer (or trying to sell middleware to one) the fact the embedded systems run binaries that were programmed in C isn't in any way relevant.
Re:Modern JavaScript for Ancient Web Developers by c22 on Friday March 24, 2017 @03:04PM (#13951359)
If only that toaster had a web browser.
Re:Modern JavaScript for Ancient Web Developers by moron4hire on Thursday March 23, 2017 @05:06PM (#13944287)
Yeah, good luck getting that Qt app running on an iPhone.
Re:Modern JavaScript for Ancient Web Developers by tedunangst on Thursday March 23, 2017 @06:03PM (#13944763)
Re:Modern JavaScript for Ancient Web Developers by divanvisagie on Friday March 24, 2017 @02:41AM (#13947133)
Wow , that was beautiful
Re:Modern JavaScript for Ancient Web Developers by ktRolster on Thursday March 23, 2017 @08:18PM (#13945552)
QT is not C
Re:Modern JavaScript for Ancient Web Developers by scintill76 on Thursday March 23, 2017 @01:36PM (#13942009)
bash, make, and a POSIX suite probably run on many more platforms than nodejs does.

There is the caveat that too many people think they're writing portable shell scripts etc., but really they only work with GNU tools on Linux or MacOS. Then again, the same probably applies to many JS build scripts that end up relying on OS-specific behavior somewhere...

Re:Modern JavaScript for Ancient Web Developers by stymaar on Thursday March 23, 2017 @01:29PM (#13941918)
In my previous job, we had some bash scripts for a lot of things. It worked pretty well among Linux and Mac users in the team, but one day we had a new developer who was a windows user … We rewritten all those scripts in JavaScript using Grunt.

Maybe nowaday it's different thanks to Windows subsystem for Linux.

Re:Modern JavaScript for Ancient Web Developers by bigato on Thursday March 23, 2017 @03:19PM (#13943209)
Wouldn't it be better for one developer to learn and adapt to the rest of the team? I don't get why all the rest had to adapt to this single person who didn't know shell.
Re:Modern JavaScript for Ancient Web Developers by Klathmon on Thursday March 23, 2017 @03:49PM (#13943537)
There's a benefit to having multiple platforms on your development team if you are developing something for multiple platforms.

It's too often I see projects with "supports Linux, OSX, and Windows" only to find that none of the maintainers actually own a Mac and therefore it is filled with bugs and often requires the user to "find their own dependencies".

If we are talking days of time and not weeks, the benefits of making (and keeping) your whole system cross platform could pay off big time in the future when you or someone on your team wants to switch, or you just want to easily test on other platforms.

Re:Modern JavaScript for Ancient Web Developers by stymaar on Thursday March 23, 2017 @05:19PM (#13944402)
Exactly: Having a developer working on windows was a blessing since it allowed someone in the team to test on EI11 before we shipped to the product team, and it really improved our reactivity on this plateform. It wasn't our main target since our product was using webRtc(i.e. Firefox and Chrome), but it was supposed to fail gracefully on IE.
Re:Modern JavaScript for Ancient Web Developers by nawitus on Thursday March 23, 2017 @06:39PM (#13944987)
At least these days you can download VirtualBox images for free to test on IE11. But yeah, it's a luxury if there's a Windows developer that you can have fixing all the IE11 bugs ;).
Re:Modern JavaScript for Ancient Web Developers by jimmaswell on Friday March 24, 2017 @02:23PM (#13951029)
I was under the impression that IE was standards compliant enough by version 11 that this shouldn't be necessary, but I guess not.
Re:Modern JavaScript for Ancient Web Developers by path411 on Monday March 27, 2017 @05:00PM (#13971731)
Well, it's pretty complaint to standards now. The problem is that it's just 2-3 year old standards.
Re:Modern JavaScript for Ancient Web Developers by laumars on Friday March 24, 2017 @02:50AM (#13947170)
There's plenty of other POSIX userlands for Windows before WSL (cygwin, Ming). There are also plenty of other cross platform programming environments before Grunt (Perl, Python, Ruby, Lua, Haskell, numerous lisps, etc).

JavaScript isn't unique. It's not even the best at what it does. It just has a monopoly in the browser so people latched on to it.

Re:Modern JavaScript for Ancient Web Developers by kbutler on Thursday March 23, 2017 @03:47PM (#13943504)
Cygwin or msys2 would probably have let that dev run the build scripts.
Re:Modern JavaScript for Ancient Web Developers by dorfsmay on Thursday March 23, 2017 @11:56PM (#13946468)
Asking that new dev to install cygwin might have been easier!
Re:Modern JavaScript for Ancient Web Developers by pjmlp on Friday March 24, 2017 @09:04AM (#13948613)
As if JavaScript would be the only option.
Re:Modern JavaScript for Ancient Web Developers by gbuk2013 on Thursday March 23, 2017 @01:17PM (#13941789)
This is a valid concern, if it applies to your individual scenario. Nothing wrong with using the right tool for the job.
Re:Modern JavaScript for Ancient Web Developers by afdsadf on Thursday March 23, 2017 @09:27PM (#13945827)
I don't care whether or not this is a joke, it's hilarious.
Re:Modern JavaScript for Ancient Web Developers by kbutler on Thursday March 23, 2017 @03:35PM (#13943377)
bash -x script Echoes all the commands for you for easier tracing/debugging...
Re:Modern JavaScript for Ancient Web Developers by noir_lord on Friday March 24, 2017 @11:57AM (#13949774)
Neat, always nice to learn new things :).
Re:Modern JavaScript for Ancient Web Developers by tannhaeuser on Thursday March 23, 2017 @02:07PM (#13942374)
That's what every sane developer does and has been doing since the beginning of Node.js including tj (of express.js, koa, ... fame) [1] so you're in good company.

I remember a hilarious comment about "build systems becoming obsolete in year" (supposedly referring to the like of webpack, babel, grunt/gulp/broccoli, css.next if anyone is actually using it, etc.).

The newest trend as of a year ago is to ... use shell scripting [2].

[1]: https://github.com/tj/mmake

[2]: https://medium.freecodecamp.com/why-i-left-gulp-and-grunt-fo...

Re:Modern JavaScript for Ancient Web Developers by nawitus on Thursday March 23, 2017 @06:41PM (#13945006)
In my experience npm scripts become way too complex on real world applications. But maybe I simply work on apps complex enough for this to become an issue. I've used grunt, gulp, webpack and npm scripts in multiple projects. Still not sure which is my favourite, probably gulp.
Re:Modern JavaScript for Ancient Web Developers by ktRolster on Thursday March 23, 2017 @01:12PM (#13941739)
An advantage of using make is if you come back to a project a year later, you don't need to remember how to build the thing. It's documented in the makefile.
Re:Modern JavaScript for Ancient Web Developers by slmyers on Thursday March 23, 2017 @01:42PM (#13942075)
How does that differ from saying the same thing about say webpack -- ie, "the build is documented in the webpack config"?
Re:Modern JavaScript for Ancient Web Developers by ktRolster on Thursday March 23, 2017 @02:29PM (#13942646)
Makefiles are more stable, webpack just went through a breaking change to 2.0.

Makefiles are more versatile, they can be used not just for Javascript files, but for anything. I have a django project that uses lib-fann on the backend, and Selenium for data collection. I wish I had put that into a makefile because I can't remember the commands I used to build it, and now I have to take the time to go figure it out.

Makefiles have conventions for not just building, but also running: "make all" to build, "make run" to run, and if you have an unusual project, you can get plain "make" to print out out some documentation explaining what to do. Webpack has webpack-dev-server but then you have to remember that command.

Ultimately a lot of that could be had by a README file, of course, but Makefiles are easier.

Re:Modern JavaScript for Ancient Web Developers by komali2 on Thursday March 23, 2017 @02:40PM (#13942753)
vim readme.md

"To run, use 'npm run'. To develop, use 'npm run dev'. To test, use 'npm test'."

Or, open up package.json and see what scripts are there... I don't get how that's any different? Why wouldn't you have scripted all that?

Re:Modern JavaScript for Ancient Web Developers by hoorayimhelping on Thursday March 23, 2017 @03:40PM (#13943424)
I script it that way and then add a makefile on top of it so that it's conventional and handles things like envvar setting.

    build:
        NODE_ENV=production yarn build:server
        NODE_ENV=production yarn build:client

    test:
        NODE_ENV=test yarn test
Re:Modern JavaScript for Ancient Web Developers by Klathmon on Thursday March 23, 2017 @03:53PM (#13943578)
we do the same, but the npm scripts are just the "entry point". one of them was this:

    "build:dist": "NODE_ENV=production babel ./src --out-dir ./dist"
Re:Modern JavaScript for Ancient Web Developers by ktRolster on Thursday March 23, 2017 @04:39PM (#13944031)
Maybe you missed this paragraph, it talks about your point:

Makefiles are more versatile

Re:Modern JavaScript for Ancient Web Developers by jacobr on Friday March 24, 2017 @02:07AM (#13947017)
Do you generally run long running tasks such as a dev server with Make?
Re:Modern JavaScript for Ancient Web Developers by andreareina on Friday March 24, 2017 @11:09AM (#13949387)
Not the GP, but if I'm going to use make anyway, sure. init/systemd/upstart scripts for a system install, make run for a local install. It's exactly the same idea as running "node start" (apologies if I have the invocation wrong, I'm not really familiar with the node ecosystem).
Re:Modern JavaScript for Ancient Web Developers by ktRolster on Friday March 24, 2017 @03:05PM (#13951367)
A makefile is just a way to group commands together conveniently (at least, that's one aspect of it). So you can just type "make run-server" or whatever you want and it's just like running a script.

It's probably not something I would do on a production server, but it wouldn't hurt either.

Re:Modern JavaScript for Ancient Web Developers by smonff on Sunday March 26, 2017 @03:16AM (#13959626)
It is also a way to write down and share very complicated command lines that you want to generate only one time because it is a pain to type it each time. So, a kind of self-documentation.
Re:Modern JavaScript for Ancient Web Developers by chriswarbo on Thursday March 23, 2017 @02:31PM (#13942666)
Not a JS dev, but if I run "ls" or "tar xf foo.tar.gz" and I see "Makefile", I instinctively run "make". Ditto for "./configure", although I'd probably despair if autotools were needed for a JS project ;)
Re:Modern JavaScript for Ancient Web Developers by divanvisagie on Friday March 24, 2017 @02:44AM (#13947146)
Because make is human readable and webpack reads like some sort of regex gone wild example.
Re:Modern JavaScript for Ancient Web Developers by flukus on Thursday March 23, 2017 @07:16PM (#13945223)
It works with the outside world and it's been stable for decades.
Re:Modern JavaScript for Ancient Web Developers by ktRolster on Thursday March 23, 2017 @08:02PM (#13945474)
I feel like stability is underrated.
Re:Modern JavaScript for Ancient Web Developers by Can_Not on Saturday March 25, 2017 @01:30PM (#13956649)
I haven't had any trouble building and running projects years later without make. It has been a problem (in many languages) if I'm following a tutorial that didn't specify it's runtime and library dependency versions explicitly like an npm file or cargo file.
Re:Modern JavaScript for Ancient Web Developers by david-given on Thursday March 23, 2017 @05:09PM (#13944312)
I've found that too much JS stuff produce multiple output files for make to be really comfortable --- make's support for multiple output files is very rudimentary and unless you follow the insanely complex and undocumented procedure to the letter, builds fail under obscure and almost impossible-to-debug circumstances.

I've had success with ninja, although the scripts are a bit long-winded.

Re:Modern JavaScript for Ancient Web Developers by flukus on Thursday March 23, 2017 @09:21PM (#13945795)
How long are the builds? If it's not long then you could not worry about outputs and incremental builds and/or only worry about it where it makes sense.
Re:Modern JavaScript for Ancient Web Developers by andreareina on Friday March 24, 2017 @10:50AM (#13949240)
I was just recently in the position of having to figure out a "modern" javascript workflow. After getting over my stupefaction that modular js requires compilation, I ended up with a Makefile, ./src, ./lib, and ./bin.
Re:Modern JavaScript for Ancient Web Developers by timlyo on Thursday March 23, 2017 @01:15PM (#13941767)
I used to use make for everything, although recently I've started using doit for some things.

http://pydoit.org/

Re:Modern JavaScript for Ancient Web Developers by komali2 on Thursday March 23, 2017 @02:38PM (#13942737)
Meh, we use make for our app, works just fine. We do wanna switch to Webpack though because it's starting to get... messy.
Re:Modern JavaScript for Ancient Web Developers by shakna on Friday March 24, 2017 @09:53AM (#13948887)
Why not multiple Makefiles?
Re:Modern JavaScript for Ancient Web Developers by deathanatos on Thursday March 23, 2017 @09:14PM (#13945774)
Same here! It does its job well. It frustrates me, however, that some of the JavaScript tooling (in particular, bundlers) are incapable of outputting their dependency tree. It makes efficient builds much harder, as you now need to manually track the dependencies of various files. Essentially, the equivalent of `gcc -M`.
Re:Modern JavaScript for Ancient Web Developers by tmaly on Thursday March 23, 2017 @01:07PM (#13941699)
same here, I use Make for everything on my projects
Re:Modern JavaScript for Ancient Web Developers by ericdykstra on Friday March 24, 2017 @02:07AM (#13947019)
Very funny way to make a fantastic point.

The extreme amount of neomania in JavaScript land is what keeps me away from it altogether. The idea that all JS articles and GitHub repositories are outdated after a year means the entire ecosystem is fragile.

I'll leave the always-chasing-the-next to the programming bootcampers, and I'll work on building skills that will be useful long after the next 100 javascript frameworks are dead instead.

Re:Modern JavaScript for Ancient Web Developers by ry_ry on Friday March 24, 2017 @04:04AM (#13947398)
It's all just programming.

The thing with JavaScript is that as it evolves the opportunity to invent, and then solve, new problems presents itself.

Heck, most of the problems/solutions aren't even particularly new - they are just a JS implementation of other older concepts.

"...but it's just a client-side reimplementation of XSLT... BLOODY XSLT FFS!"

-- A developer, somewhere.

But for all the weird, wobbly wheels we reinvent, it reflects the time-honoured tradition of something getting a little better each time you rebuild it.

Each time the industry churns another fad we collectively learn something. Some of that filters back into browser development, some of that informs the development of the next set of frameworks and libraries, and some of it just forces us to ask difficult questions about our preconceptions.

But for me at least that's the appeal of a language like js - Programming is easy, solving problems is hard, so we keep trying.

Re:Modern JavaScript for Ancient Web Developers by bdcravens on Saturday March 25, 2017 @03:52AM (#13954549)
I do some mentoring, and one of my mentoring calls was with a bootcamper where the instructor, mid-"cohort", decided to switch to Angular 2 - while it was still in beta. I was able to help (I had been working with it since earliest betas) but was quick to let this student know how poorly prepared they were about to be for the job market upon "graduation".
Re:Modern JavaScript for Ancient Web Developers by jasonkostempski on Thursday March 23, 2017 @02:02PM (#13942320)
I have a general rule to ignore everything on Medium, saves even more time.
Re:Modern JavaScript for Ancient Web Developers by diminish on Thursday March 23, 2017 @02:56PM (#13942966)
wait for my upcoming article: Why you shouldn't ignore everything on Medium - or How I learned to love medium and stop ignoring.
Re:Modern JavaScript for Ancient Web Developers by ramijames on Sunday March 26, 2017 @05:03AM (#13959864)
The logical conclusion that I take from that statement is that the entire javascript industry is not yet mature and is not worth my time.

Seriously, what the hell kind of attitude is that?

Re:Modern JavaScript for Ancient Web Developers by mullsork on Thursday March 23, 2017 @05:09PM (#13944314)
To be fair it's less than a year since Make 4.2 was released ;)