.NET, Javascript, jQuery, and you

October 8, 2010 § 5 Comments

I’ve been doing a lot of Sharepoint development recently. Now Sharepoint presents several challenges, not the least of which is that you don’t have access to the familiar code behind functionality in most cases. Custom development in Sharepoint consists of master pages and page layouts that contain web parts. Web parts have code behind files, but the pages don’t, and it’s unwieldy to develop custom Sharepoint applications with the familiar ASP.NET forms-based development model.

As such, I’ve relied pretty heavily on client side code to accomplish much of the functionality that I’ve needed. My friend Ted Hughes introduced me to some of these concepts when we were working together at Curtis 1000. He was working primarily with the ASP.NET MVC framework, which I had played around with, but hadn’t used extensively up to that point.

One of the things that surprised me so much was just how pervasive the jQuery framework was used within that MVC development paradigm. Coming from a background of traditional ASP.NET forms development, I thought I was being progressive by using the ASP.NET Ajax framework, but Microsoft quite quickly dropped the framework in favor of jQuery. This article by Dave Ward goes into some detail about why.

So, obviously I was aware of jQuery, and had used it in some limited capacity, but if you’re not using it regularly, you should begin doing so. Depending on your background, you may view javascript as a subpar tool for developing web applications. At one point, I would probably have agreed with you, but javascript is a real language – really! The productivity increase from using jQuery properly and intelligently is excellent.

Here’s another article by Dave Ward to give you just a little jQuery introduction. If you’re a book learner, I can recommend jQuery in Action, which I thought was thorough as well as quick and easy to read. Also, a simple web search for “jQuery” + “whatever you want to do” almost always yields a quick result. Or if you can’t figure it out, ask me.

Advertisements

Tagged: , , , , ,

§ 5 Responses to .NET, Javascript, jQuery, and you

  • danbriapps says:

    I primarily use ASP.NET as well and have used JavaScript reluctantly for a lot of reasons but primarily because working with it in .NET felt like things were a bit “thrown together”.

    Now that the ASP.NET Ajax framework has gone by the wayside in favor of jQuery, it is a better developer experience or does it still feel like an after thought? Also, what’s the learning curve moving from the ASP.NET Ajax framework to jQuery.

    • mikevallotton says:

      Yes, I agree – trying to merge .NET webforms development with any client-side scripting (whether plain javascript, scriptaculous, YUI, jQuery, etc.) was painful and always felt like a hack. The .NET Ajax framework was an improvement, and I liked it. It was easy to work with, and made a lot of sense to me. The thing that really convinced me to switch to jQuery was when I started working with ASP.NET MVC apps.

      With MVC, the postback model that is the norm in .NET webforms development doesn’t exist. You don’t have the normal constructs like DropDownLists and TextBoxes – you instead have your controller that is strictly server-side, your view that is strictly client-side, and your model that is shared. In this model, using jQuery for everything you have to do client side – deserializing/serializing your model, validation, display, etc. makes a lot of sense. You strictly use C# for your server-side code, and strictly use jQuery for your client side code.

      As far as learning jQuery, it’s pretty easy to pick up, especially if you already understand CSS selectors. If you aren’t very familiar with CSS selectors, spend a couple of hours familiarizing yourself with those and picking up jQuery will be much easier.

      Does that help?

      • danbriapps says:

        That does help, thanks! I am familiar with CSS selectors so that’s encouraging. As for switching to MVC, that will have to wait. I love to upgrade – always have – but upgrading tends to come with an insatiable need to recode my prior projects “the new way”. LOL

        Then there’s the whole time factor involved in reading through books and tutorials on the new stuff. Don’t get me wrong, I LOVE doing it but at some point I actually have to put productivity over learning. Tis a tough balancing act.

      • mikevallotton says:

        I wouldn’t switch any projects to a new technology midstream. The few times I have tried to do that were disasters. It is something to consider for your next project or a side project, though. I would guess you could put together a small proof-of-concept MVC app using jQuery in about 15-20 hours. Might be an interesting weekend project if you have the time.

      • danbriapps says:

        ROFL! Who said anything about midstream! I was referring to existing, fully functional, “I work fine, leave me alone” type projects! I don’t allow it to happen of course, but the desire is strong.

        OCD, I know, but I that is why I try to turn a blind eye to the new shiny things until I can dive wholeheartedly into it. Great advice though – especially the proof-of-concept idea. Sounds like a nice way to dip instead of dive.

        Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading .NET, Javascript, jQuery, and you at Mike Vallotton's Blog.

meta

%d bloggers like this: