[Hamara-devel] Fwd: Re: [pulug] Fwd: Django Or Mean?

shirish shirish at hamaralinux.org
Wed May 27 17:09:05 BST 2015


addition at bottom :-


-------- Forwarded Message --------
Subject: Re: [pulug] Fwd: Django Or Mean?
Date: Sun, 24 May 2015 01:57:52 +0530
From: Supreet Pal Singh <supreetpal at gmail.com>
Reply-To: pulug at googlegroups.com
To: PULUG <pulug at googlegroups.com>

This thread has some misconceptions that I would like to clear.

In short, if a person knew JavaScript and Python equally well he would 
not think twice before picking MEAN. MEAN is better and it is no longer 
a question of what you prefer but how the architecture is designed.

Inline comments will simply state "it is better", at the end I shall
explain why it is better. Also, it seems like you are thinking entirely
from a job perspective instead of 'what should i prefer to build my thing'.

Each technology stack has companies which have invested deeply in them.
There are companies running backends on Java, PHP, Python and JS. If you
are able to practise and implement any of them well, you will not have a
problem finding a job. However, JS being the new popular kid on the 
block has a relatively high demand due to a relatively low supply. But 
this may change sooner than we think.

On Sat, May 23, 2015 at 12:50 PM, Ankit Bhatnagar <
ankitbhatnagar2012 at gmail.com> wrote:

> People,
>
> I happened to have answered this query from a friend. Thought I'd share it
> here, since it addresses a popular concern.
>
> tl;dr. The hype around JS is definitely worth it. Comments most welcome! :)
>
> Here goes :-
>
> btw. MEAN is an acronym for MongoDB, Express, Angular, Node. It is one of
> the modern application stacks, entirely in Javascript.
>
>
>> Hello Sir, i followed your advices regarding web development. Had
>> explored django for backend and made some really small apps with it.
>>
>
> Nice to hear that! Well done.
>
>>
>> I was doing some research regarding the hype around javascript vs the
>> demand for python in backend development. As of what i found, MEAN stack is
>> getting more and more popular whereas python is fainting with time. Am I
>> right?
>>
>
> Well, yes & no. Although sure JS is gaining popularity, Python has its
> share nonetheless. True, more people are switching to JS but that's because
> there's this recent belief that we're moving into this world online where
> every experience needs to be connected ( read continuous! ). Since JS
> provides the ability to be run on any device ( i.e. a browser ) it's a good
> choice for interoperability of operations.
>
> It's definitely a hype but sure worth it. Although JS is nowhere near that
> state of stability yet, it is maturing by the day. Positive things to come
> indeed.
>

I disagree, this is a common misconception. It is no longer a hype, 
people are switching because it is better. I am not sure what you mean 
by continuous experience but it doesn't sound like one of the main 
reasons why people are switching. "Although JS is nowhere near that 
state of stability yet" also not true.

>
>> Also please advice me regarding my choice to go with django as backend. I
>> want to be a backend developer and unable to decide if javascript is better
>> or python. What is your take on this and also suggest if django is good for
>> mastering or there is any better framework that makes me learn backend
>> development at better scale.
>>
>
> When you're comparing the two, I'd say you're comparing apples & oranges.
> Both find their applications in the use-cases they're most suited for. The
> only upside with JS is that your technology stack kinda becomes monolithic
> & you can write abstractions that work both on the Client & Server.
>

Prefer Node.js because it is better.

>
> I might not suggest you to master Django | MEAN, but master the language,
> Python or JS respectively. That sure would come from working on Django or
> MEAN. But as long as your fundamental understanding of how things in the
> framework work, you'd be able to translate your Django knowledge into MEAN
> & vice-versa.
>

I totally agree with mastering the language and implementation vs 
mastering a framework.

>
> In practical terms, there are companies operating Django but the paradigm
> shift is towards JS in whichever form may apply. More & more companies are
> *testing* their way onto a JS-only stack ( which is far from complete
> maturity ).
>

Lots of companies are running on an entirely JS stack and are not 
"testing" their way in.

>
> If you're thinking long term, definitely start hacking on MEAN. Should
> serve you good in the coming times, plus you get the opportunity to
> piggyback on the awesome transition that is happening in the market. Python
> on the other hand is stable enough and is definitely being used in a lot of
> production stacks. But I see no innovation there!
>



>
>> Like you, I am also fascinated by the technology stack used in various
>> websites like quora, facebook, reddit, twitter etc. But somehow i feel like
>> javascript as backend is not that scalable.
>>
>
> That might not be true^. Agree that it is not matured yet, but current JS
> production backends are handling a lot of traffic. You shouldn't be
> worrying about scalability at the moment, esp when you're learning about
> something. Scalability concerns are a very different set of problems & do
> not pertain to the language the stack is in. It does matter a bit but not a
> lot.
>

