1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

JavaScript as a server-side language?

Discussion in 'General Programming Chat' started by jasgrey, Jun 5, 2014.

  1. jasgrey

    jasgrey Junior Member

    Joined:
    May 27, 2014
    Messages:
    166
    Likes Received:
    229
    I've found articles covering JS as a server-side language. Apparently there is a small cult following who believe JS to be able to be a server-side language. I'd like to believe that JS could replace Python or other server-side languages because it would be so much simpler to create a full website (front-end and back-end) with one central language.

    What do you think? Could/can Javascript be used for the same functionality of a real server-side programming language?

     
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,143
    It 's called Node.js - it is awesome and already adopted by giants in the enterprise, posing a direct threat to Java. To even compare its prospects with ... Python ... is an absurdity.
     
    • Thanks Thanks x 5
  3. Panther28

    Panther28 Elite Member

    Joined:
    May 2, 2010
    Messages:
    2,268
    Likes Received:
    3,405
    Occupation:
    Internet.
    Location:
    Internet.
    Why you say that? and what In your opinion is on the horizon that could be better than python?

    Cheers
     
  4. seeplusplus

    seeplusplus Power Member

    Joined:
    Aug 18, 2008
    Messages:
    511
    Likes Received:
    163
    Think I read it could be the end of Flash to.

    Bloomin hope so!!
     
  5. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,143
    Let me give you 2 examples without any fluff:

    http://yahooeng.tumblr.com/nodeweekly (yahoo 's engineering blog).

    https://www.paypal-engineering.com/2013/11/22/node-js-at-paypal/ (paypal 's engineering blog)
     
    • Thanks Thanks x 2
  6. bicyclethief

    bicyclethief Newbie

    Joined:
    May 29, 2014
    Messages:
    25
    Likes Received:
    8
    YouTube is written in Python.
    Reddit is written in Python.
    Google uses Python extensively.
    Bank of America is writing the majority of their new stuff in Python.

    Nothing against Node, but to dismiss Python out of hand like that is not reasonable. It is proven as a technical foundation for some of the world's most massive sites.
    Web programming is also only a single aspect of what Python is good at. It is rapidly growing as an important language for scientific computing.
     
    • Thanks Thanks x 1
    Last edited: Jun 8, 2014
  7. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,062
    Likes Received:
    2,872
    Gender:
    Male
    Yup node JS is rocking at the moment and they call it server side javascript. The best thing that I like about it is it's multi-threading capability. As for the developers, it's a new and cool technology and not a threat, but for the people who made other languages might consider it as a threat, not sure :eek:
     
  8. rob1977

    rob1977 Power Member

    Joined:
    Mar 25, 2013
    Messages:
    773
    Likes Received:
    666
    I do get what your saying, bicycle thief, I love python too, however the reviews of node.js in terms of speed and functionality are more than a little bit exciting.

    I have never touched c++ but I have read that we are in that vicinity when describing node.js without the lengthy processes.

    I done some node tutorials and a did like the fluidity of bringing javascript to the backend, and giving more depth of use to what I think was already a pretty cool and useful while somewhat limited language.
     
  9. Chris22

    Chris22 Regular Member

    Joined:
    Sep 29, 2010
    Messages:
    400
    Likes Received:
    1,059
    I thought nodejs was entirely single threaded?

    Async =/= multithreading
     
    • Thanks Thanks x 2
  10. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,062
    Likes Received:
    2,872
    Gender:
    Male
    Excuse my term I am a nodejs noob :p
    Yes, the term is "asynchronous" :eek:

    Execution time should be much lesser than php as I believe. Couldn't give it a try due to lack of time :(
     
    Last edited: Jun 8, 2014
  11. Chris22

    Chris22 Regular Member

    Joined:
    Sep 29, 2010
    Messages:
    400
    Likes Received:
    1,059
    Generally speaking the web server performs better, but that entirely depends on the code that is running. If the code written isnt completely async and blocks in some places (io, database, etc) then it causes the thread to block for longer which can severely impact performance if there are many connections.

    Edit: you should find some time for it, you'll be so glad you did
     
    • Thanks Thanks x 1
    Last edited: Jun 8, 2014
  12. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,143
    And lots more, no one said Python is irrelevant in today 's landscape. Python was a sensible choice in the past and will still be for a set of use cases, just like PHP isn't going anywhere for the small/mid size business for a loooong time.

    My assessment was about the future in the enterprise and as I see it Node 's approach has hit a sweet spot with regards to how the web 's services are evolving. That makes it a natural fit.

    That said, obviously Node is not "the one to rule them all" and is definitely a bad choice for some specific things (e.g. CPU intensive stuff). If I was the BoA CTO, I wouldn't swap my C++ core for Node either.

    As for scientific computing, I 'm not sure that 's an argument in favor of Python 's bright future, considering people still use ...FORTRAN there :)
     
  13. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,143
    Your code is run in a single thread . Behind it there 's also a pool of threads (the "event loop") that handles all the IO things asynchronously as far as your code 's flow is concerned.

    That 's the beauty of node 's architecture, it provides multithreaded advantages morphed into a single threaded form (poetic license, this isn't the proper technical description), which is much easier to work with .
     
    • Thanks Thanks x 2
  14. Gary Becks

    Gary Becks Power Member

    Joined:
    Apr 11, 2010
    Messages:
    675
    Likes Received:
    282
    Location:
    Atl
    Home Page:
    Everything you can do in node.js you could do years ago with python twisted/tornado . All of the hype surrounding node.js right now is due to the fact that you can write all your server/client code in one language which has opened the door to many front end only devs to quickly produce backends as well, does that make it great though? Nope, just makes the barrier to entry a lot easier hence the gazillion Web designers who have magically become full stack devs overnight since the inception of node.

    For me personally, node.js didn't live up to the hype for backend development. Been a year or so since I cheked it out but it just wasn't mature enough at the time, huge shortage of good libraries when compared the python or .net world. If/When I need async/parellel support on the server I'd rather opt for something more well suited for the task like like F#.

    In the end, if you do choose to go the node.js route, make sure you take a look a coffeescript. Takes a lot of the headaches out of maintaining a javascript codebase.

    Also, meteor.js seems like an interesting framework to play with.

    I myself am planning to spend some time learning angular.js for client side development in the coming months. http://channel9.msdn.com/Events/Build/2014/3-644 Really cool stuff. Mixed with one of the Baas providers like firebase building simple real time crud apps should be a cinch once you get the hang of it.
     
    • Thanks Thanks x 4
  15. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,062
    Likes Received:
    2,872
    Gender:
    Male
    That's a good post I must say. I got started with angular JS too. Seems pretty interesting.
    @thread
    Not sure, but when I first saw the video, the creator said that it wasn't too easy to debug the code bottlenecks back then. Has that improved? Would appreciate your expert opinion on that.
     
  16. Gary Becks

    Gary Becks Power Member

    Joined:
    Apr 11, 2010
    Messages:
    675
    Likes Received:
    282
    Location:
    Atl
    Home Page:
    I have not had time to get started with angular as of yet but I am pretty keen on having a chance to dive into it.

    The framework seems to have matured quite rapidly though, there's full support for it in both Visual Studio and Webstorm with a few different default templates to start from in both ides.

    There's also a google Dart version and loads of angular tutorials online to get you started.

    https://www.codeschool.com/code_tv/angular-js-part-1
    http://www.codecademy.com/courses/javascript-advanced-en-2hJ3J/0/4
    http://courses.tutsplus.com/search?search[keywords]=angular
    http://pluralsight.com/training/Courses/Find?highlight=true&searchTerm=angularjs

    Also, do check out http://angular-ui.github.io .

    Good luck with Angular, seems to me the future of building RIA's.
     
    • Thanks Thanks x 1
  17. jasgrey

    jasgrey Junior Member

    Joined:
    May 27, 2014
    Messages:
    166
    Likes Received:
    229
    I hope nobody minds if I resurrect this thread. It's not too old.

    I spent most of the last month and a half toying around with different languages. I dove into Python, swam around in a little PHP, gave Ruby a whirl, and also experimented with JavaScript. To be honest, JavaScript was the one that clicked the best with me. Also, in this time I have done quite a bit of design work and taken my design skills to a whole new level. (I still need practice, but comparatively, I'm 500% better than I was.) Being a designer, JavaScript is something I need to become fluent in anyways, so Node.Js, if it lives up to what I have read, may be a life-saver for me.

    ^I'm banking on this.

    That being said, having a basic grasp of JavaScript and a little bit of jQuery, I think that progressing with JavaScript and it's libraries is going to be my new hobby that may one day net me some profit. I'm not banking on the profit so much, but I've had so much fun working with basic JavaScript that it now actually bores the hell out of me to open up Photoshop or Illustrator. I want to continue in my learning, but I want to be assured that in learning JavaScript (and Node.Js in time) I can build full websites without having to start from scratch back in PHP/Ruby/Python. --If I ever do acquire clients for web design, I don't want to lose them because they want more than a static and interactive website. I don't want to lose them because I can't build them a site that allows their users to sign up and carry out what the site was dreamed of allowing them to do. I don't want to lose them because I can only make a pretty website that has an image that will grow 10% of it's size when you hover your mouse on it. -_-

    So, if there are no objections. Let's revisit this a little bit.
     
  18. lonelytty

    lonelytty Newbie

    Joined:
    Sep 16, 2011
    Messages:
    25
    Likes Received:
    11
    Occupation:
    IM
    Location:
    Brazil
    well i think yahoo and paypal are interested in nodes.js because both have apis that heavily relies on javascript for tracking/ ad placement etc
    so they are trying to implement that to speed up they existing code base, so nodes.js is the "right" technology for it but it might not be the best choice
    for other business models

    i can't post links yet but search for "quora Why did Koding switch from Node js to Go"

    i love python and webpy myself and, like any another language, you can code almost anything using python the only downside of python web programming is hosting prices
     
  19. closedCaption

    closedCaption Regular Member

    Joined:
    Oct 3, 2011
    Messages:
    289
    Likes Received:
    111
    I read the article and the conclusion is that guys at Koding screwed up their code.

    I also became interested in Node.js recently and am only thinking about this for one reason: to write everything in JS.

    While JS is completely ugly language IMO, it cannot be avoided on the client side and therefore I think that using it on server side is not such a bad decision.

    The other plus for Node.js is Paypal: those guys aren't stupid and their experiment shows everything went better when switching to Node.js. This, by itself,
    could be a valid reason to try this thing out on a serious project.
     
  20. jasgrey

    jasgrey Junior Member

    Joined:
    May 27, 2014
    Messages:
    166
    Likes Received:
    229