views:

227

answers:

9

I code primarily in javascript and in vb.net. I've found that if I can achieve the same thing in both javascript and vb.net that I feel far more productive and expressive using javascript for the task. I often find myself researching server-side javascript implementations to see if anything has gone mainstream so that I can code my back-end business logic and data access in javascript. Given all the advanced tooling and language features in .Net this preference seems somewhat paradoxical to me. I'm not suggesting one is better than the other (I've been a vb programmer since I started programming), I'm just wondering if my preference is entirely subjective or if anyone else shares it. So, does anyone else enjoy coding in javascript to the point where you prefer it to the .Net and Java environment, and if, so why?

+2  A: 

Personally, I'm much more "productive" in .NET than in JavaScript, simply because the framework is more rich and there is much built-in functionality. I also have not started writing code using TDD in JavaScript, perhaps because of the lack of readily available tooling in Visual Studio. For C# and VB in Visual Studio, there are many different ways to achieve very productive TDD. As far as the languages are concerned, I'd say that JavaScript could potentially be "quicker" to hack something together in since it is dynamic - which can lead to more terse code, LOC-wise. Note: "quick" and "productive" are of course different measurements.

James Kolpack
A: 

I feel much less productive programming in Javascript than Java. The main reason is that there are so many more portability issues with Javascript implementations; e.g. between different browsers. Other issues include those mentioned by others:

  • Java has better tools support, both for coding and for debugging across multiple deployment platforms.
  • Java has far more extensive libraries, both standard and as 3rd-party extensions.
  • Doing multi-threaded stuff in classic Javascript is sooo convoluted.
  • Java's primarily static type system (in my experience) makes it better for programming in the large.

However, there are still situations where Javascript is a better solution than Java or C#, despite the productivity issues above, and any prejudices one might have against Java.

Stephen C
JS implementations, or DOM implementations? I've been pleasantly surprised by how consistent JS implementations are.
Ken
@Ken - you are mostly right, though there *are* compatibility issues at the language level. And of course, most non-trivial JS programming *does* involve the DOM implementation.
Stephen C
I thought the whole idea of jQuery is to free JS developers from worring about such portability issues. Is there any reason why you wouldn't want to use a library such as jQuery and program directly in JS?
reprogrammer
@reprogrammer - that's the idea. But with Java and .NET you don't need to use a portability layer. Besides, there are some areas where (AFAIK) JQuery doesn't help; e.g. creating a portable XPointer for the user's selection, implementing a trusted plugin, etc.
Stephen C
A: 

When developing a reasonably large application, I feel more productive in java/c# due to static typing and a larger and more mature set of libraries and tools.

This question is highly subjective though, different people are going to have different experiences and opinions. If you have a choice, you should be doing what works the best for yourself.

kwyjibo
static typing makes you less productive, not more. static typing is for runtime performance, and catching syntax errors at compile time
Matt Briggs
That's not true for me - i find that static typing is a form of code documention, makes code navigation work 100% of the time (e.g.: jump to the source code for a function), makes IDE refactoring work 100% of the time, and allows catching of errors at compile time. All those things increase productivity - for me. I know that static vs dynamic typing is a religious debate, i just want to emphasize that different people have different points of view. What you should be concerned with is what works well for you, not what works for others.
kwyjibo
A: 

I think that if the application required much about correctness and good structure. It should be a server side language. You can achieve things with Javascript but I guess that it's not very complex.

thethanghn
Au contraire, you can do extremely complex things with very little code in Javascript, mostly thanks to its versatile `functions`. The limitation is usually the environment (read: browser). Unit tests make it as suitable as any other scripting language for "big" apps.
deceze
@deceze: Completely agree with that: e.g., have a look at GMail, Google Docs or open source applications like Vanilla Forums, Zimbra and CKEditor.
Marcel Korpel
A: 

node.js is currently the hot serverside JavaScript solution. It would be a big departure from .NET, but its gaining traction.

I think JavaScript as a language offers a very similar set of tradeoffs as other dynamic programming languages. It has some really excellent capabilities to do a lot with less code, but it doesn't have the same safety features or speed.

For the most part, I find that I can get more done faster with JavaScript than Java for example, but it can sometimes be tedious to refactor. Occasionally there are times when tricky run time errors sneak in that would have been caught at compile time in Java.

It also helps that I work in JavaScript a lot and have built up a large library and framework of reusable code. JavaScript doesn't come with too much out of the box.

Russell Leggett
A: 

I feel much less productive programming in JavaScript than Java. The main reason is that there are so many more portability issues with JS implementations across different browsers.

I used to feel that way as well, but as I have learned JavaScript I have also learned to get around the quirks neatly, I don't really think about browser differences when I code anymore. When there is problems it's almost always with HTML and/or CSS.

On the other hand I have never had a pleasant time writing ASP.NET, whatever I need to do, it is so hard to find any useful articles/documentation/examples. Recently I needed to interact with an MS SQL database, as seen on MSDN the "System.Data.SqlClient Namespace" contains 26 classes, each with a rich stack of methods, members, properties etc. Probably totalling around 1000 documented identifiers. One only need a handful of these to write perfectly fine code, the problem is finding this handful hidden between all the junk. Nowhere to be found is a neat little 20 lines example containing the useful functions in action (or at least if so I haven't found it). I suppose one can learn to get around the kinks of .NET and MSDN, but I fail to understand how .NET has become so widespread when there is perfectly good alternatives.

In my case:
ASP.NET -> Massive productivity fail due to wasting time finding out what function does some trivial task.

eBusiness
Speaking as a webforms guru since 2003 and as someone who knows all the idioms of ASP.NET development inside and out, I can authoritatively say webforms is a ridiculously disaster of a framework. ASP.NET MVC is a little more palatable.
Juliet
But in all seriousness, if you having a hard time with .NET, blame the user not the language ;) Learning the API is the hardest part, and I struggled too when I hooking up to a database for the first time. But after a little while, you learn the framework by heart and you can crank out whatever databasing code you need in seconds.
Juliet
Doesn't jQuery address the problem of cross-browser portability with JS?
reprogrammer
jQuery addresses some cross browser issues, but for the major part it just provides a different interface for well working functions. It also address the issue of making sure that programmers don't know what is going on in their code. It's not like jQuery is bad, but it wants to be more than a library, it is a different way of coding, but you can't truly write good jQuery code without a good base of JavaScript.
eBusiness
+1  A: 

javascript just has a higher signal-to-noise ratio, since it doesn't require all that superstructure of declarations and explicit typecasting. If you are confident of your coding, it's much faster to write and debug.

With static-type languages I spend more time thinking about language requirements than problem-solving requirements.

If you want a direct comparison, try ActionScript. It's literally javascript with all rigging added - they hoped it would be the next standard version but failed. It's kind of a litmus test - some people prefer it because of the explicit typing and error-checking. You and I would not so much because of the overhead.

le dorfier
A: 

Ok here is my opinion I'm a javascript developer and is all I do, I have a good knowledge about .Net (c#) and Php, And I'm very productive with javascript as I'm in building with C#, but always depends of the application, One thing that you can't do when build with only server side code is get a fully independence between backend code and frontend code you have to mixup (server code and xhtml || css code, but with javascript and some webservice or ashx files, you can really split this issue you get a lot of good points. For example you can build two team one of frontend (designer) and the second one just of programers, And belive this is great, many times just the backend team does not think the same way of the backend team and many time have different goals in their head. The second good point and a very very good is with this you don't care about if your front end designer are building the site just with javascript or with flash wich is ecmascript (javascript flavor), or an iphone.

The bad point is that you have to know alot!!! of javascript because almost all the time you are writting code without intelligenSense or a IDE, is just you and your knowledge, you don't have many feedback from the browser when you have an error writting the code so debuggin can be a problem at least if you don't use firebug (firefox) || .NET IDE.

And for "kwyjibo" I only use a fully JAVASCRIPT AJAX solution only when the site is very complex and have to be a really really USER FRIENDLY 'cool' solution.

But yes you CAN be the same productive =)

nahum silva
A: 

I've always thought to myself if JavaScript went on the desktop, it would demolish Ruby, Python, and Perl as the language of choice for ad hoc scripting -- but that's pure speculation :)

But since you asked, productivity and familiarity go hand in hand. I write a few lines of JS once a year at most, so I constantly refer back to the documentation to get anything done. On the other hand, I use .NET everyday :)

I think there's some argument that Javascript is more productive than VB.NET. VB is bulky by design, and all those extra half seconds it takes to write out 'Public Property whatever As Type get ... end get set(value as Type) end set' will add up (even with the IDE filling in most of the boilerplate automagically).

C# is a little closer to JavaScript in terseness. (And speaking just for myself, I find I'm much more productive in F# than C# :) ) So you can write code in both languages at the same speed, how fast can you debug it? At least for me, Firebug is ok, but nothing in the world beats the Visual Studio debugger.

If you're finding VB.NET isn't up to snuff, you're in good company ;) Try switching to C# as your default language, see if it makes a difference.

Juliet