Node.js is more scalable than any other backend except Erlang.

>
> In short :-
> Python ( solid, stable scripting language, used in large production
> environments, solves core-engineering problems ).
> Javascript ( maturing, is being accepted tremendously, thing for the
> future, might just replace every other language on the Internet ).
>

+1

>
> Pick one of Django | MEAN ( preferably the latter ) and have a solid
> understanding of everything the framework is about. Emphasis should be in
> the order : the language > framework design principles > how it works >
> anything else!
>

+1

>
> Good Luck! :)
>
> --
> *Wishes.*
> *Ankit.*
>
> --
> You received this message because you are subscribed to the Google Groups
> "PULUG" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pulug+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


The main reason being pointed for people moving to JS is that you can 
write the same language both for frontend and backend, that is true but 
is not the main reason. Having the same language running in your entire 
stack does allow some crazy stuff like an isomorphic architecture 
design, meteorjs is the best example. https://www.meteor.com/

The more important reasons why people are moving to JS are stuff like
Node.js has an event-driven, non-blocking I/O model.

    1.  Event-driven means that you don't have to ping the node server 
every few seconds to know if something has happened. You just raise an 
event that you would like to be notified about and add event listeners. 
The ability to handle push requests through web sockets makes building 
real-time applications extremely easy.

    2.  Non-blocking I/O means that your code processing will not be 
blocked because of a pending I/O request. I/O requests are traditionally 
slow, be it disk writing or network calls. You can understand this 
better if you know about AJAX. This non-blocking behaviour is built in 
to the architecture which makes it perfect for asynchronous programming 
and managing multiple tasks at once. Hence, Node.js is able to handle 
some crazy metrics like 1million concurrent requests. You don't have to 
deal with threading and spawn threads for each requests which will crash 
your RAM sooner or later.

    3. It has an excellent package manager namely npm. Installing 
packages to build your application is as simple as `npm install 
express`. This command is literally all you need to install the entire 
ExpressJS framework.

    4. It has an excellent dependency management system. One command "npm
    install" will install all your dependencies and you are ready to go. 
This obviously assume you have built your system around npm.

One very common drawback of this architecture are processor intensive
tasks. Node.js is single threaded and does not take full advantage of
multi-core processors. Other server stacks max out on RAM due to high
number of requests, Node.js maxes out on processing power if you want a 
lot of computation to be done for each request. In real world scenarios 
this is very rare, however it can happen. So you will have to resolve 
this by using Node.js clusters or child processes. To be honest, if you 
are doing processor intensive tasks you won't be using Python or 
JavaScript in the first place.

Other drawbacks are mainly related to JS itself rather than the MEAN 
stack. The language is extremely flexible and inherently does not favour 
a single type of design like Object Oriented or Functional. This makes 
it difficult for people to find a direction on how to go about doing 
things. Every thing can be an Object or everything can be a Function. A 
function can also be an Object. It is crazy, it is confusing, it is 
unlike anything that is traditional. So you will have to take a call on 
how you want to design your application and make sure that you stick to 
it or end up with a codebase that no one can maintain.

Also, if you really really love Python then you should look up PyPy 
which combined with Tornado performs like Node.js in terms of concurrent
connections.

-- 
Thanks
Supreet

-- 
You received this message because you are subscribed to the Google 
Groups "PULUG" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to pulug+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Hi all,
While I don't know much of the above, I did hear about io.js which is 
supposed to be better and also multi-threaded.

I did find this but haven't gone through the video

https://www.youtube.com/watch?v=4oXdl2oE43g

Btw, the whole mean stack is already there in Debian.

[$] aptitude search nodejs node-express libjs-angular mongodb-server

p libjs-angularjs - lets you write client-side web applications as if 
you had a smarter browse

p libjs-angularjs-smart-table - table module for angular js

p mongodb-server - object/document-oriented database (server package)

p node-express - web application framework for node

p node-express-generator - express applications generator

i A nodejs - evented I/O for V8 javascript

p nodejs-dbg - evented I/O for V8 javascript (debug)

p nodejs-dev - evented I/O for V8 javascript (development files)

p nodejs-legacy - evented I/O for V8 javascript (legacy symlink)

I don't use nodejs actively but sometimes clients have some apps. which 
need node.js to run and they ask me to take a look through hence it's 
installed and running.


Hope it's helpful to the team.


More information about the Hamara-devel mailing list