Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,663 members, 7,809,510 topics. Date: Friday, 26 April 2024 at 10:43 AM

Javascript With NodeJS - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Javascript With NodeJS (16774 Views)

Lets Start A Real Web-deveopment Course Here Html+css+javascript+php+mysql / Which is more awesome to use for 'server-side programming', NodeJS or PHP? / Javascript In One PIX: Understand Javascript With Just A LOOK (2) (3) (4)

(1) (2) (3) (4) (5) (6) (7) (Reply) (Go Down)

Javascript With NodeJS by Nobody: 2:29am On Apr 10, 2015
With JavaScript Node.js you can now write your program both server side and client side with JavaScript for both web and console applications, it can also handle asynchronous programming and comes with database connectors.

JavaScript may soon become the preferred languages for web application development.

Drop your take on this.
Re: Javascript With NodeJS by fromnigeria(m): 4:20am On Apr 10, 2015
Its a welcomed development, even though we are still struggling to gain insight into prgramming.

1 Like

Re: Javascript With NodeJS by thewebcraft(m): 8:46am On Apr 10, 2015
Yes JavaScript is now a programming language, I've used it to build app, desktop softwares & websites but its impossible to say it can be king of other languages.
Node.js was written in C++, V8 compiles JavaScript source code to native machine code instead of interpreting it in real time.

1 Like

Re: Javascript With NodeJS by Nobody: 11:31am On Apr 11, 2015
^^^
Yea C and C++ are the Mother of all third-generation programming languages. But of the others for web application development I feel JavaScript Node.JS might become the preferred language, owing to the ease of displaying your data directing with HTML or DIV Tags from your back-end data source, using JavaScript.
Re: Javascript With NodeJS by micodon(m): 12:55pm On Apr 11, 2015
Febup:
^^^
Yea C and C++ are the Mother of all third-generation programming languages. But of the others for web application development I feel JavaScript Node.JS might become the preferred language, owing to the ease of displaying your data directing with HTML or DIV Tags from your back-end data source, using JavaScript.

If Javascript wasnt a programming language prior to the birth of NodeJS, you cant call it a programming language now.

NodeJS is a software that makes JavaScript run on the server-side. JavaScript in itself did not change. Node just changed the way JavaScript is run. Say Node is like apache and php combined.

About becoming the preferred language of the web,i highly doubt that. PHP was created in 1994. 6 yrs later a greater percentage of the dynamic web was built with PHP. Python 2.0 was released in 2000. 6 years later large number of apps on the web are python powered. NodeJs was released in 2009. 6 yrs later, only a relatively few node powered apps have been deployed to the real world.

When PHP 7 is released with its async and non blocking I/O, it will be a knockout blow to node.

FYI, i do php, python, RoR, Node etc

1 Like

Re: Javascript With NodeJS by Nobody: 1:45pm On Apr 11, 2015
^^^
Every other language have a software that allows them to run on the server side and JavaScript is no different now with Node.JS
- For Java you Need a JVM
- For C# you need .Net
- etc

The ease of using JavaScript from front-end to back-end is what will make it a preferred programming language for the web in the next few years.

1 Like

Re: Javascript With NodeJS by micodon(m): 2:14pm On Apr 11, 2015
Febup:
^^^
Every other language have a software that allows them to run on the server side and JavaScript is no different now with Node.JS
- For Java you Need a JVM
- For C# you need .Net
- etc

The ease of using JavaScript from front-end to back-end is what will make it a preferred programming language for the web in the next few years.

WRONG!!! WRONG!! WRONG!!.

JVM (JAVA VIRTUAL MACHINE) is not a server. it emulates a virtual machine that interpretes Java bytecode to your system's processor.

To run Java on the server, you need to use jsp on servers like tomcat.

.NET is not a server. it's a very advanced framework in the same way codeigniter and laravel are frameworks for PHP, RoR for ruby and Web2py for python.

To run c# on the server, you need to use asp or asp.net on the iis server.

