Tell me more ×
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.

Being a .Net developer for years, practicing SOLID principles, TDD, and other Clean Code practices - I am facing now a new project (greenfield) with strong client side code.

I wish to address my client side code with the same design practices and care as my server's.

I have read through TodoMVC, which shows the same project implemented using various JS frameworks. Which one is the most fitting for these principles? and the easiest for a C# dev?

share|improve this question
6  
Knockout.js uses the same event handling patterns as WPF. – user16764 Dec 21 '12 at 18:49
How come client-side devs never ask how C# or Java can be made easier for them? – Erik Reppen Dec 23 '12 at 9:06

closed as not constructive by gnat, Walter, Dynamic, Glenn Nelson, GlenH7 Dec 22 '12 at 2:27

As it currently stands, this question is not a good fit for our Q&A; format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

4 Answers

Most of the JavaScript frameworks take after the Ruby on Rails approach to MVC framework, but that does not mean you cannot follow the same principals of SOLID and TDD.

As I am familiar with .NET to JavaScript integration here is the JavaScript technology stack I use that should be easy enough to integrate for you.

On the front end:

  • JQuery - The standard of many a JavaScript web page and robust but can be tricky (also note QUnit for testing)
  • BackboneJS - Structure for JavaScript for MVC and also Single Page Application framework
  • EmberJS - This is my new personal favorite for front end JavaScript web design and worth looking into. It is well structured
  • Knockout JS - Included for all the reasons given in the comments. It is a stellar framework and I should have mentioned it prior.

For TDD:

  • Jasmine - TDD/BDD framework for JavaScript. I love this framework and it can be automated from within TFS and Visual Studio
  • SinonJS - Tests, Spies, Subs and Mocks that can be integrated into Jasmine all for JavaScript

The above frameworks should get you on your way and be fairly easy to understand given your background.

share|improve this answer
4  
I'd like to add Knockout as an option, if you have ever used MVVM (like in WPF/Silverlight/WinRT) it's really, really nice. And the tutorials and documentation are that good... – Trust me - I'm a Doctor Dec 21 '12 at 19:16
1  
@Trustme-I'maDoctor I have had a little experience with Knockout and it is a very good system too. I can't believe I forgot it! Thank you. – Akira71 Dec 21 '12 at 19:41
4  
I'd also give Knockout a plug - apart from it being a quality piece of work, the main man behind it, Steve Sanderson, is a well-known figure in the .NET community and as such I've always found the documentation and examples very friendly to .NET/C# developers. – Carson63000 Dec 21 '12 at 21:11

Consider the platform that you are going to be working on. Some of the frameworks have issues with performance that only become apparent on older browsers (IE8 + knockout.js is notorious)

share|improve this answer

I would like to say a word of warning: Do not try to approach JavaScript identically to how you approach C#. They have a bit of significant differences, especially in their inheritance schemes and general object modeling approaches. To do so would be to dismiss what JavaScript's benefits are over C# and more dangerously it would be dismissing the cons it has compared to C#.

Treat JavaScript like JavaScript, and write it in the way it wants to be written and you will be better off. Avoid the frameworks that try to give you C#'s inheritance models as they're antithetical to JavaScript to begin with.

That said, by all means if you know SOLID well you can apply the principles in what you're doing, the ways you avoid breaking them just may be different.

Now then, as for Frameworks, personally as another C# dev I have found JQuery to be hands down the best to work with and feels most similar to working with the .NET framework to me in that it gives you tools but doesn't force your model in any way.

I would personally say if like me you're a back-end guy which I'm guessing to be the case considering you're now asking about what front-end framework to work with: Stay away from the large frameworks that try to force an object model structure onto you. Stick with JQuery and other utilitarian ones like it, I can suggest Handlebars for templating. Other than those (and similar ones you'll find, oh yeah moment.js is a great utility) I would say avoid the overarching "you must use this pattern" frameworks, as it's uncomfortable to a C# developer used to making the pattern and system model that fits their problem rather than the one that fits their technology stack.

Go read a little lisp/scheme and try to pick that up a bit if you're not familiar with it on the side while you're starting on this project and it should help you to get closer in mind with some of the techniques and approaches that are more rational to JavaScript but which C# doesn't really present so much.

share|improve this answer
Good advice! There was a video from MIX11 "Good JavaScript Habits for C# Developers", that I found very helpful. Anyone who is experienced in C# and less experienced in JavaScript can probably get some good lessons from it. – Carson63000 Dec 24 '12 at 8:09

JS and C# are completely different worlds. Do not try to be C# developer while you are coding with JS. With JS we have no compiler error, no type, no class concept (as we have it in C#).

Change your mind and think like a JS programmer, with many helpful frameworks and libraries.

You can find many design patterns, OO approaches, tools and documentations. Here you can find a very useful resource.

I recommend you to first specify what you want and how you want to do, then find proper tools. Do you want to develop a MVVM UI or MVC, or you want OO UI development? Then you can mix libraries and frameworks: jQuery with Knockout (MVVM), CanJs(MVVM and MVC), Backbone and jQuery(MVC), prototype.js (OO) and so on.

share|improve this answer
+1 for knockoutJS – Kyle Hodgson Dec 21 '12 at 23:20

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