Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,743 members, 7,817,051 topics. Date: Saturday, 04 May 2024 at 01:10 AM

Javascript With NodeJS - Programming (5) - Nairaland

Nairaland Forum / Science/Technology / Programming / Javascript With NodeJS (16802 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)

Re: Javascript With NodeJS by micodon(m): 10:02pm On Apr 28, 2015
Whether JavaScript is a programming language or not is still under debate even by the very eŃ…perts.

What im 100% sure of is: if javascript wasnt a programming language prior to the birth of node, then Node doesnt make it a programming language. Node never changed the how Javascript runs. It only changed where it runs.

and FYI, Node aint the first to do this.

Quite easy for programmers to understand. it aint about the language. Programming paradigms are virtually same even though syntax may differ
Re: Javascript With NodeJS by Nobody: 10:03pm On Apr 28, 2015
pcguru1:


Well you are right and wrong, i will explain this reason above is wrong , this just compile C++ in JavaScript doesn't make Javascript a programming language and not a programming language. and Right in the sense that with Ecmascript 6 JavaScript has now classes,generators,modules and things you can find in a programming language. Then again no one is arguing that JavaScript is not a programming language, I only said the only reason why i feel it would not be considered a full one would have be lack of classes and Number precision issues.

Though i would be suprised if anyone in Nigeria actually uses Emscripten , its above our use-case by far.

I feel it is now a gray area as to whether a script today is a full programming language or not, this is because these scripts have been evolving over decades now and have grown far beyond what they were originally designed for.
I use JavaScript to write critical applications and then use AJAX to link to C# in the middle layer to connect to the back -end database. Now with Node.JS I can get to the back-end database with just JavaScript, so this was why I came up with the opinion that JavaScript is now a full programming language, though others may disagree.
Re: Javascript With NodeJS by micodon(m): 2:19am On Apr 29, 2015
Febup:


I feel it is now a gray area as to whether a script today is a full programming language or not, this is because these scripts have been evolving over decades now and have grown far beyond what they were originally designed for.
I use JavaScript to write life critical applications and then use AJAX to link to C# in the middle layer to connect to the back -end database. Now with Node.JS I can do without C# and get to the back-end database with just JavaScript, so this was why I came up with the opinion that JavaScript is now a full programming language, though others may disagree.

What is a programming language?
Re: Javascript With NodeJS by Nobody: 7:29pm On Apr 29, 2015
I was only comparing a scripting language with a programming language. The line between them are getting closer now, as a scripting language like JavaScript can now be compiled to machine code instead of being interpreted when it's just being used as a script.

In conclusion C# and Common Lisp should be crowned the king of programming languages, as they are the only two languages that are both: Imperative, Object-Oriented, Functional, Procedural, Generic, Reflective, Event-Driven as well as having other paradigms.
Re: Javascript With NodeJS by Nobody: 10:24pm On Apr 29, 2015
it would be good to see some cheap Nodejs hosting, I will wait for PHP7 and then compare them and see which can handle Real time connections and the amount of resources used. However Nodejs single thread would obviously use less. I have some ideas with Real time apps sadly laziness.
Re: Javascript With NodeJS by micodon(m): 8:40am On Apr 30, 2015
pcguru1:
it would be good to see some cheap Nodejs hosting, I will wait for PHP7 and then compare them and see which can handle Real time connections and the amount of resources used. However Nodejs single thread would obviously use less. I have some ideas with Real time apps sadly laziness.

You dont have to wait, bro. PHP with HHVM is already a killer. It destroys node completely in servers with more than one core. Because node is single-threaded, it can only use one core. Imagine, having a server with 8 cores, but you are only able to use one. i did a hack in my node app to get around this, tho'.

Out of the box, HHVM will use as many cores that are available. So which do you think is better for high concurrency?

You can also check PHPng
Re: Javascript With NodeJS by micodon(m): 8:57am On Apr 30, 2015
Febup:
I was only comparing a scripting language with a programming language. The line between them are getting closer now, as a scripting language like JavaScript can now be compiled to machine code instead of being interpreted when it's just being used as a script.

In conclusion C# and Common Lisp should be crowned the king of programming languages, as they are the only two languages that are both: Imperative, Object-Oriented, Functional, Procedural, Generic, Reflective, Event-Driven as well as having other paradigms.

1. All languages must be compiled change to machine code. ALL. Scripting languages like javascript are interpreted (thats why they are called scripts. they are read and interpreted) JavaScript falls into this category. Others are compiled once and for all.

2. A scripting language can also be a programming language. PHP, JavaScript, Python, Perl, etc are all scripting languages. They are programming languages too.

For emphasis,

They are called Scripting languages not because they aint programming languages but because they are interpreted at runtime.


In truth, You cant crown any language King. Some are good for some apps and bad for other apps

Pay attention to the following

Concurrency: GoLang, Erlang, Scala, Node, etc
High Performance: C, C++
Memory Management: Java, C#, etc
Ease of Use: Python, PHP

so, will i write a 3D game in C# when i know C++? WHY ON EARTH WOULD I DO THAT?

Thats just a rough draft. Thats y i'll advise any programmer to learn at least one in each category.

NB: if i was asked to pick one out of the above, it'll definitely be C++. i mean, when i can manage my memory myself...Access registers...pointers?
Re: Javascript With NodeJS by micodon(m): 8:59am On Apr 30, 2015
if (true) { int age = 30; }
int age = 35;


Please run the code above in C# and report your findings
Re: Javascript With NodeJS by jubichromes: 9:46am On Apr 30, 2015
Hi,
.Net Programmer wanted in an IT firm in Lagos. Candidates must be proficient in Asp.net MVC, javascript (angularjs and jquery) and also have an indepth knowledge about Html5 and Css3. Candidates should send their CV's to jubikromes@gmail.com for screening or call 08066702241/08038407269
Re: Javascript With NodeJS by Olumyco(m): 4:45pm On Apr 30, 2015
pcguru1:


Well you are right and wrong, i will explain this reason above is wrong , this just compile C++ in JavaScript doesn't make Javascript a programming language and not a programming language. and Right in the sense that with Ecmascript 6 JavaScript has now classes,generators,modules and things you can find in a programming language. Then again no one is arguing that JavaScript is not a programming language, I only said the only reason why i feel it would not be considered a full one would have be lack of classes and Number precision issues.

Though i would be suprised if anyone in Nigeria actually uses Emscripten , its above our use-case by far.

JavaScript has classes right from d time it was developed. Not just now wit Ecmascript6. Classes simply mean Types. Its just dat Classes is not a choice/prevalent word in JavaScript. Classes in JavaScript is referred to as Types or Data types. In JavaScript we av String class, number class, boolean class etc and even sub class.
Micon has already addressed d issue. Love d way he explained it. the interpretation issue is what make JavaScript a scripting lang.
JavaScript is not just becoming a programing lang. It is a programing lang right from time. Well not surprise abt d debate because it is often said dat javascript is d most misunderstood lang.
Even java does not do full compilation. Its compilation is done half way while d rest is interpreted. So a language can b a programming lang and at d same tym a scripting lang or just like java. Micon has listed some examples
Re: Javascript With NodeJS by Nobody: 7:30pm On Apr 30, 2015
micodon:

Pay attention to the following

Concurrency: GoLang, Erlang, Scala, Node, etc
High Performance: C, C++
Memory Management: Java, C#, etc
Ease of Use: Python, PHP

NB: if i was asked to pick one out of the above, it'll definitely be C++. i mean, when i can manage my memory myself...Access registers...pointers?

C# too gives you direct access to your computer memory if you need to do so, by using unmanaged code, take a look below, this is coming from Microsoft.

"Interop enables C# programs to do almost anything that a native C++ application can do. C# even supports pointers and the concept of unsafe code for those cases in which direct memory access is absolutely critical."
Source: https://msdn.microsoft.com/en-us/library/z1zx9t92.aspx
Re: Javascript With NodeJS by micodon(m): 10:25pm On Apr 30, 2015
Febup:


C# too gives you direct access to your computer memory if you need to do so, by using unmanaged code, take a look below, this is coming from Microsoft.

"Interop enables C# programs to do almost anything that a native C++ application can do. C# even supports pointers and the concept of unsafe code for those cases in which direct memory access is absolutely critical."
Source: https://msdn.microsoft.com/en-us/library/z1zx9t92.aspx

1. Memory access is different from memory management. all languages gives u certain access to memory.

2. the sham microsoft calls pointers are not true pointers. Disagree? try adding 2 pointers in c#.

3. What microsoft calls pointers are limited to value types and arrays.

4. what microsoft calls pointers, can only point to unmanaged types.

5. To use what microsoft calls pointers in c#, you need to be in an unsafe context (which by the way, is very much discouraged by Microsoft). This means that the code cannot be verified, and must be run from a trusted source. the implication? you cannot use pointers in apps that use the network. which app doesnt?

Need i go on? do more research, bro
Re: Javascript With NodeJS by Nobody: 10:38pm On Apr 30, 2015
micodon:


1. Memory access is different from memory management. all languages gives u certain access to memory.

2. the sham microsoft calls pointers are not true pointers. Disagree? try adding 2 pointers in c#.

3. What microsoft calls pointers are limited to value types and arrays.

4. what microsoft calls pointers, can only point to unmanaged types.

5. To use what microsoft calls pointers in c#, you need to be in an unsafe context (which by the way, is very much discouraged by Microsoft). This means that the code cannot be verified, and must be run from a trusted source. the implication? you cannot use pointers in apps that use the network. which app doesnt?

Need i go on? do more research, bro

Microsoft says "Interop enables C# programs to do almost anything that a native C++ application can do. C# even supports pointers and the concept of unsafe code for those cases in which direct memory access is absolutely critical."Source: https://msdn.microsoft.com/en-us/library/z1zx9t92.aspx

But you say it cannot ok we need Microsoft to join us here to sort this out.
Re: Javascript With NodeJS by micodon(m): 10:45pm On Apr 30, 2015
Febup:


Microsoft says "Interop enables C# programs to do almost anything that a native C++ application can do. C# even supports pointers and the concept of unsafe code for those cases in which direct memory access is absolutely critical."Source: https://msdn.microsoft.com/en-us/library/z1zx9t92.aspx

But you say it cannot ok we need Microsoft to join us here to sort this out.

you see? why wouldnt microsoft hype their product?

If C# can do what c++ can do, why is C++ used in writing windows. Hell, the windows kernel is written in C.

If c# can do it, Why didnt they use it to write the entire windows? their own creation.

Dude, dont just believe microsoft. theyre liars
Re: Javascript With NodeJS by micodon(m): 10:53pm On Apr 30, 2015
Visual studio written in C++ and C#

Microsoft office apps written in C++.

does this tell you that c# can do wat c++ can do?

Again, i admonish you to desist from just believing what you read from the net without trying it urself (at least where possible)
Re: Javascript With NodeJS by Nobody: 11:00pm On Apr 30, 2015
micodon:
Visual studio written in C++ and C#

Microsoft office apps written in C++.

does this tell you that c# can do wat c++ can do?

Again, i admonish you to desist from just believing what you read from the net without trying it urself (at least where possible)

It would be insane for Microsoft to rewrite their existing applications from scratch in a new language with C#.
Re: Javascript With NodeJS by micodon(m): 11:12pm On Apr 30, 2015
Febup:


It would be insane for Microsoft to rewrite their existing applications from scratch in a new language with C#.

How long do u think it will take them to write Microsoft Office from the scratch? 10years?

A few years ago, a microsoft tech said on quora that the reason why they still use c++ is because of unmanaged memory. they manually manage memory of their apps based on the system resources. but c# will do it the same way everywhere.

Microsoft started developing its new Spartan browser from scratch last year. i dont know in what language, but i do know that the rendering engine is built with C++.

Bro, microsoft knows. Efficiency, Performance, less use of resources, C++ is boss
Re: Javascript With NodeJS by wolexme(m): 8:28am On May 01, 2015
any site that doesn't use js in its frontend will look like a site in the web1.0 era. this is what passionate programmers won't like to settle for. with node, js is taken to the back end so that one lang can rule them all. I agree with febup that node will become web-based programmers' choice in the near future. what may hinder this is its small community. how many programmers write core JavaScript? .majority of the responsive UI you see use Js libraries and most of the developers don't care to understand vanilla JavaScript because the language is so weird. any technology that has stood the test of time had done so because of its large contributors. In a nutshell, if node must stand, it must attract more contributors from its growing community. that is what may sustain is relevance on the web.
Re: Javascript With NodeJS by Nobody: 10:32am On May 01, 2015
Yesterday a fellow colleague showed me something that blew my mind as in mega brain blown. We have a Java App that handles real time logging and stuff and the app consumes a lot of memory almost a 1gb the equivalent in go had a memory footprint of 1mb or even less. He said the JVM might be the culprit.
Re: Javascript With NodeJS by micodon(m): 10:38am On May 01, 2015
pcguru1:
Yesterday a fellow colleague showed me something that blew my mind as in mega brain blown. We have a Java App that handles real time logging and stuff and the app consumes a lot of memory almost a 1gb the equivalent in go had a memory footprint of 1mb or even less. He said the JVM might be the culprit.

I was just reading about go this morning. Mehn....its too good. a beauty of it is that you can use it both on server side and client side with gopher js.

