Blog

Welcome to Steve Smith's blog!

  • JavaScript Date Tips

    The other night at the Hudson Software Craftsmanship meeting at the Falafel Software training center in Hudson, Ohio, I did the Red Pencil Kata using JavaScript.  Although I’ve run into it in the past, I was stuck for a little while (I was the odd man out without a pairing partner to help find these things faster) due to one of JavaScript’s “fun” date conventions.  Being a C# developer primarily, there are many small things I have to remember that are different between JavaScript and C# (like where to declare variables, for instance).  In this case, it was the code for generating a particular date that bit me.  At one point, I wanted to generate a … more

  • Where to Declare Variables in C# and JavaScript

    Both JavaScript and C# belong to the C family of languages.  They share curly braces and semi-colons, and in fact there are many cases where the exact same code will execute (correctly, in most cases) as either language.  However, there are certain best practices that are unique to each language, and where variables should be declared is one of them.

    Declaring Variables in C#

    In C#, it’s generally best to declare variables just before they’re used.  Like any convention in programming, there’s some debate about this, but this rule is supported by well-respected books like Clean Code and top-voted answers to questions like this one: Where do you declare … more

  • Ensure You Are Not Adding To Global Scope in JavaScript

    A key best practice if you’re writing JavaScript code is to avoid adding objects to the global scope.  There are several good reasons for this – globals add coupling, it makes it easier for disparate libraries to break one another, etc.  A general rule of programming is to avoid global scope, in fact.  Unfortunately, JavaScript makes adding things to global scope very easy.  Consider this bit of code: In this example, we have a function, within which we set a variable and then use some jQuery to modify a div.  However, because we didn’t specify the “var” keyword, we’ve actually just added a new object to the global scope: message.  In fact, if some other … more

  • Free Stock Photos for Presentations

    If you’ve graduated from basic death-by-bullet-point presentations to something that will keep your audience interested, you’ve probably encountered the problem of “where can I find the perfect image to underscore my point,” preferably without having to pay an arm and a leg for it.  I recommend books like Presentation Zen to learn more about how to amp up your presentations, and that book makes some (dated) recommendations for places to go to find images.  I’ve used many different resources for my developer conference presentations and Pluralsight courses, and I thought others would benefit from this list (and probably future me as well, since I frequently find myself referring … more

  • Resolving Dependencies in ASP.NET MVC 5 with StructureMap

    In a previous post I showed how to use StructureMap with ASP.NET MVC 3.  It’s been a couple of years, so I figured it was time to update that article with the steps for getting StructureMap working in ASP.NET MVC 5.  If you’re interested in learning more about how to develop applications in a loosely coupled fashion, I highly recommend my course on SOLID Principles of Object Oriented Design to learn more (in particular, the Dependency Inversion Principle). StructureMap is my preferred IOC container / dependency injection tool for .NET applications.  It’s free, performs very well, and has a number of very useful features that make it very productive to work with.  One … more

  • Rename Elements in PowerPoint

    In PowerPoint, especially if you’re working with a complex slide with a lot of animations, it can be difficult to easily determine which named element corresponds with which visual element on the slide.  By default, when you add pictures and other assets to a slide, they get names like ‘Picture 5’.  It would be great if there were an easy way to rename these elements, especially from the Animation Pane where it’s most useful to know which item is being described, but at least in PowerPoint 2013 you can’t. However, there is a way to do it, albeit not one that is terribly intuitive.  In the above slide, Picture 5 corresponds to the bullet image, and Picture 6 the people … more

  • Looking Back and Moving Forward

    Last week I started a new chapter in my career as the Chief Technology Officer at Falafel Software. I’m really looking forward to this role, which I expect will allow me to be a leader in a technical organization that has a track record of success. It will also be refreshing to be a part of an organization that is focused on delivering services to customers, and which is still small enough that it’s possible for everybody to know one another. Looking Back Over the last 10 years or so, I’ve had the pleasure and privilege of working with my wife, Michelle, on a number of ventures. Michelle doesn’t get the spotlight as much as I do or as much as she deserves, but just to set the record … more

  • Microsoft Version Number Integer Type

    Microsoft made some headlines a few years ago when they decided to skip Office 13 and jump straight from Office 12 to Office 14.  Recently, they’ve announced Visual Studio “14” CTP, which appears to be doing the same thing: Current Version (Visual Studio 2013): Next Version: I actually wrote about Microsoft’s apparent triskaidekaphobia back in 2008 with the Office naming, and suggested that they consider updating their software frameworks to follow suit (since if 13 is unlucky, it should be worthwhile to keep it out of our computer programs, right?).  They haven’t taken this logical next step yet, so today I’m announcing an open source project you can use to implement Microsoft … more

  • Incent All Parties Involved

    Incentives and offers are a mainstay of modern business sales and marketing.  People feel better about making a purchasing decision if they think they are getting a deal, and frequently people need some kind of a push to get them to buy now, even when they’ve otherwise made up their mind that they’re ready to buy, soon.  In most cases, incentives are given to just one person, the potential customer.  It’s also typically the case with referral programs, which generally reward the referrer for someone they refer.  These can be effective, to be sure, but they can also send the wrong message, at least in terms of recruiting bonuses. Rewards for Referrals When DropBox … more

  • Working with Kendo UI Templates

    I’m watching the Introduction to Kendo UI course by Keith Burnell on Pluralsight and decided to play around a little bit with templates, which are a pretty powerful feature.  If you’re a server-side web developers, templates should seem pretty familiar to you.  Any ASP or ASP.NET page can be thought of like a template, in which you mix markup and dynamic data expressions.  In this case, the templates are defined in their own script blocks.  There are demos and documentation available; in my case I opted to write something up based on what’s in the Pluralsight course in a JSFiddle. Templates are most valuable when you’re binding some data to them.  The data can be … more

  • Passing Default Parameter Objects in JavaScript

    You can use the jQuery extend() function to elegantly configure your functions to accept a single parameter object, while providing default behavior for any options that are not set.  For instance, imagine you have a simple function that simply says “Hello, World”.  You could code it like this: Now, if you want to start passing in parameters, you can easily do so by parameterizing the method, but every time you do, you break any code that was expecting the original parameterless version.  This can quickly grow out of hand within a few revisions of the function’s signature.  A simple way to avoid this issue and allow for your function to version forward effectively is to … more

  • When Should You Refactor

    A common question teams face is, when should we take the time to refactor our code?  Refactoring is defined as improving the design or quality of code, without changing its external functionality.  Most teams face constant pressure to release features and/or fix bugs as quickly as possible, so it’s not uncommon for problems discovered in the codebase to be put on the back burner to be fixed “later."  But unfortunately, a great deal of the time later never comes.  As a result, the codebase continues to degrade, accumulating more and more technical debt, making it more and more expensive for changes to be made to the system. Big Bang Refactoring Sometimes, the politics … more