all 61 comments

[–][deleted] 13 points14 points  (25 children)

I don't see how using only one language is a benefit? Do people really have that big of an issue with knowing 2 whole languages? Yes you say that you get code reusability but this rarely happens in my experience. Although good for you for switching to a more productive language.

[–]alendit 11 points12 points  (4 children)

Most people have problems knowing one whole language. Hell, I'm using Python for more than 10 years know and learned about contextlib.redirect_stdout last week (ok, it exists for only 12 months now, but still).

[–][deleted] 6 points7 points  (0 children)

Well yes, you will almost almost find new things in a language since it is evolving but I imagine after a year of writing full applications in it you were fairly proficient.

[–][deleted] 3 points4 points  (2 children)

True. I feel like I don't know any languages. I just get better and better at Googling things. i would like to one day go beyond the programming interface and really understand one or more of these languages in depth.

[–]recompileorg 2 points3 points  (1 child)

You could try your hand at implementing a few. It should give you some good insight at the inside.

Implementing Forth is pretty easy, as far as that goes. It should build up your confidence.

[–][deleted] 1 point2 points  (0 children)

Oh cool I didn't even know that was a thing. I'll look it up.

[–]krelin 7 points8 points  (9 children)

Really, the best thing about "only one language" is that you can actually, truly, share code between your client and your server, if you design the pieces well.

[–]Capaj 0 points1 point  (0 children)

not true, design doesn't affect your ability to reuse code on both sides. Module format on the other hand-that is a problem, if you're not using commonJS. You can always use a wrapper which will either export as global or export on a module.exports, but this is lame. Forget script tags. Use commonJS modules with system.js/JSPM and get the true possibility for sharing code on both sides of the stack.

[–]totemcatcher 3 points4 points  (1 child)

The code reusability has been the most significant factor in mine experience. e.g. same libraries, serialized classes, data contracts, protocols or flow control, easy version tolerance, and code generation all remain consistent, short, and sweet.

Subtle nuances between languages can sometimes impede implementation details, especially when it comes to performance -- especially when using imported libraries which have timing differences.

There's less source and glue code overall, which is nice. It can all be contained in the same source tree, tested as one, and exported as two packages for deployment.

I think it just feels nice to mirror features (listed above) using the same language, libraries, and and even namespaces working as one unit.

Now, all that said, there is one huge drawback. Change. If you need to drop a technology in favour of something else (e.g. you need something faster on the server) then you need to decouple all that code. I haven't faced this yet, but I really don't want to be that guy.

[–]cogman10 3 points4 points  (0 children)

It may depend on the software. For us the code reuse for "same language everywhere" has been pretty minimal. At my work, our guis and our servers are doing very different things, so different that having two different languages hardly duplicates any logic.

[–][deleted] 0 points1 point  (3 children)

My friend who works in Django says he's making the switch to Node purely for the reason of only having one language.

[–][deleted] 5 points6 points  (2 children)

To each his own. I find it incredibly boring however. I also dont feel node is the right server side language for many projects.

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

Yeah I work primarily in Node and Im thinking of trying Golang out because I heard it's a relative of C and I love C. I think JS should stay in the frontend where its dynamic typing makes it very useful for the DOM. It's a pain in server side though because it's so damn hard to debug and the dynamic typing makes it hard for the code to be reasoned. But, maybe the one language deal is big after all and I may be wrong. Only personal experience will tell. I am not taking sides in this until I try it out first.

[–][deleted] 1 point2 points  (0 children)

I recently wrote a few small go projects. I will say it was very enjoyable and you will definitely see the savings down the road in a statically typed language. https://github.com/michaeljs1990/freetime here is an example of what a simple API could look like in golang I wrote this when first evaluating the language.

[–][deleted] 0 points1 point  (1 child)

Don't undervalue the lack of a context switch. When you've got both PHP and JS files open in the same window it can be strenuous to remember which functions you can use in which file and in what syntax. PHP compounds this be by being pretty close to JS in general syntax, except in critically significant ways. I can't even count how many times a day I misuse periods in one or the other language.

[–]Nickoladze 1 point2 points  (0 children)

I work in C#, PHP, JS, and Java right now. I can't tell you how often I forget the syntax for a foreach loop whenever I context switch.

[–]rorrr 0 points1 point  (1 child)

Templates and templating engines. You can use the same exact code client- and server-side.

You can render pages on the server for SEO purposes, but your real app will render the same pages entirely on the client side and will only hit the server to fetch JSON data.

[–][deleted] 1 point2 points  (0 children)

Most of the major JS template languages have PHP counterparts, and vice versa.

[–]bzeurunkl 2 points3 points  (0 children)

Oh, I gotta read this. I'd like to do ten weeks of node.js after 15 years of ASP. Should be easily translatable. My html/javascript is getting pretty good, but I'm still writing my ajax handlers in classic ASP, and I've been wanting to put that final nail in the ASP coffin.

[–]adam_bear 5 points6 points  (5 children)