now to the main point, ease of use doesnt ensure reliability. will nodejs still be maintained after 20 years? how large and active is its community? does it do what other pre existing and popular software stacks cant do? you need to ask these questions before you declare that node will be the defacto standard for the dynamic web. it has been here for close to 6 years but its explosive growth has stopped while others that are there are still continuing.

Facebook compiles PHP into c. why? why dont they move straight to c? why did they have to produce hhvm (which is faster than node).

You see, real programmers dont prefer ease to reliability, backwards compatibility, active community and all the rest.

im not saying node isnt good. its magnificent at what it does. but will it ever be the most widely used server stack in the world? No. the real deal may well be golang. say i told you so

1 Like

Re: Javascript With NodeJS by Nobody: 2:37pm On Apr 11, 2015
^^^
JSP still needs JVM.
JSP allows Java code and certain pre-defined actions to be interleaved with static web markup content, with the resulting page being compiled and executed on the server to deliver a document. The compiled pages, as well as any dependent Java libraries, use Java bytecode rather than a native software format. Like any other Java program, they must be executed within a Java virtual machine (JVM) that integrates with the server's host operating system to provide an abstract platform-neutral environment. Source:http://en.wikipedia.org/wiki/JavaServer_Pages

.Net Framework too has software that allows C# to run on the server.

All languages needs another software to allow them the run on the server unless maybe you code directly in binary

I still feel JavaScript with Node.JS will be the preferred language of the web in future, as it allows you to use Javascript from front-end to
back-end
Re: Javascript With NodeJS by micodon(m): 2:55pm On Apr 11, 2015
Febup:
^^^
JSP still needs JVM.
JSP allows Java code and certain pre-defined actions to be interleaved with static web markup content, with the resulting page being compiled and executed on the server to deliver a document. The compiled pages, as well as any dependent Java libraries, use Java bytecode rather than a native software format. Like any other Java program, they must be executed within a Java virtual machine (JVM) that integrates with the server's host operating system to provide an abstract platform-neutral environment. Source:http://en.wikipedia.org/wiki/JavaServer_Pages

.Net Framework too has software that allows C# to run on the server.

All languages needs another software to allow them the rum on the server unless maybe you code directly in binary

I still feel JavaScript with Node.JS will be the preferred language of the web in future, as it allows you to use Javascript from front-end to
back -end


Dude, you are totally wrong.
1. Java and JSP are not the same.
2. JSP does not have JVM built in. JSP is like PHP as ur wikipedia page tells you.
3. whether JSP requires JVM or not does not make JVM a server. JVM can be viewed like ur php interpreter.
HECK!!! Do you even know what a server is? Is the PHP lang parser and interpreter a server? is the ruby engine a server? is the V8 engine a server? bro, do more research.

4. .Net framework has no software that makes C# run on the server. Its a framework for God's sake. To run a c# code on a server, you need to embed it into a asp or asp.net app and run it via the Microsoft IIS server.

Go and learn what a server is and how it does what it does
Re: Javascript With NodeJS by micodon(m): 3:15pm On Apr 11, 2015
On a second thought let me make it easy for you.

you have a JSP script, JVM and Tomcat.

i visit localhost where the jsp script is located. Tomcat (the server), accepts the request, knows what resource i want to access, and fetches it.

now, its intelligent enough to know that The computer on its own doesnt know jack (it understands machine language) about the jsp script. so the computer on its own cant render to me, what the programmer says it should render to me.

Tomcat then sends the content of the script and all dependencies to the JVM. JVM gets it, parses and interpretes it into a language the computer can understand. sends to the computer, the computer reads, understands and performs whatever action the prgrammer programmed the script to do.

The result is sent back to Tomcat, Tomcat forwards it to the port where the request was made. and you have a rendered webpage

As you can see, what Tomcat (or any other server) does, is to receive request for resources and send back responses.

its the reason why PHP, ruby, python and others run server side. To be able to use their respective interpreters to make the computer understand whatever the programmer has programmed.

