Monthly Archives: May 2011

ReSharper 6 enhances the JavaScript experience

We already mentioned some of the benefits that ReSharper brings to the table when it comes to JavaScript development previously. In this post we are going to have a more in-depth look at some of the features.

Pimping jQuery

In addition to support for JavaScript, ReSharper 6 also provides certain functionality specific to jQuery.

Code Completion for Selectors

When working with jQuery selectors we often need to lookup certain DOM elements or CSS classes in order to operate with them. This can result in a back-and-forth between the code we are working on and looking up of a specific element. ReSharper 6 facilitates these cumbersome operations by providing code completion for selectors:

image

This completion is invoked by typing # between the quotes, where as if we were to type ., we’d get:

image

This completion is available anywhere we a selector is required.  Of course if we merely want to select a specific type of element, we also have completion:

image

Extending jQuery extensions

One of the benefits of jQuery is the ease by which we can extend it to add our own functions and methods. ReSharper enhances this experience by providing completion also for custom extensions. For instance, if we were to write a new extension:

image

we now have myFoo available as a method of jQuery:

image

Much in the same way, if we want to extend an object:

image

we have:

image

Importing File References

Out of the box, Visual Studio requires a special comment to be added to script files to provide support for IntelliSense:

image

With ReSharper this is not required. If however, it is included, ReSharper will then limit the scope of Intellisense to the reference added. This reference can be provided by directly typing it in, in which case ReSharper offer completion:

image

as well as providing quick-fixes when errors are detected in paths:

image

Creating from Usage

Similar to C# and VB.NET, we can now also create JavaScript code based on usage. For instance, let’s say we write some code that calls a specific function named getInterval that does not yet exist. ReSharper prompts us to create a local function:

image

generating the code for us, providing us the same ability we have in C# to iterate through parameter names etc. The same applies to variables:

image

as it does to creating parameters and properties; once again, making the whole development experience a bit smoother.

Last but not least, ReSharper also provides the ability to create jQuery extension methods from usage:

image

Refactoring

Certain refactoring operations are now available in JavaScript. Firstly, in combination with Create from Usage, we can now easily add an extra parameter to a function call and have ReSharper offer to create it for us:

image

Introduce Variable is another refactoring option available:

image

And last but not least, Renaming:

image

ReSharper is smart enough to handle the scope of the renaming outside of the current local scope, prompting you always with the option to fine-tune certain renaming’s.

Code Clean-up and Rearranging.

In a previous blog post we mentioned briefly the code formatting options for JavaScript. These have now been extended and better organized. We can fine tune Lines Breaks, Braces Layout as well as Space via ReSharper | Options | JavaScript | Formatting Style. Below are the options for the newly added Spaces:

image

Running code-cleanup on JavaScript files is of course now also possible:

image

Also, out of the box, we provide certain filters, both in clean-up and analysis, such as those with min.* extensions. These can be changed in the options dialog, albeit it’s not highly recommended.

image

Rearranging Code

You can now rearrange code which includes moving parameters around, moving members up/down as well as arguments and object literals and arrays. All this is done using the same key combination as used in C# and VB.NET (Ctrl+Alt+Shift + Cursor Keys).

Code Inspections

JavaScript is a dynamic language. It has great advantages but can prove to be not the easiest language to work with, specially for novices. We’ve tried to ease some of that pain by providing code inspections, where possible. Among the many code inspections that currently are available are:

Syntax errors

image

Unused symbols

image

Dead code

image

Duplicate switch statements

image

Misuse of “this”

image

Accessing undefined global symbols

image

And this is just a few of the over 25 inspections that ReSharper supports along with their corresponding quick fixes. We believe that this will help remove some of the issues encountered at runtime, specially by newcomers.

Miscellaneous

Some of the other features provided for JavaScript are:

  • Configurable Naming Conventions: Much like C# and VB.NET you can define your own naming conventions.

image

  • Comments: Ability to comment and uncomment blocks of code as well as support for XML Documents.
  • Context Actions Settings: You can fine-tune which of context actions you want enabled.

image

  • Live Templates:  Support for Live Templates
  • Navigation and Find Usages: Navigation support as well as Find Usages for JavaScript members, some of which was already covered in a previous post.
  • Coding Assistance: Also covered in previous post.

All in all, we hope that some of these features allow JavaScript to become a language to that easier to learn, use and enjoyable.

ReSharper 6 is currently in EAP. Download it today and start playing with it. We’d love to hear your feedback.

Did you just take a dump on standard versioning practices?

image

Original source: http://blogs.msdn.com/b/endpoint/archive/2011/04/18/microsoft-net-framework-4-platform-update-1.aspx

Who was the genius that thought calling a 4.x update a “Platform Update 1” and referencing the knowledgebase would ever be a good idea? Does that person actually understand what he/she is doing?

WTF happened to calling things by Major/Minor version? As if the Client Profile wasn’t already a really stupid idea, now you come out with this crap.

Why are you messing people around like this? You realize some of us actually write software and deal with deployments?

Session at DevDays in The Netherlands

