Tag Info

Hot answers tagged

36

First of all, I agree with JUST MY correct OPINION's answer regarding learning Erlang. It's a mostly functional language (although concurrency plays a big role), and all of its features were added to go towards fault-tolerance and robustness, which is not exactly the same design goals as Javascript in the first place. Second of all, leaving Node.js to get ...


32

Erlang isn't complicated to learn, it's just alien to the mindset that the Chambers Constant (99.44%) of coders have learnt as the way programming works. The problem you're facing are likely just conceptual disorientation rather than actual complexity. Here are some of the alien features of Erlang that are going to bite a typical programmer: Erlang is a ...


27

While that concept can indeed be implemented in many languages (and as dodgy_coder mentioned, it has been implemented in Ruby and Python at least), it's not quite as trivial as you state. True, Java has non-blocking IO APIs. So you can do raw disk/network IO in a non-blocking way. However every API that somehow wraps or handles IO needs to be implemented in ...


21

Most of the questions you ask are not answerable without context, and are more or less moot given management has already made the choice for you... unless you are asking 'should I quit and find a new job in the face of all this change?' If your going to tough it out I recommend you read this this post on the topic: How To Survive a Ground-Up Rewrite Without ...


20

JavaScript certification is called github. It's called write modules, maintain modules, and share modules with the community, build popularity, etc. As a JavaScript employer I couldn't care less what certification you have, I care about either examples of github modules showing quality code or live websites/web applications show high quality code.


19

Do you as a Javascript developer consider the traditional Design Patterns as important or less important than they have been with other languages / environments?. Classical design patterns do not apply to JavaScript. What does apply is writing modular and functional code. You should use a mixture of Constructors and first class functions. As ...


19

The nice thing about callbacks is there's no global state there, and passing parameters to them is trivial. If you have a function download(URL, callback: (FileData)->void) then you can know that's a self-contained higher-order function which essentially lets you construct a "grab this and do that" function. You can be sure your code flow is exactly as ...


17

Probably the main reason is that it uses JavaScript to write server-side components for things such as web servers, web applications or web services. This unifies the traditional front end (client-side) development language JavaScript with the server-side language. You're right - the fact it is non-blocking, using the reactor pattern is not unique - it has ...


14

There is two important things that make Node.js different to existing server-side frameworks, asynchronous events and the use of JavaScript as programming language. Asynchronous Events While most of the existing server side frameworks use an synchronous architecture, Node.js use an asynchronous architecutre that JavaScript can handle well. This means that ...


13

Of course any CPU bound work is going to utilize the CPU. It's going to block the CPU in whatever language or framework you write it in. Node.js is great for when you have I/O bound work, not CPU bound. I wouldn't do heavy lifting in Node, though it can be done. Node.js solves real problems, not fictional or imagined ones like fibonacci number servers. It's ...


13

Good IDE for Node specially for Debugging(Also regarding JavaScript) Nide, is a web-based IDE for Node.JS, designed with simplicity and ease-of-use in mind. You can run Nide locally or install it on your remote server, and access it through your Web browser. Cloud9, a Good IDE specifically for developing JS applications. Komodo Edit supports ctrl+click to ...


13