Javascript is able to run on the client, because the browsers have their respective interpreters in built. Chrome uses google's v8 engine.

Bros JVM and .Net framework are not servers
Re: Javascript With NodeJS by Nobody: 3:22pm On Apr 11, 2015
Yep Micodon is right you need to a Container like Tomcat,GlassFish , IBM Websphere or so am not sure, JVM just intepretes and has no nothing to do with Server or servlets.

.NET Framework hmmmm frankly i'm not sure how it explain this i know it allows different MS techs to run together you still need IIS for the Server side.

but regardless i think he meant you can't escape not using JVM then again not sure how one can run Java without a JVM so the talk of JVM shouldn't be brought up.

3 Likes 1 Share

Re: Javascript With NodeJS by micodon(m): 3:27pm On Apr 11, 2015
pcguru1:
Yep Micodon is right you need to a Container like Tomcat,GlassFish , IBM Websphere or so am not sure, JVM just intepretes and has no nothing to do with Server or servlets.

.NET Framework hmmmm frankly i'm not sure how it explain this i know it allows different MS techs to run together you still need IIS for the Server side.

but regardless i think he meant you can't escape not using JVM then again not sure how one can run Java without a JVM so the talk of JVM shouldn't be brought up.

you know your onions, bro.
Re: Javascript With NodeJS by Nobody: 3:33pm On Apr 11, 2015
@micodon

Check my post it says JSP still needs JVM. I did not say JVM was a sever, all I wrote was that Java needs JVM to run on the server.

Third generation Languages for web development needs a software or framework to run on a server. JVM, JSP, .Net Framework etc are made up of software. So Node.JS is no defferent.

There is really no need for this argument, but the main point here is that with Node.JS, JavaScript can run on a server and for that reason it will become the preferred language for web application development.
Re: Javascript With NodeJS by micodon(m): 3:55pm On Apr 11, 2015
Febup:
@micodon

Check my post it says JSP still needs JVM. I did not say JVM was a sever, all I wrote was that Java needs JVM to run on the server.

Third generation Languages for web development needs a software or framework to run on a server. JVM, JSP, .Net Framework etc are made up of software. So Node.JS is no defferent.

There is really no need for this argument, but the main point here is that with Node.JS with JavaScript can run on a server and for that reason it will become the preferred language for web application development.


when will it become?
Re: Javascript With NodeJS by larisoft: 4:07pm On Apr 11, 2015
pcguru1:
Yep Micodon is right you need to a Container like Tomcat,GlassFish , IBM Websphere or so am not sure, JVM just intepretes and has no nothing to do with Server or servlets.

.NET Framework hmmmm frankly i'm not sure how it explain this i know it allows different MS techs to run together you still need IIS for the Server side.

but regardless i think he meant you can't escape not using JVM then again not sure how one can run Java without a JVM so the talk of JVM shouldn't be brought up.

baba...its always a pleasure running into ur post

1 Like

Re: Javascript With NodeJS by Nobody: 4:22pm On Apr 11, 2015
Febup:
@micodon

Check my post it says JSP still needs JVM. I did not say JVM was a sever, all I wrote was that Java needs JVM to run on the server.

Third generation Languages for web development needs a software or framework to run on a server. JVM, JSP, .Net Framework etc are made up of software. So Node.JS is no defferent.

There is really no need for this argument, but the main point here is that with Node.JS with JavaScript can run on a server and for that reason it will become the preferred language for web application development.


obviusly the moment you say Java, JVM is implied its not meant to even be mentioned. Also i think JavaScript is over-rated i've made a gradual shift to TypeScript I prefer TS to JS, for JavaScript to be used in the Enterprise you need predictability the ability for the system to easily infer the Data type (Static Language).

Because JavaScript would causes alot of Development time as things can only be determined at runtime. Frankly i love JavaScript but you should remember JavaScript is not really running the show here, its only be used to communicate to other platforms which is the role of the Google V8 Engine. I don't really see JavaScript as full programming language i only see it as a good tool to talk to other