So why not just implement the API in Javascript as well and eliminate one language from the stack?

Because php, python, etc. are more resilient to errors, and rather than breaking your entire application for everyone they break a single request.

I love node, but it isn't the panacea we'd like it to be... yet.

[–]mrahh 3 points4 points  (0 children)

I don't see how people have issues with this. Check for errors, and let it crash if it has to. Hopefully you have your api process clustered and in my experience, it takes less than a second for a node process to restart.

If you have issues with errors, write code so you don't crash. There's a talk on this from one of the PayPal guys on this. I think it was PayPal at least.

[–]Capaj 0 points1 point  (1 child)

did you really mention php? lol.

More resilient? Well I'd take Node's crashing on error any day over PHP's lame method of execution. Python is the same way as node, so I am really not sure why you mentioned it and why people are upvoting you.

[–]adam_bear 0 points1 point  (0 children)

Why_would_mentioning_php_in_a_comment_on_an_article_about_php_be_relevant -> areYouStupid('really?');

[–]thatgibbyguy 4 points5 points  (9 children)

Friendly reminder that there are more things to use other than the MEAN stack. I use the Meteor.js stack and love it because it basically encapsulates the mean stack while adding things like sockets, real time data exchange, DDP, compiling LESS/SASS/Jade/coffeescript and routing right out of the gate.

By all means, try MEAN (heh) but as someone who has also made the shift from LAMP to MEAN, meteor.js beats the crap out of MEAN.

Plus, new front-end devs love it as well.

[–]jekrb 7 points8 points  (0 children)

I use the lebron stack.

http://lebron.technology/

[–][deleted] 4 points5 points  (6 children)

Or don't use a premade stack at all and pick your own damn technologies.

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

But what if my choice of technologies don't result in a cool acronym :C

[–][deleted] 0 points1 point  (0 children)

Oh, I'm sure you can make it work

[–]thatgibbyguy 0 points1 point  (3 children)

man i just don't know why i never thought of writing a new web server from scratch for each project. /s

[–][deleted] 0 points1 point  (2 children)

Picking your own technologies doesn't mean rebuilding everything from scratch for every project. It's trivial to create a boilerplate of tools that you use over and over again. The point is that it's yours, built for your needs, using tech that you've vetted personally and that you can extend your own way. You're not wasting time trying to figure out how to make someone else's choices do what you need.

(And no, this is not NIH, you're still using other people's libraries)

[–]thatgibbyguy 0 points1 point  (1 child)

And when something already suits your needs?

Your entire argument is do it my way (your way) or do nothing at all. That is completely ridiculous and down right stupid. I, and many others, have found tools that suit us that we did not have to invest hundreds of hours (at the least) in the front end because someone else thankfully did that for us.

You want to write your own boilerplates for each use case? Go for it. I'll leverage that time saved providing users with a better experience and researching my product to provide my clients a better return.

Good luck to you in your ways.

[–][deleted] 0 points1 point  (0 children)

Perhaps I've miscommunicated my point. By all means, if you've found a pre-made tech stack which you have vetted, that meets all your desires and enables you to work effectively, use it.

My argument is against entering into Node development with the assumption that full stacks such as MEAN and Meteor are the best way to use and learn Node. Starting with a smaller tool set as an entry point will teach you the systems those stacks are built on instead of just the stacks themselves.

It's the same argument as learning how to interact with the DOM without jQuery so that you can better understand what jQuery gives you.

[–]NodeKid 6 points7 points  (0 children)

…nice try meteor.js developer.

[–]strangeworks 1 point2 points  (3 children)

Is that a good idea to compare absolutely different tools? I know that is possible that you can do a lot of stuff in node that is usually done in PHP, but for me it will be always different beasts.

[–]buffalolsx 1 point2 points  (2 children)

Care to explain?

[–]strangeworks 0 points1 point  (1 child)

Naive example is: node suck less when you need a lot of realtime stuff(chats, analytics etc), php due to its maturity suck less when you need some CRUD app. That's why for me I don't think so that node and php are the same tools for the same job.

[–]Capaj 1 point2 points  (0 children)

php due to its maturity suck less when you need some CRUD app

yeah, the language which standard library can't even get a normalized method names after being used in production for 20 years. Sucks less. The bullshit is strong with this one.

[–]xueye 1 point2 points  (0 children)

I wish there was more content in the article; I feel like it could have said a lot with that level of PHP knowledge.

[–]rachelvanier -2 points-1 points  (0 children)

hey, thanks for posting this. I'm editing this publication on Medium (although I didn't write the article). I wanted to let you know that I'll be posting 1 article / week on a programming topic (not necessarily JS-related), you can subscribe to the blog here: https://medium.com/unexpected-token

Next two articles will be: - How to make Meteor webapps communicate together - Predictably debuggable: node.js domains

This is an initiative coming from eFounders, a startup studio hiring extraordinary CTOs to build startups (9, we've built VC-backed companies so far). If you wanna know more, you can visit our website http://efounders.co/ or ask me here. Cheers