7 ms·
The cynic in me is saying that JS is the new PHP. Ironically, both are very capable and suitable languages, but the sheer freedom they offer attracts crowds of
by Drdrdrq 8y ago
The cynic in me is saying that JS is the new PHP. Ironically, both are very capable and suitable languages, but the sheer freedom they offer attracts crowds of wannabe developers who think they are gods because they know how to shave off 10% of execution time in some small part of their overengineered and unmaintainable mess. And give talks about it, write blogs and post clever twits.
However developing robust software is possible in JS, the same way it was possible in PHP. You just need to take some time to vet dependencies a bit better and not use every fad when it surfaces. Common sense and experience help a lot. But it's incredible what can be built with modern toolchains and how maintainable it can be. Don't let the anti-JS feeling scare you from trying React / Vue /..., just don't forget that state management, separation of concerns and similar concepts are still valid.
- saagarjha 8y ago> the sheer freedom they offer attracts crowds of wannabe developers who think they are gods because they know how to shave off 10% of execution time in some small part of their overengineered and unmaintainable mess. And give talks about it, write blogs and post clever twits Honestly, I think JavaScript just has a lot of new developers who have never been exposed to concepts of software development such as dependency management, cultivating trust, and how (free and) open source works. I think the kind of developer you're describing is actually a minority.
- nerdponx 8y agoThis is my thought as well. "I have creative experience and/or student loans but I don't know what to do for work so I'll take a Javascript course and become a web dev." It's wonderful that programming is becoming a kind of "equalizer" on the job market. But without supervision from software engineers (i.e. people with the experience and aptitude to design software properly) you end up with a mess.
- TAForObvReasons 8y agoThe myriad of small snippets of JS encapsulated as npm modules is best compared to the alternative of copy-pasting solutions from websites like stack overflow. Instead of lots of copies of solutions to common problems, now everyone shares the same implementation. This obviously has the centralization weaknesses but also has the centralization strengths. The fact that there's no panacea is a fact of life. There's a tradeoff, but it is not reflective of the people in the JS community.
- nerdponx 8y agoI'm not talking specifically about having dependencies instead of copying and pasting utility functions. In both cases you are expected to at least sort of understand the code you are copying/importing.
- vbezhenar 8y agoIn Java world those snippets tend to combine into bigger libraries. Apache commons and Google guava are the most known ones and their reputation is established. I don't understand why JS world does not do something similar. Some essential-utils from AiRbNb or whatever JavaScript analog of Google. And if there's still need for some tiny function, just implement it and move on! I can understand that JavaScript favors small download size, but modern tools should be able to remove unused code, so it shouldn't be an issue either.
- marcosdumay 8y agoThat's exactly what happened to PHP, with the difference that PHP core developers were also not exposed to good community and development practices before starting their project, while there exist JS core projects in good shape.
- krapp 8y agoThere exist PHP projects in good shape as well... and remember JS existed before Node and NPM, and a lot of javascript is still written entirely outside of that ecosystem. If anything, taking for granted that the JS ecosystem has a higher caliber of developers in it than PHP only serves to make the JS ecosystem look worse in contrast.
- marcosdumay 8y agoThere exist PHP projects in good shape now. Even the core developers learned their lessons and are seeking a good language now. PHP is maturing, and may become a good language at some point... if the world hasn't moved on that this point so it become an old, brittle, powerless one before it has a chance to put its flexibility to good use. Javascript started from a much better position. You simply couldn't choose a sane toolset for working in PHP on the begining, but while there is no great choice for JS, there exist some that don't suck.
- krapp 8y agoJavascript started in the same position as PHP - a wild west community of amateurs writing their own code by hand... then JQuery and other frameworks came along and more amateurs were writing their own code mostly by hand around those frameworks. Neither language or community started off on a good footing.
- simion314 8y agoPHP has many built in functionality and modules that are packaged in Linux distros,in comparison JS is very bare bones and JS ecosystem encourages the reuse of 5 lines helper function from npm. Edit, a culture difference example: a dev wanted to get the video length in a mp4, so he installed a npm package but it did not worked, the issue was that ffmpeg was not setup in the PATH so he asked me to solve it, I asked to use the absolute path of the ffmpeg binary but that was not an option n the package. In the end I checked the package he found and used and I showed that it just called ffmpeg from the command line and if we just do that we can pass the exact options we want and not have to install a third party package. As a PHP dev when I have to perform something is to find if there is a Linux CLI app that does this, install the app on the server and call it (like ffpmeg, wkhtml2pdf, an epub to mobi app, etc) I can trust a CLI app that is packaged in Linux then a random package. PHP has composer and we use that for third party integration like Dropbox,Facebook,Amazon have official packages that we can grab and use.
- ryukafalz 8y ago>As a PHP dev when I have to perform something is to find if there is a Linux CLI app that does this, install the app on the server and call it (like ffpmeg, wkhtml2pdf, an epub to mobi app, etc) I can trust a CLI app that is packaged in Linux then a random package. This is only better because your distribution has a curated set of packages with trusted maintainers that (in theory) read through the source code to make sure it's not doing anything malicious.
- buboard 8y agoalso because most of those libraries are just thin wrappers of other C libraries, which have already been vetted and most of the time are already part of the OS. Javascript reinvents everything .
- simion314 8y agoIs not JS itself, but the NPM culture where you instead of writing a few lines of code you include someone else package. So in my example the job was to get the video length, the dev tried to use https://github.com/eugeneware/ffprobe https://github.com/eugeneware/ffprobe if it all would have worked would have been faster but at the cost of not knowing what is happening under the hood and depending on this package that also seems to depend on 3 others(not sure if those also depend on others)
- k__ 8y agoI think JS has a better standing than PHP, because it was standardised and got world class devs early on. But in all other aspects I think JS is the new PHP.
- buboard 8y agojavascript isn't even usable out-of-the-box without a few (hundreds) libraries to make it comfortable to use. I disagree, PHP is nothing like it, its standard modules library is chock-full of stuff that is fast, useful and based on existing C/C++ libraries or standards. but sure if one wants want to classify incompetent developers in the PHP bucket, then everything is "the new PHP"
- bradleyjg 8y agoFast and useful stuff like mysql_escape_string?
- krapp 8y agoThat's been deprecated for years, removed from current PHP and was just a wrapper around an existing C library to begin with. If you want to blame the current language for its former vulnerabilities, fine, but comparing apples to apples would mean looking at all of the terrible ways in which javascript has been integrated into the browser and OS over the years, particularly with Internet Explorer. And I can guarantee you, from personal experience, that PHP is not the only language in which string concatenation with variables is the most common means of writing SQL queries.
- bradleyjg 8y agoI’m not defending js. On the contrary the two languages are similar in that early on a lot of people had a negative first impression because of some mind bogglingly stupid decisions made by the initial implementators. This lead to feedback loops where those that were repulsed by those negative impressions moved on to other languages while those that didn’t care stuck around. In both cases that lead to cowboy cultures developing. It is true that in both cases, eventually top notch engineers got involved in the projects’ core and cleaned things up to the extent possible. But it’s a heck of a lot easier to improve a spec than a culture.
- buboard 8y agoYet, this ancient library did not have serious issues. It was not deprecated because someone hacked it or it was even bad, but because it had not been maintained for many years. The reason was probably that it did not need maintainance, it just worked, but programmers often used it in the wrong way. In fact, the removal from PHP has caused some very small and old projects to break, and IMHO php should not have removed it, for the sake of compatibility. Also, it is much faster than the suggested alternative (pdo).
- pessimizer 8y ago> both are very capable and suitable languages No, both are terrible, garbage languages, languages that have been whipped into reasonable shape over a decade or two by good programmers forced to use them due to awful monocultures that arose through successions of largely arbitrary events. This reasonable shape means that the most recent versions can be used with relative pleasure if you ignore half of their syntax, clamp massive libraries to them to replace the other half, and assume that your end product will be as fragile as glass. edit: sorry about the trolly comment (which I make in response to a good comment), but if PHP and javascript aren't bad languages, I wouldn't know how to make a case that any language is a bad language.
- jack9 8y ago> I wouldn't know how to make a case that any language is a bad language I have a checklist I've been building which is purely based on my experience and is subjective. Appearing on the checklist makes teaching someone else more difficult and looks bad for the language in general. I believe the ecosystem is part of the language. You can't do much without running into npm if you use node but you can avoid it if you just use JS - are they separate? I treat them so. If you aren't a general purpose language being used as a general purpose language, that's partially the language's (including ecosystem) fault. eg don't make a UI with erlang. * Language has a toxic ecosystem - node * Language makes it easy to do the wrong thing - node, js, PHP, lua, Perl (notice no Python) * Language makes it hard to do the right thing - node, js, PHP, Perl, erlang, Python, Haskell, Java * Language is based on an esoteric design principle - erlang, Haskell, lua (meta-things) * Language which is internally inconsistent - node, js (floats, time, etc), PHP (bifs), Java (type system) etc. I think there's plenty of languages which have problems and few seem to be shoring them up because we still don't have a consensus on how dynamic typing should be implemented, so we build upon the sand of flawed languages and argue about triviality.
- emj 8y agoNo programming language design survives first contact with the programmers. This is also holds on project level if you are 100 persons working on the same project it's very easy to mess it up. I've seen lots of bad python code, I don't think it's hard to do the wrong thing.
- blablabla123 8y agoJS is haunted by its past, today we are almost there where we have been in 2011: on the one hand it has this perfect learning curve, being accessible for everybody who mastered basic computer usage but still offering a lot of advanced but optional features. At the same time it has this bad reputation of being unreliable and having bad documentation/code. I think in 2012 a frameworks got popular that simplified the task of building JS apps that are as complex as apps in C++ or Java. Actually using these frameworks wasn't trivial when they came out. Now that's pretty easy but the deps are crazy. I wonder what happens next, maybe some super advanced package manager will come...
- krapp 8y ago> I wonder what happens next, maybe some super advanced package manager will come... This is what needs to happen. Javascript isn't a proprietary language, yet the entire ecosystem is currently inextricably linked to the single point of failure in a single company's proprietary database, language extension (which Node.js is) and package manager. I would hold out hope for Webassembly but I'm certain it's just going to be swallowed up by the Node monster along with everything else.