and its tutorial is about 40pages. We might have a king after all
Re: Javascript With NodeJS by Nobody: 10:42am On May 01, 2015
micodon:


I was just reading about go this morning. Mehn....its too good. a beauty of it is that you can use it both on server side and client side with gopher js.

and its tutorial is about 40pages. We might have a king after all

The guy is a Senior Architecture so his job is always about Tech that scale and doesn't crash the server, He's a Java person as in he's f.cuking good but he says go is it for him anytime. anyway sha my eyes are on it and it's no single thread like Node which is good.

meanwhile if you are on Linux you should try geeting VScode Microsoft editor for Linux downloading it now for TypeScript as WebStorm support for TS is just there.
Re: Javascript With NodeJS by micodon(m): 11:52am On May 01, 2015
pcguru1:


The guy is a Senior Architecture so his job is always about Tech that scale and doesn't crash the server, He's a Java person as in he's f.cuking good but he says go is it for him anytime. anyway sha my eyes are on it and it's no single thread like Node which is good.

meanwhile if you are on Linux you should try geeting VScode Microsoft editor for Linux downloading it now for TypeScript as WebStorm support for TS is just there.

Yea, i use Ubuntu. Will check it out. Thanks man
Re: Javascript With NodeJS by abubaka101: 3:30pm On May 01, 2015
It's good to note that all the tension and brawl that existed here up till page 3 is gone.
But I've got a question. You guys are raising some very high level talks here that is so rare or hardly talked about.
It's definitely not the usual web devt talk elsewhere, where words/concepts are substituted with code. Rather, you guys are talking more concepts than code.
How can one knw these concepts? Because the truth is, I learnt all I knw on my own, nw I do ASP.NET C#. But nowhere in my tutorial was speed, or resource efficency or memory management even talked about.
So how do I know these concepts to make my programming more efficient?
Re: Javascript With NodeJS by Nobody: 4:16pm On May 01, 2015
abubaka101:
It's good to note that all the tension and brawl that existed here up till page 3 is gone.
But I've got a question. You guys are raising some very high level talks here that is so rare or hardly talked about.
It's definitely not the usual web devt talk elsewhere, where words/concepts are substituted with code. Rather, you guys are talking more concepts than code.
How can one knw these concepts? Because the truth is, I learnt all I knw on my own, nw I do ASP.NET C#. But nowhere in my tutorial was speed, or resource efficency or memory management even talked about.
So how do I know these concepts to make my programming more efficient?

It's because of where i work, and also you don't need to know these terms by force eventually it will come, there are times before you code you need to ensure the arhictecture is good. despite what you see here we are all learning and i'd be glad to share my knowledge with you and yours with me. as ASP.NET MVC was a platform i enjoyed working on. but what's your C# knowledge ? out of curiosity this is for something else.
Re: Javascript With NodeJS by micodon(m): 9:02pm On May 01, 2015
abubaka101:
It's good to note that all the tension and brawl that existed here up till page 3 is gone.
But I've got a question. You guys are raising some very high level talks here that is so rare or hardly talked about.
It's definitely not the usual web devt talk elsewhere, where words/concepts are substituted with code. Rather, you guys are talking more concepts than code.
How can one knw these concepts? Because the truth is, I learnt all I knw on my own, nw I do ASP.NET C#. But nowhere in my tutorial was speed, or resource efficency or memory management even talked about.
So how do I know these concepts to make my programming more efficient?

As Pcguru1 has stated, When you want to build an app, you would want to find the best architecture for the job. Both out of experience and research.

So, if i want to build something like a social network, i break down the requirements like so

1. Concurrency
2. File Sharing
3. Server sharding and data replication
4. Event driven (SSE, PubSub, etc)

So whats the best possible software stack and hardware architecture that will solve these issues without been intrusive and hard to work with.

When i dont know, i go to the web and see what others have done.

As we are all learning, Stackoverflow, quora and Highscalabilty are some of the best sites i visit.

in a nutshell, a breakdown of the requirements is a first step. Research is more or less second.
Re: Javascript With NodeJS by abubaka101: 10:38am On May 02, 2015
pcguru1:


It's because of where i work, and also you don't need to know these terms by force eventually it will come, there are times before you code you need to ensure the arhictecture is good. despite what you see here we are all learning and i'd be glad to share my knowledge with you and yours with me. as ASP.NET MVC was a platform i enjoyed working on. but what's your C# knowledge ? out of curiosity this is for something else.

