Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Are there specifically any math related issues with Node.js and money that could cause my system to lose track of some of the money it's tracking?

The reason that I ask is that PHP, because of it's typing, cost a colleague of mine at another trading firm a million dollars. I don't want to get into the issue in great detail, and I'm not trying to trash PHP. I don't want this to happen to the system I'm working on now.

share|improve this question
1  
Your question is a bit vague... We don't know what you mean by "suitable," for one thing. –  Robert Harvey Jan 26 '13 at 4:12
2  
Financial institutions would never use PHP to power mission critical apps. I'm not going to go into why, but not knowing a lot about node I'm wondering if anyone knows the general best practice around node and critical money applications where a rounding error could cost a million dollars. –  Nathan C. Tresch Jan 26 '13 at 4:15
1  
You don't have to explain why you won't use PHP, I totally understand. Node is an open-source product; sometimes financial institutions aren't comfortable with that. –  Robert Harvey Jan 26 '13 at 4:20
3  
@NathanC.Tresch: My impression is that financial institutions are usually pretty conservative. Node.js is less than four years old, and for much of that time it evolved rather rapidly (though it seems to have stabilized significantly). I doubt that financial institutions have formulated any "general best practice" yet. –  ruakh Jan 26 '13 at 4:21
3  
Short answer: SO is focused on technical questions, Programmers is focused on conceptual questions. - Long answer: Which computer science / programming Stack Exchange do I post in? –  Yannis Rizos Jan 26 '13 at 4:27
show 6 more comments

migrated from stackoverflow.com Jan 26 '13 at 4:21

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 24 down vote accepted

I don't understand what is more "safe" about python than for example php. I've seen php used plenty of times for financial applications just like python, ruby, perl, c#,java and a bunch of other languages.

node.js is as solid of a platform for financial applications as any as long as you stick to all the regular rules that an application that deals with finances has to adhere to.

Would I develop a financial application using node.js? probably not. When recently we had to choose a platform for a financial application at the company I work, node.js had a few major shortcomings.

  1. It did not have solid enough database drivers for sql-server or sql azure which is the database we use. It goes without saying that it does not have as solid orms as let's say C# with entity framework and nhibernate.
  2. Most of the reference material you will find on node.js on the internet is still lacking. For example most of the material on using databases is on mongodb which was not an option in our case since we did not feel safe using a database that does not support transactions
  3. Hiring developers to work on your project later on will be more difficult. Since node.js is new there are less developers who know how to use it properly. This means that maintaining developers will cost more and will be harder to replace in the short run.
  4. No big existing solid financial frameworks to work with, it will be more likely harder to integrate your financial application with other enterprise financial software.
  5. Most importantly, it did not offer a significant advantage in either development time, maintenance costs or scaling ability compared to the solution we ended up choosing.
  6. There is only one type of numeric value in javascript which some people find bothering, see the comments for a related discussion. Node.js mitigates this somewhat with the use of methods that write and read integers directly.

Here are some reasons to use node:

  1. The event based single threaded non-blocking i/o model makes a lot of sense. It apparently scales very well.
  2. Developing the application using a single language both on the client and server sides is very appealing, you can share a lot of code which saves potential development time.
  3. The node.js community is very enthusiastic

These are just our reasons, your scenario might be different

share|improve this answer
6  
@NathanC.Tresch I'll second the comment about database drivers; nothing can ruin your application's reliability and performance quite like immature and buggy drivers. Make sure your chosen DB is well supported before you dive in. –  Daniel B Jan 26 '13 at 6:35
3  
@RobertHarvey I would never consider hiring someone who knows clientside javascript as a node developer without proven node experience. Working with node.js is more than just knowing another javascript API. I think that a better comparison would be hiring a ruby developer that has no experience with rails or a C# developer that has no experience with asp.net –  Benjamin Gruenbaum Jan 27 '13 at 1:49
3  
As you wish. But I have often seen complaints from developers (on this site and others) about employers being too specific about technology requirements, in one instance famously requiring 5 years of Java experience when Java was only three years old, or asking for combinations of experience that no one can possibly have. If this is your model, it speaks against Node.JS, which arguably is still a niche technology. –  Robert Harvey Jan 27 '13 at 18:27
1  
Accepting this as it's a great answer and the only one I've gotten. :) Ultimatly I've been convinced that Node won't screw me over as long as I use a well maintained decimal package, and that was what I was looking for really. –  Nathan C. Tresch Jan 28 '13 at 1:43
3  
Why has no one commented on the fact that JavaScript only has 1 numeric type? If you're writing serious mathematical code (I haven't done this myself), wouldn't you want a bit more flexibility and power than just having one floating point type? –  jhsowter Jan 28 '13 at 14:50
show 13 more comments

JavaScript doesn't have integers. It's commonly accepted that money should not be dealt with using floats so this causes a bit of a problem. Another response went into a detailed list of pros and cons about the platform but this is a major aspect of the core language that will always be lurking in the shadows waiting to cause problems for you.

share|improve this answer
3  
The ECMAScript spec javascript is based on does not have integers but that doesn't change the fact node.js does have some support for integer . Have you looked, for example, at typed arrays and node.js's built in buffer class's writeInt and writeUInt methods? nodejs.org/docs/v0.6.0/api/buffers.html#buffer.writeUInt8 –  Benjamin Gruenbaum Jan 30 '13 at 20:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.