When Node.js is described as "non-blocking", that specifically means that its IO is non-blocking. Node uses libuv to handle its IO in a platform-agnostic way. On Windows, it uses IO completion ports, on Unix, it uses epoll/kqueue/select/etc. So, it makes a non-blocking IO request (which may have a background thread monitoring, but this is never exposed to ...


12

is there any good reason to avoid Node.js for traditional web apps Yes, if you have N years in web platform X then clearly you can developer an application in platform X faster. If you want to do Y and platform X has a pre-made solution Y that does X then do so. All the generic reasons of why you should use one platform over another. the sort of ...


12

I've run into some difficulties thus far I'd like to document here. How do you handle reconnect logic? This is a hard problem and an especially hard problem in designing and implementing a message queue. Messages must be able to queue up somewhere when consumers are offline, so a simple pub-sub is not strong enough, and consumers need to reconnect in a ...


11

I'm now looking at node.js and it's performance implications (I'm addicted to speed), but I haven't delved into it all that much. Profile, profile, profile. That's the only way to know that your speedups are having the proper affect. You can guess that it's fast enough. But most people like to prematurely optimize. That's worse than playing with ...


11

We will have about 200 computers (most on the same network) that will each send, via HTTP POST, around 5000 requests/day. With each request containing about 300 bytes of data. That's about 10 req/s. So it's clear that you don't need to switch. Real life benefits of switching (besides getting valuable experience)? Well, as you said, you're hosting on ...


11

There are several possibly wildly overoptimistic assumptions in your idea. I'm going to focus on two of them. Technology rewrite in 3 weeks I'm going to work off of the Cocomo II model, change every driver to be in your favor, and poke at numbers and say you have about 1000 SLC give or take (its an estimate based on you are doing all, being an expert in ...


10

Since you can pass functions as parameters, it is common to pass a "callback" function to these sorts of functions. So, for example, you may have a "read" function that looks like this: function getUser(userId, callback) { var mydbAPI = something; var myQuery = somethingElse; mydbAPI.getUser(myQuery, function(data) { //parse data a little here: ...


9

Take this answer as subjective opinion. Do you as a Javascript developer consider the traditional Design Patterns as important or less important than they have been with other languages / environments? If you mean traditional design patterns like Gang of Four, then most of the techniques are language/platform agnostic like "Program to an ...


9

The three main reasons I would give are: Non Blocking IO / Asynchronous IO. This is hashed everywhere on the web and in the previous posters. One thing I would contribute is that designing your code to explicitly assume asynchronous behaviours assists the compiler engine to maximize the hardware. Yes, many of the JIT compilers and hyperthreading processors ...


9

I've heard it's called NPM style "comma-first" rule. Example from the doc: var magicWords = [ "abracadabra" , "gesundheit" , "ventrilo" ] , spells = { "fireball" : function () { setOnFire() } , "water" : function () { putOut() } } , a = 1 , b = "abc" , etc , somethingElse ...


9

It's popular and growing. If it failed, it's not like you wouldn't be able to re-use a bunch of your code elsewhere. It's not hard to port core node libraries to the client-side and other JS libraries. It took me about 10 minutes to rewrite their event system for use in browsers without losing any of the interface. If Node or JS declined in popularity, it's ...


9

It's particularly strong at handling a ton of file I/O and I would expect it to handle a ton of network communication well too. It seems particularly popular for socket-driven apps. The important thing to keep in mind is that if your needs aren't met by existing libraries (there are many) you may need to dive into some C which can be bound to JS commands. ...


8

Wikipedia might be a good place to start with some general concepts and basic information. This quote from that page sums it up but probably needs a bit of knowledge to fully understand it. In programming, asynchronous events are those occurring independently of the main program flow. Asynchronous actions are actions executed in a non-blocking scheme, ...


8

Well, I don't think that rewriting the application was a good idea unless it was performing poorly. To answer your questions: Node.js is not magic. Your application has huge amount of users, so there is no way to be certain that it will make it faster. Well, yes, Node.js does in fact consume fewer server resources. So not only can you save money on ...


8

There's no technical reason you couldn't do this. I did something very similar for a simple game I wrote to play with Node. The pages were served by Apache and written in PHP, but then I had an HTML5 canvas and I initialized a socket to my Node server. Both Apache and Node can run happily side by side on the same machine, just different ports.


8

Running several web server processes in parallel is not a problem at all, people do it all the time. However, since only one process can ever listen on any given port, they can't both run on port 80 directly, so you'll have to dispatch somehow. An easy solution is to run the Node.js application on a custom port (anything above 1024 should be fair game, but ...


7

Yes somebody could potentially see this token in the packet, which is why it is also a good idea to use SSL encryption of all network traffic before and after authentication and distribution of a token. Someone on an unencrypted wireless network, like at a Starbucks use this method all the time to pick up packets to services like Facebook that do not ...


7

If you and your team have good experience with PHP and it's simple enough to implement, I would stick with that. If the amount of traffic goes up and concurrency is an issue, then it might be worth getting to grips with node (plus it's always fun to learn a new language!!). The other benefit of node is; it's fast. But again in this scenario I can't imagine ...


7

You're mixing apples and oranges, kind of. Servlets (or inheriting from HttpServlet) let you access HTTP request parameters and respond with something, via (or on top of) an existing HTTP server implementation. Although using Javascript as the language, Node.js is at a lower level than that. It starts from actually implementing the HTTP server. You can go ...



Only top voted, non community-wiki answers of a minimum length are eligible