News for hackers. Stuff that matters.
Re:“Node.js is one of the worst things to happen to the soft... by lootsauce on Tuesday August 23, 2016 @03:54AM (#12342069)
Totally not against solid critique. But it becomes a culture, a signal of intellectual superiority. Which is too easy. You can be, and I have been highly productive in plain ole JavaScript. Same with Java, Same with Ruby, same with Python. Are the language debates irrelevant, absolutely not. But “Node.js is one of the worst things to happen to the software industry” Hey if it is then I fully submit that I'm just some stupid fool that should rage quit the internet and give up because.... Wait no that would be stupid.
Re:“Node.js is one of the worst things to happen to the soft... by devishard on Tuesday August 23, 2016 @10:41AM (#12344079)
Instead of responding to the fact that JavaScript:

1. Has no adequate threading model.

2. Has no reasonable type system.

3. Has better alternatives on the server side.

...you're making it personal, and about the people. Look at your post; you're just accusing the critics of Node of feeling "intellectually superior". That's just an ad hominem attack. And you think that critics want you to rage quit the internet and give up? No, that's not what critics of Node want. Or at least, that's not what I want.

What I want is for people to either acknowledge the problems with Node and fix them (unlikely), or start using better alternatives on the server side, and start investing more in WebAssembly and langauges targeting WebAssembly, so we don't have to use JavaScript any more. I want this because as long as Node/JavaScript are around, I have to either deal with those horrible tools, or not take those jobs.

This isn't about feeling superior, it's about improving my life by using tools that aren't godawful.

Re:“Node.js is one of the worst things to happen to the soft... by deno on Tuesday August 23, 2016 @12:00PM (#12344762)
1. For an async-first environment, which node mostly is, lack of threading is hardly an issue. Only threading node should ever have is the web worker w/ shared memory & atomic ops that’s already going into the Web Platform[1]. I say this is an advantage.

2. Typescript is great, it even has strict null checking via union types. Way better than the half-hearted attempt at optional typing you’ll find in Python 3. So if you think Python is a good ecosystem, then node is miles better. Sure, it’s not Scala, but on the other hand interop w/ Javascript and Web Platform is seamless. It’s a trade-off, but one that I think is very much worth taking. Also it compiles in seconds, not hours.

3. You can share code w/ client which is actually useful considering web app logic is moving client-side. See: React.

4. WebAssembly is nowhere ready. No idea if using it/tooling/debugging will be any good for anything other than what emscripten enables right now. It’s a very risky investment to be considering that early.

Even if you think WebAssembly will pan out, the languages that will target it already target Javascript. It’s just alternative bytecode, really.

[1] http://tc39.github.io/ecmascript_sharedmem/shmem.html#Struct...

Re:“Node.js is one of the worst things to happen to the soft... by jamescostian on Tuesday August 23, 2016 @11:16AM (#12344386)
1. There are two built-in solutions to this (as well as a slew of other solutions in modules), the cluster module and the child process module: https://nodejs.org/api/cluster.html and https://nodejs.org/api/child_process.html

2. JS's duck typing is thought to be a "feature" to some and a "bug" to others, so if you think it's a bug, use TypeScript or Flow. They'll give you "reasonable type system[s]"

3. Nice opinion

Re:“Node.js is one of the worst things to happen to the soft... by vonmoltke on Tuesday August 23, 2016 @11:50AM (#12344675)
> 1. There are two built-in solutions to this (as well as a slew of other solutions in modules), the cluster module and the child process module: https://nodejs.org/api/cluster.html and https://nodejs.org/api/child_process.html

Process spawning and threading are two different but related mechanisms. The former is much more expensive and hard to use with optimization techniques like pooling. It also forces message passing for IPC rather than shared memory.

> 2. JS's duck typing is thought to be a "feature" to some and a "bug" to others, so if you think it's a bug, use TypeScript or Flow. They'll give you "reasonable type system[s]"

Nothing that transcompiles into JavaScript can fix JavaScript's lack of a native integer.

Re:“Node.js is one of the worst things to happen to the soft... by buu700 on Tuesday August 23, 2016 @12:30PM (#12345011)
Not that this should be necessary, but it'd actually be pretty simple for a compiler to fix #2: transform `const i: int = 3;` into `var i = new Int32Array([3]);` and change future references from `i` to `i[0]`.

No clue what the performance implications would be for really heavy uses of this, but it'd at least be a workable solution if you absolutely required a true integer type at run-time.

Re:“Node.js is one of the worst things to happen to the soft... by geofft on Tuesday August 23, 2016 @01:31PM (#12345555)
asm.js has valid, correctly-behaving integers, and asm.js works correctly on non-asm.js-aware implementations, so the lack of a native integer doesn't seem like a problem.

The emitted code might have lots of "|0"s in it, but I don't see many people complaining about the beauty of their C compiler's generated object code and the lack of native anything-other-than-integers.

Re:“Node.js is one of the worst things to happen to the soft... by vonmoltke on Tuesday August 23, 2016 @03:44PM (#12346858)
> The emitted code might have lots of "|0"s in it, but I don't see many people complaining about the beauty of their C compiler's generated object code

What are the performance implications of that? It's basically adding an extra operation. Also, having been one to dive into intermediate assembly from time to time, there certainly are people who complain about the obtuseness of object code. Particularly since the generated object code is (out-of-order execution notwithstanding) how the CPU is going to actually execute the instructions.

> the lack of native anything-other-than-integers

Um, what? C has native floating-point types on every platform with an IEEE-754-compliant FPU, and probably on some that don't as well. Pointers are also not integers, though bad programmers frequently coerce them into such because most compilers will let them.

Re:“Node.js is one of the worst things to happen to the soft... by spion on Wednesday August 24, 2016 @03:24PM (#12354555)
Regarding "|0", there are absolutely no performance implications. An ASM.js optimising compiler will recognize these code patterns and interpret them completely differently (it will not execute a bit OR operation, and instead will only treat |0 as a type hint)
Re:“Node.js is one of the worst things to happen to the soft... by spion on Wednesday August 24, 2016 @03:21PM (#12354530)
If you assign only 31 bit integer values to a JS variable, it will be treated by V8 as an integer (small int, or SMI)
Re:“Node.js is one of the worst things to happen to the soft... by kowdermeister on Tuesday August 23, 2016 @12:03PM (#12344793)
> Nothing that transcompiles into JavaScript can fix JavaScript's lack of a native integer.

Really, who cares? Types are important for the programmer not for the compiler. If I know what I'm doing then lack of ints doesn't concern me.

Re:“Node.js is one of the worst things to happen to the soft... by dottrap on Tuesday August 23, 2016 @12:54PM (#12345203)
There are certain classes of programming and mathematics that really need integers such as cryptography and fields that would need big number libraries.
Re:“Node.js is one of the worst things to happen to the soft... by kowdermeister on Tuesday August 23, 2016 @01:20PM (#12345437)
That's totally valid, but they shouldn't use Node.js if that's a mission critical part of the project. Nobody is saying that Node.js is the holy grail, but I see that expectations are that high.
Re:“Node.js is one of the worst things to happen to the soft... by all2well on Tuesday August 23, 2016 @12:23PM (#12344954)
>Has no reasonable type system

I'll bite on this. Javascript's type system is with no question my favorite part of it! JS's object model is incredibly powerful, which is why ES6 classes are implemented basically as syntax sugar, and why so many languages can be transpiled to Javascript.

I also don't think that the lack of threading is as much of a problem as you might think it is. For one, it means you can sidestep a lot of the data ordering problems that you get in a threaded environment.

There's no question that Javascript has shortcomings, but so many of the problems that happen in Javascript come from people treating it like Java, when it's a lot more like Lisp. In many ways, the architecture of Javascript revolves around a very simple, powerful object model in a way that's tough to parallel in most other languages.

Re:“Node.js is one of the worst things to happen to the soft... by grumpyprole on Tuesday August 23, 2016 @01:40PM (#12345663)
I'm guessing he mean't static type system. This is the formal meaning of "type" in programming language theory. What you describe is a system of runtime tags.
Re:“Node.js is one of the worst things to happen to the soft... by richmarr on Tuesday August 23, 2016 @06:16AM (#12342580)
Completely agree.

I'd actually like to list the worst things (IMO) to happen to the software industry.

(1) Marketing of computers at boys resulting in a generation of girls being excluded. (2) Software patents suffocating innovators. (3) DMCA & international equivalents (4) Daylight savings time. (5) A generation of programmers being taught that anything other than "OOP best practice" was heresy

I'm sure there are plenty I'm missing.

Does one particular programming environment deserve to be listed with that stuff? Personally I think it's a pretty ludicrous suggestion.

Re:“Node.js is one of the worst things to happen to the soft... by DashRattlesnake on Tuesday August 23, 2016 @11:48AM (#12344654)
> (4) Daylight savings time.

It's always annoys me whenever programmers complain about time zones and daylight savings time, because of the difficulty and inconvenience handling them in software. It's getting things backwards. Software should model the (human) world* ; the human world shouldn't be changed to model what's most convenient for software.

* That doesn't mean you can't have a simpler model that you translate to/from.

Re:“Node.js is one of the worst things to happen to the soft... by richmarr on Thursday August 25, 2016 @06:23AM (#12357959)
> Software should model the (human) world* ; the human world shouldn't be changed to model what's most convenient for software.

Agreed, but my point is that daylight savings time is a huge human-world complexity that brings a marginal boost to some sectors. There are a ton of negative effects and I question whether there's a net benefit, even before all the software complexity needed to support it.

https://en.wikipedia.org/wiki/Daylight_saving_time#Dispute_o...

Re:“Node.js is one of the worst things to happen to the soft... by nulagrithom on Tuesday August 23, 2016 @10:15AM (#12343871)
Oh man, "OOP as gospel"... If there's one thing that I like about Node.js, it's that it made me actually think about when I should take an object oriented approach vs a functional approach.
Re:“Node.js is one of the worst things to happen to the soft... by paublyrne on Tuesday August 23, 2016 @07:17AM (#12342779)
Daylight savings time? What's the connection to the software industry?
Re:“Node.js is one of the worst things to happen to the soft... by typicalbender on Tuesday August 23, 2016 @07:27AM (#12342811)
Dealing with time-zones and daylight savings time (which countries have it and which don't) can be a very challenge and messy problem that is really easy to get wrong.

Heres a pretty good video from computerphile on the subject https://www.youtube.com/watch?v=-5wpm-gesOY

Re:“Node.js is one of the worst things to happen to the soft... by collyw on Tuesday August 23, 2016 @09:32AM (#12343540)
Won't most mainstream languages have a built in library for that sort of thing these days?
Re:“Node.js is one of the worst things to happen to the soft... by gregmac on Tuesday August 23, 2016 @10:56AM (#12344212)
Most do, but the problem is less about the library and more about understanding how to use it.

For example, if you want an event to happen in 12 hours, and it happens to be 9pm the day before daylight savings time, do you schedule it using the timezone-aware API (so it happens at 9am, which is actually 13 hours away) or 8am (which is 12 hours, but non intuitive)? What about the event that's supposed to happen every 12 hours in perpetuity?

What happens when the user/device is mobile, and crossing timezones? Which times do you use?

What happens when you're scheduling something far in advance, and then the timezone definition itself changes (as happens a few times a year) between the time you scheduled the event, and the time something actually is supposed to happen? Does the event adjust for the new definition or follow original time?

Luckily for many problem domains, the details around this don't matter too much, but this is just the tip of the iceberg with timezone challenges.

Re:“Node.js is one of the worst things to happen to the soft... by PeterisP on Wednesday August 24, 2016 @07:15AM (#12351144)
The libraries don't really help with some issues.

E.g. a rather trivial example of displaying a hourly graph/table of some measurement, including comparison with yesterday (because there are daily patterns of fluctuation).

DST means that some of days have 23 hours and some days have 25 hours. The libraries will help you make the relevant calculations, but now you have to make a decision wether the comparison that you make with "yesterday equivalent" of today's 11:00 is yesterday's 11:00 (23 hours ago) or yesterday's 10:00 (24 hours ago).

For another example, accounting of hours worked - you may have a person that has worked 25 hours in a single day, such events break some systems.

Re:“Node.js is one of the worst things to happen to the soft... by dcornu on Tuesday August 23, 2016 @10:39AM (#12344058)
They do. The problem is that the rules of DST change over time (sometimes at the very last minute https://github.com/eggert/tz/commit/868f3528a9fd60491439ce45...) and can lead to all sorts of date math bugs when comparing timestamps across timezones.
Re:“Node.js is one of the worst things to happen to the soft... by douche on Tuesday August 23, 2016 @05:20PM (#12347766)
A lot of them are... not great. Moment.js makes it somewhat bearable in JS, but the native stuff is hot garbage.
Re:“Node.js is one of the worst things to happen to the soft... by wangchow on Tuesday August 23, 2016 @08:36AM (#12343165)
Spring forward, fall back!
Re:“Node.js is one of the worst things to happen to the soft... by zaphar on Tuesday August 23, 2016 @09:12AM (#12343409)
But not every country or even every part of every country...
Re:“Node.js is one of the worst things to happen to the soft... by TeMPOraL on Tuesday August 23, 2016 @07:27AM (#12342809)
DST adds complexity to the already ugly mess timezones are. Timezones are literally driven by real-world politics, and they can be as messy as only humans can invent.

See also: http://naggum.no/lugm-time.html

Re:“Node.js is one of the worst things to happen to the soft... by manarth on Tuesday August 23, 2016 @08:02AM (#12342968)
As well as adding to the already-confusing mess of timezones and date calculations, daylight savings can change frequently, and sometimes at very short notice.

This year, Azerbaijan decided to cancel DST, and agreed the cancellation just 10 days before the scheduled clock change [1]. Egypt cancelled DST with even less notice - just 3 days! [2]

[1] http://www.timeanddate.com/news/time/no-dst-azerbaijan.html

[2] https://www.washingtonpost.com/news/worldviews/wp/2016/07/06...

Re:“Node.js is one of the worst things to happen to the soft... by OldSchoolJohnny on Tuesday August 23, 2016 @11:48AM (#12344652)
Hah! You've had a very lucky programming career indeed if you can ask that question in all seriousness.
Re:“Node.js is one of the worst things to happen to the soft... by ehnto on Tuesday August 23, 2016 @07:22AM (#12342794)
It has to be accounted for in time and date calculations and that poses a new set of challenges.

It is also just one of many geographical, cultural, and temporal challenges that need to be addressed by any business system relying on accurate international dates and timing.

Re:“Node.js is one of the worst things to happen to the soft... by PeterisP on Tuesday August 23, 2016 @09:57AM (#12343731)
Time and scheduling are a bit tricky, to say the least. It would help if there were some reasonable assumptions that you can make - for example, a day containing 24 hours. DST makes such assumptions not true.
Re:“Node.js is one of the worst things to happen to the soft... by sanderjd on Tuesday August 23, 2016 @10:56AM (#12344203)
Wow! You haven't run into DST issues in software yet?! How I envy you! If you work in the industry, you have a lot of fun unintuitive but sort of neat bugs to look forward to!
Re:“Node.js is one of the worst things to happen to the soft... by elijahparker on Tuesday August 23, 2016 @10:16AM (#12343876)
+1 daylight savings time -- it's behind countless bugs. You can add weird and split time zones to that, too
Re:“Node.js is one of the worst things to happen to the soft... by michaelcampbell on Tuesday August 23, 2016 @10:11AM (#12343839)
null?
Re:“Node.js is one of the worst things to happen to the soft... by christophilus on Tuesday August 23, 2016 @10:53AM (#12344176)
Yes. Null belongs on any list of things the software industry got wrong.
Re:“Node.js is one of the worst things to happen to the soft... by HeavyStorm on Tuesday August 23, 2016 @12:40PM (#12345080)
Should be the first one.