NodeJS is still C++ it only compiles JS into C++ just the same way PHP is done except PHP is interpreted on the fly
Unity uses JS to talk to it whatever language it uses
Qt uses JavaScript to communicate with C++

Am not saying JS isn't qualified to one but now pending i won't call it one pending when EcmaScript 6 comes out then i can say maybe... just maybe for now it doesn't come close to even Python , never used Python order than as an errand boy thing but that's a language it talks to anything and can do a whole lot than JS, I saw a colleague use Python to configure an environment and setting up resources to run a Java Application. i throw salute for air shocked
Re: Javascript With NodeJS by Nobody: 4:25pm On Apr 11, 2015
Sorry i meant Ruby not Python its was Chef but Python can do the same too
Re: Javascript With NodeJS by Nobody: 4:43pm On Apr 11, 2015
@micodon and pcguru1

The reason I started this thread was after I came across the Node.Js to MySQL connector code below. So for web application development I'm sure JavaScript with Node.JS will become the preferred language for web developers soon.

npm install mysql
var mysql = require('mysql');

var mysql = require('mysql');
var pool = mysql.createPool({
host : “hostName”,
user : “username”,
password: “password”
});

var connection = mysql.createConnection({
host : “hostName”,
user : “username”,
password: “password”
});
http://www.thegeekstuff.com/2014/01/mysql-nodejs-intro/
Re: Javascript With NodeJS by Nobody: 4:53pm On Apr 11, 2015
Febup:
@micodon and pcguru1

The reason I started this thread was after I came across the Node.Js to MySQL connector code below. So for web application development I'm sure JavaScript with Node.JS will become the preferred language for web developers soon.

npm install mysql
var mysql = require('mysql');

var mysql = require('mysql');
var pool = mysql.createPool({
host : “hostName”,
user : “username”,
password: “password”
});

var connection = mysql.createConnection({
host : “hostName”,
user : “username”,
password: “password”
});
http://www.thegeekstuff.com/2014/01/mysql-nodejs-intro/

Yeah it will Node.js is actually moving into Enterprise Fast Fast, its consumes less resources than PHP its one reason i like it and also the fact that doing real-time application is quite easy. Febup try Sailjs you will like it. Its even used in Desktop Application node-webkit. I've touched my hands into all this things sadly am not somehow who thinks of solutions i can only think of stacks to build solutions so I tend to use them for running normal tasks on my system. cry

look at JXCore a colleague told me about it, but nah i don't see the essence of it
Re: Javascript With NodeJS by micodon(m): 5:21pm On Apr 11, 2015
Febup:
@micodon and pcguru1

The reason I started this thread was after I came across the Node.Js to MySQL connector code below. So for web application development I'm sure JavaScript with Node.JS will become the preferred language for web developers soon.

npm install mysql
var mysql = require('mysql');

var mysql = require('mysql');
var pool = mysql.createPool({
host : “hostName”,
user : “username”,
password: “password”
});

var connection = mysql.createConnection({
host : “hostName”,
user : “username”,
password: “password”
});
http://www.thegeekstuff.com/2014/01/mysql-nodejs-intro/

Nodejs is 6years old. its gone nowhere. it has its own problems. try callbacks in node.

With Tornado, python matches nodejs, and is more elegant.
with hhvm or phpng, php beats nodejs in requests per second. php 7 will come with async functionality.
Erlang is the king of concurrency

NOW THE ISSUE IS: ALL THESE ARE ALREADY SO POPULAR. SO, IF NODE DOESNT DO ANYTHING NEW, WHY WILL IT BECOME THE PREFERRED LANGUAGE FOR THE WEB?

The only people that will switch to node are those whose apps specifically require node type structure or just enthusiasts.

For example i built an app that uses PHP as the core but used nodejs for realtime updates.
Facebook uses Php for its core but uses Erlang for its chat.