My talk at DevDays in The Netherlands on Real World Architectures with MVC is now available on Channel 9. It was my first TechDays Belgium / DevDays The Netherlands and I was quite impressed with organization. Kudos to Katrien, Helen, and everyone else involved. I’m guessing the videos from TechDays will be online at some point too, on Channel 9.

Also, if you’re interested in more hands-on-in-depth coverage of MVC and are located in Europe, I’ll be doing a 4 day masterclass with Informator in September

Crazy Monologue in the shower….

We sell Windows licenses. We sell SQL Server. We sell Office.

And now we’re going cloud. It’s all about Azure.

Think about it. What are we offering here with Azure? It’s not only hosting and scalability, we’re offering a series of value-added services.

What’s the cost of a Windows license to us? Nada…

Right now we don’t care what developers use. They can use .NET or PHP and still run it on Azure. We don’t care!

So, why do we care about the platform?

I mean, we could even run Linux machines. Still provide the value-added services….

Yes but a lot of things we can’t do, cause we don’t really control .NET on Linux. That’s kind of Novell and the Mono project

If only……

….the rumors, the silence from key figures in the community…will it all fall into place?…..only time will tell…

/crazy_mode_off

Getting things done daily

For over a decade now, except for one year, I’ve been working from home. Home is kind of metaphorical considering the amount of travelling I do. However, to all effects, it means working alone, physically isolated and with no real 9-5 schedule.

Personally, I love it. I find it much more productive than working in an office, since I rarely am able to concentrate when surrounded by other people or noise. Sure, it’s probably out of  habit. I know when I first started, I missed the office buzz,  so it’s all just a matter of getting used to things. But having worked in both an office and at home, I’d stick to what I have now.

One of the greatest struggles of working from home, is adhering to a schedule. You need to have discipline in order to be productive. It’s far too tempting to get out of bed a bit late, watch a bit too much TV while making a coffee, or chat on the phone a bit too long. Today of course, we don’t need any of that, as Twitter and Facebook are here for our procrastination pleasures.

On top of sticking to a schedule, if you’re somewhat responsible for defining your own, the feeling can be overwhelming. Often you feel lost. You feel you’ve got way too many things going on and certain days can end up resembling the most unproductive days of your life. It happens. Even if you run a tight shift. Sometimes there are just those days. The best thing to do is just get over and, well, call it a day.

Organizing your daily tasks

What I have found fundamental is organizing a list of tasks you need to do on a daily basis. Now over the years, I have tried everything. I’ve gone through all the ToDo list applications that were available on downloads.com. I’ve tried different flavors of Outlook, The Bat! (great mail client, really bad PIM), to the more recent Remember the Milk and a bunch of other apps. And of course, none of them worked just right. And being a developer, what did I do? Write my own, which of course also failed miserably.

The problems I encountered with them all were always similar, but you know what? I could never pinpoint it. Some where to simple, others too complex, ultimately having me spending more time on managing the tasks than getting them done. My last resort was just an empty text file with a list of tasks. That didn’t work either. So what did work?

This:

image

Yep. A piece of paper and a pencil (or pen as Dino rightly mentioned). It seems silly doesn’t it? Having all this technology at the tip of our hands and yet the best thing I’ve found that allows me to concentrate on getting the job done and knowing what I have to do each day would be a piece of paper and a pencil.

Some of the reasons for this I think can be attributed to:

  • It can’t go wrong (well it can but you have an eraser).
  • It’s simple. It won’t distract you in trying to re-organize or finding a better way to handle the tool.
  • It allows you to focus. It removes the overwhelming lists of tasks you have pending.
  • It’s staring you in the face.
  • You know exactly what you need to get done. It’s the list.
  • As you cross things off of the list, you see that you’re getting things done. It somehow entices you to even be more productive. It gives you a good feeling.

Now I’m not an expert in human psychology but I do believe that many of the previous points are actually psychological effects at play.

This is a daily Workflow

This works well on a daily basis. I still manage tasks using software. I use YouTrack for certain things, Thunderbird /Google Calendar for appointments and Checkvist for managing list that I collaborate on with others. However, when it comes down to what I need to do on a daily basis, I select items from all these sources and write them out on the sheet of paper, and I try and adhere to what’s on the paper, not deviating. So it’s important to realize that this is something I do on a daily basis. It doesn’t scale well for multiple days, weeks, months or even across teams. It’s a personal tracker for my daily routine.

It all boils down to one thing…a goal

There have been many techniques, tips and tricks that try and allow people to concentrate on a task. There’s even been certification programs for some, which I’ll refrain from making any comments on. Some tips which I’m sure you’re well aware of are things like closing down Email, Twitter, Facebook and other tools that decrease potential productivity (unless of course you’re a “Social Media Expert”). On the whole however, I think the main root of the problem here is not having a clear objective, not having a goal to reach. If we have that, you won’t procrastinate. This technique, I find, helps focus and reach that goal, daily.

If you’re having issues with getting things done, I recommend you try this simple approach ,which is by far my invention and I’m sure many already use.