I am developing in ASP.NET WebPages model with d Razor syntax. Am still learning though, so my C# knowledge is still pretty basic. But am striving to learn.
I am developing an E-commerce website from scratch with dis model. And when I know that I understand all what I've done, I hope to migrate it to d MVC model thereafter.
Re: Javascript With NodeJS by Nobody: 10:45am On May 02, 2015
micodon:


if (true)
{
int age = 30;
}

int age = 35;

Please run the code above in C# and report your findings

Got an error, see below. Were you trying to demonstrate closure in C#?

Error: A local variable named 'age' cannot be declared in this scope because it would give a different meaning to 'age', which is already used in a 'child' scope to denote something else
Re: Javascript With NodeJS by micodon(m): 11:11am On May 02, 2015
Febup:


Got an error, see below. Were you trying to demonstrate closure in C#?

Error: A local variable named 'age' cannot be declared in this scope because it would give a different meaning to 'age', which is already used in a 'child' scope to denote something else


1. that is not a closure. Its not even close to a closure.

2. i was just trying to show you how Microsoft were desperate to replace C++ with a modern language that they overthought, and made unforgivable design flaws

Why the heck cant one declare a variable in a conditional block and access it outside?

NB: The above is not a microsoft mistake in C#. its the way C# was designed.
Re: Javascript With NodeJS by Nobody: 12:03pm On May 02, 2015
micodon:

1. that is not a closure. Its not even close to a closure.

2. i was just trying to show you how Microsoft were desperate to replace C++ with a modern language that they overthought, and made unforgivable design flaws

Why the heck cant one declare a variable in a conditional block and access it outside?

NB: The above is not a microsoft mistake in C#. its the way C# was designed.

The code you posted relates to a scope so its not far from Closure which C# supports. But why would I need to access a value in conditional statement from outside of it, I have never had the need to do so.

C++ cannot handle dll hell, but you don't have this issue in C#.
Memory leak is very common in C++ applications but you don't get that in C# applications.
C++ does not support reflection but C# does by allowing you to declare objects at run-time and not just at design time.

C# supports rapid application development for business applications and it does the job well, without having to worry about dll hell or memory leak like you do in C++. When it comes to developing a system then using C++ would be the prefer choice.
Re: Javascript With NodeJS by micodon(m): 12:25pm On May 02, 2015
Febup:


The code you posted relates to a scope so its not far from Closure which C# supports. But why would I need to access a value in conditional statement from outside of it, I have never had the need to do so.

C++ cannot handle dll hell, but you don't have this issue in C#.
Memory leak is very common in C++ applications but you don't get that in C# applications.
C++ does not support reflection but C# does by allowing you to declare objects at run-time and not just at design time.

C# supports rapid application development for business applications and it does the job well, without having to worry about dll hell or memory leak like you do in C++. When it comes to developing a system then using C++ would be the prefer choice.


Bros, where do you get ur infos from?

1. Scope has to do with accessibility of variables, objects, functions etc. Virtually every line of code you write has a scope. The code above, is not in anyway related to a closure. It is a conditional statement
Re: Javascript With NodeJS by Nobody: 12:30pm On May 02, 2015
micodon:


1. Scope has to do with accessibility of variables, objects, functions etc. Virtually every line of code you write has a scope. The code above, is not in anyway related to a closure. It is a conditional statement

Closure gives you access to a variable even when it has gone out of scope. The code you posted involves accessing a variable, which made me to ask you if you were referring to a closure. I don't have a need for the code you posted so there was nothing wrong in asking you what you were referring to
Re: Javascript With NodeJS by micodon(m): 12:38pm On May 02, 2015
Febup:


The code you posted relates to a scope so its not far from Closure which C# supports. But why would I need to access a value in conditional statement from outside of it, I have never had the need to do so.


Are you sure you do program? Why wouldnt you need access to a value in a conditional statement?

Let me give you a simple example.

Imagine that you have to display the name "guest" for users that are not logged in OR the user name for logged in users. Here's a code snippet using laravel


<?php
if (Auth::check()){
$name = Auth::user()->name;
} else {
$name = "Guest";
}

echo "Welcome " . $name;
?>


OR

<?php
$name = "Guest";

if (Auth::check()) {
$name = Auth::user()->name;
}

echo $name;
?>


you cant tell me that you write codes and you ve not had the need to access a value in a conditional statement from outside it

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

Which Is The Best Place To Learn Programming In Nigeria? / Front-End Developer Or Back-End Developer: Which Job Title Has A Higher Salary? / 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. 92
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.