Morale is, People wont switch. Especially when PHP7 is released
Re: Javascript With NodeJS by Nobody: 5:45pm On Apr 11, 2015
micodon:


Nodejs is 6years old. its gone nowhere. it has its own problems. try callbacks in node.

With Tornado, python matches nodejs, and is more elegant.
with hhvm or phpng, php beats nodejs in requests per second. php 7 will come with async functionality.
Erlang is the king of concurrency

NOW THE ISSUE IS: ALL THESE ARE ALREADY SO POPULAR. SO, IF NODE DOESNT DO ANYTHING NEW, WHY WILL IT BECOME THE PREFERRED LANGUAGE FOR THE WEB?

The only people that will switch to node are those whose apps specifically require node type structure or just enthusiasts.

For example i built an app that uses PHP as the core but used nodejs for realtime updates.
Facebook uses Php for its core but uses Erlang for its chat.

Morale is, People wont switch. Especially when PHP7 is released

You do have a point especially at a time when the Node community is even divided amongst itself io.js and the Nodejs, didn't know PHP7 was supporting async. people would still use NodeJs because of the JavaScript option. as for Callback Hell I always advocate for Promises its way easier.
Re: Javascript With NodeJS by micodon(m): 5:58pm On Apr 11, 2015
pcguru1:


You do have a point especially at a time when the Node community is even divided amongst itself io.js and the Nodejs, didn't know PHP7 was supporting async. people would still use NodeJs because of the JavaScript option. as for Callback Hell I always advocate for Promises its way easier.

Callback hell...people dont wanna learn. promises, i learned the hard way.

PHP 7 will supports async programming, non blocking i/o.
it will come with a JIT engine. another killer
it will have a multi threaded web server (so concurrency issues will be dealt with).

Why then will i port to node if im already using php?

even now, there re libraries that ll give node a run for its money when it comes to async i/o.....you can take a look at react PHP and RatchetPHP
Re: Javascript With NodeJS by Nobody: 6:04pm On Apr 11, 2015
micodon:


Nodejs is 6years old. its gone nowhere. it has its own problems. try callbacks in node.

With Tornado, python matches nodejs, and is more elegant.
with hhvm or phpng, php beats nodejs in requests per second. php 7 will come with async functionality.
Erlang is the king of concurrency

NOW THE ISSUE IS: ALL THESE ARE ALREADY SO POPULAR. SO, IF NODE DOESNT DO ANYTHING NEW, WHY WILL IT BECOME THE PREFERRED LANGUAGE FOR THE WEB?

A lot has changed since its was first released six years ago.

Nodejs now supports asynchronous processing. It has a package manager called npm like NuGet Package Manager in .Net this allows you to download over 50 thousand free tools from the npm web server here is their website: https://www.npmjs.com/
Re: Javascript With NodeJS by micodon(m): 6:15pm On Apr 11, 2015
Febup:


A lot has changed since its was first released six years ago.

Nodejs now supports asynchronous processing. It has a package manager called npm like NuGet Package Manager in .Net this allows you to download over 50 thousand free tools from the npm web server here is their website: https://www.npmjs.com/




Bros i know nodejs well. i develop applications in it too. February this year i completed a very large app in nodejs. it has always supported async processing. it has always used npm. in fact its almost impossible to work with node without using npm.
Re: Javascript With NodeJS by valenu(m): 8:48pm On Apr 11, 2015
That's welcome
Re: Javascript With NodeJS by Nobody: 9:12pm On Apr 11, 2015
micodon:


Nodejs is 6years old. its gone nowhere. it has its own problems. try callbacks in node.

Do you mean NodeJs does not support callbacks? If so then what about this example below:

var myCallback = function(data) {
console.log('got data: '+data);
};

var usingItNow = function(callback) {
callback('get it?');
};
Now open node or browser console and paste the above definitions.

Finally use it with this next line:

usingItNow(myCallback);

http://stackoverflow.com/questions/19739755/nodejs-callbacks-simple-example
Re: Javascript With NodeJS by micodon(m): 10:25pm On Apr 11, 2015
Febup:


Do you mean NodeJs does not support callbacks? If so then what about this example below:

var myCallback = function(data) {
console.log('got data: '+data);
};

var usingItNow = function(callback) {
callback('get it?');
};
Now open node or browser console and paste the above definitions.

Finally use it with this next line:

usingItNow(myCallback);

http://stackoverflow.com/questions/19739755/nodejs-callbacks-simple-example

I see that you know little about nodejs. I never said nodejs doesnt support callbacks.

Have you heard of 'callback hell' in nodejs? google it, and you ll know wat i mean.

and how can u go about hyping stuff u know little about?
Re: Javascript With NodeJS by Nobody: 10:43pm On Apr 11, 2015
micodon:


I see that you know little about nodejs. I never said nodejs doesnt support callbacks.

Have you heard of 'callback hell' in nodejs? google it, and you ll know wat i mean.

and how can u go about hyping stuff u know little about?

I use JavaScript a lot with AJAX for an advanced .Net wed application so the concept of NodeJs alone makes me to believe that JavaScript with NodeJs will become the preferred web language for wed developers soon as the technology keeps evolving.

1 Like

Re: Javascript With NodeJS by Nobody: 12:58am On Apr 12, 2015
Febup:


I use JavaScript a lot with AJAX for an advanced .Net wed application so the concept of NodeJs alone makes me to believe that JavaScript with NodeJs will become the preferred web language for wed developers soon as the technology keeps evolving.

The questions and statements you make are strange you said Nodejs now supports async which is wrong because it was built with async in mind and npm was built when node started. I don't think you really know much about node Nodejs uses js so it would be silly for anyone to even argue on callbacks. You should read more on a platform before arguing on it.
Re: Javascript With NodeJS by Nobody: 1:58am On Apr 12, 2015
^^^
npm package manager was introduced in 2011.

I'll like to share this with you:

And then, I ran the apache benchmarking tool on both of them with 2000 requests (200 concurrent). When I saw the time stats of the result, I was astounded:

#PHP:
Concurrency Level: 200
Time taken for tests: 574.796 seconds
Complete requests: 2000

#node.js:
Concurrency Level: 200
Time taken for tests: 41.887 seconds
Complete requests: 2000

The truth is out. node.js was faster than PHP by more 14 times! These results are astonishing. It simply means that node.js IS going to be THE de-facto standard for writing performance driven apps in the upcoming future, there is no doubt about it!

http://blog.prahladyeri.com/2014/06/php-vs-node-js-real-statistics.html
Re: Javascript With NodeJS by Nobody: 4:26am On Apr 12, 2015
Febup:
^^^
npm package manager was introduced in 2011.

I'll like to share this with you:

And then, I ran the apache benchmarking tool on both of them with 2000 requests (200 concurrent). When I saw the time stats of the result, I was astounded:

#PHP:
Concurrency Level: 200
Time taken for tests: 574.796 seconds
Complete requests: 2000

#node.js:
Concurrency Level: 200
Time taken for tests: 41.887 seconds
Complete requests: 2000

The truth is out. node.js was faster than PHP by more 14 times! These results are astonishing. It simply means that node.js IS going to be THE de-facto standard for writing performance driven apps in the upcoming future, there is no doubt about it!

http://blog.prahladyeri.com/2014/06/php-vs-node-js-real-statistics.html

No one argued Node wasn't faster than PHP maybe you should try evaluating Go and NodeJS
Re: Javascript With NodeJS by Nobody: 5:00am On Apr 12, 2015
^^^
I just like the fact NodeJS uses JavaScipt syntax.

(1) (2) (3) (4) (5) (6) (7) (Reply)

Front-End Developer Or Back-End Developer: Which Job Title Has A Higher Salary? / Which Is The Best Place To Learn Programming In Nigeria? / I Want My Son To Be A Programmer, How Do I Go About It

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 104
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.