Posts tagged with 'refactoring'

JavaScript for C# developers: some refactoring

I just published a blog post on my DevExpress ctodx blog about taking some non-idiomatic JavaScript code (actually from a DevExpress CodeCentral example program) and refactoring it to follow JavaScript best practices. Topics covered include: Minimizing the global namespace pollution Using triple-equals instead of double-equals for comparisons Function scoping Passing JSLint tests by using declaration-first Take a look ! Now playing: Nightmares On Wax - Morse (from Carboot Soul )...


Local variables are evil (or just irritating)

Every now and then, I reread parts of Refactoring by Martin Fowler. The main reason is of course to look for refactoring ideas for DevExpress' Refactor! Pro product, but I also like to take a particular refactoring in there, tease it out, and really understand it. Such a refactoring is Replace Temp with Query (120). The preamble to the refactoring goes like this: You are using a temporary variable to hold the result of an expression. Extract the expression into a method. Replace all references...