Table of Contents
This is a case study for use in a class like Software Development.
Please note: This case builds on a prior case called ‘Making HTML Manageable with CSS‘ and assumes familiarity with its contents.
Prototyping for Usability
Frangelico DeWitt and his team have just started developing a new suite of software for their employer HVAC in a Hurry (a heating and air conditioning service business). Their current focus is on a web application that helps field technicians find availability and pricing for replacement parts.
The good news is that he has an a working on JS fiddle (Making HTML Manageable) and a set of user stories about what he wants to test (see Appendix A).
As a next step, Frangelico has decided he needs to make the prototype interactive so he can test this user story:
‘I don’t know the part number and I want to try to identify it online so I can move the job forward.’
and these test cases:
Make sure it’s possible to search by make/model of units
Make sure it’s possible to search by type
Making Stuff Happen
He’s made a start with this JS Fiddle: Making Stuff Happen with JQuery.
Looking at the sample code in the JS Fiddle above, can you toggle (show/hide) the #search-controls div with JQuery?
How about a somewhat more involved challenge?! Right now, the code allows the user to filter by manufacturer and model. How would you extend it to also filter by part type?
What else do you think is worth trying? Try it out!
Exhibit A: User Stories
These stories are the primary focal point for the team: they describe both what the team has learned about the user and what they want to do for them. As you get into the details, it’s key not to lose sight of your design intent and what you’ve decided is important to the user.
Epic User Story
‘As Ted the HVAC technician, I want to identify a part that needs replacing so I can decide my next steps.’
Based on their observations in the field, Frangelico’s team thought through the user experience of the epic with the following storyboard:
|‘I know the part number and I want to find it on the system so I can figure out next steps on the repair.’
|Make sure it’s possible to search by part number.
Make sure descriptive info. appears as the search narrows (photo?) to help avoid error.
|‘I don’t know the part number and I want to try to identify it online so I can move the job forward.’
|Make sure it’s possible to search by make/model of units
Make sure it’s possible to search by type
|‘I don’t know the part number and I can’t determine it and I want help so I can move the job forward.’
|Make sure an estimate of the turnaround time for an expert to review is available
|‘I want to see the cost of the part and time to receive it so I decide on next steps and get agreement from the customer.’
|Make sure it’s possible to dispatch a request by email to the customer in case they order their own parts and/or carry their own inventory of spares.
NOTE: How would the customer respond so we can help structure the next steps as we would otherwise?
|Make sure it’s possible to indicate priority
Make sure cost associated with priority delivery are available
|‘I want to order the part so that we can move forward with the repair.’
Exhibit B: Working with the Sample Code on JS Fiddle
- If you’re using a library like JQuery, you need to select it in the JQuery panel (small icon with gears). You can see an example selection in the sample JS Fiddle for the case.
While machines are getting smarter and smarter, you’ll probably be surprised at how literal and specific you have to be when programming. A single semicolon in the wrong place can break your whole program. That may sound daunting, but all it really means is that you have to be very step-wise and test-driven when you program.
Notice that each full line/statement ends with a semicolon.
Logging to the Console
Since all of the work we’re doing is in the browser, that’s a good place to look at what your code is doing so you can expand and debug it in a test-driven way. Unless you have a strong preference and prior experience doing otherwise, I recommend using Google’s Chrome browser, and the rest of this material assumes that.
1: Click ‘Settings’ in the upper right
2: Disable the option ‘Console in the editor’
From there, to see the console in Chrome just right click within the browser and click ‘Inspect’. Now in the top of menu of the frame that appears, click ‘Console’. You’re there. For more, see this tutorial: The Console in Chrome.
The JS Fiddle below has the two statements you saw before, but now they’re sent to the console:
If you have the console open and you click Result, you’ll see the results of those two statements. Pro tip: You’ll probably be seeing other output from content on this page and maybe your own Chrome plug-in’s. If you use the filter control in type ‘index’, you’ll see just the JS Fiddle stuff.
Note: You will not see the console in JS Fiddle itself. The ‘Result’ screen shows what a user will see.
The If … Else Statement
Another thing you’ll notice in the sample code is if … else statements. Here’s a JS Fiddle with an example:
Comments and Commenting Out Code
You’ll see comments and you’ll probably want to use them to make notes to yourself and temporarily disable code as you’re trying things. For more on that, see this quick note: Comments in Javsascript.
Variables are a place you can store a value to use it later. If that sounds abstract, trust me, you’ll be doing it all the time once you get coding. In this snippet, we declare a variable ‘x’, change its value, and log that value to the console.
Quick note on variables vs. comparisons: In JS, ‘==’ is a comparison operator, meaning it asks ‘are these two things equal?’. The operators ‘!=’ does the opposite: checks if they’re not equal.
JQuery is a widely supported library for helping developers interact with HTML page elements, and you’ll see it used in the case. Here’s a quick JS Fiddle with an example of what it does:
This diagram unpacks the function’s plumbing:
If you’re itching to dive in to the case, here’s a very quick reference: JQuery Introduction. If you want a somewhat more structured, gradual introduction, check out the first resource below- the Codecademy tutorial on JQuery. I think you can probably get going after just the first lesson (JQuery Setup). I offer this with the usual caveat: be careful with your time and just cover enough to get comfortable engaging with the case. Also, there are a couple of specific sections I would skim/skip and I’ve noted those in the reference.
Final note: You’ll notice somewhat different JQuery conventions in the W3C tutorial vs. Codecademy: this kind of thing is unfortunate but not uncommon. Here is an explanation: JS Fiddle- JQuery Conventions.
- Introduction to JQuery on Codecademy
While it’s not essential to understand the details for purposes of this case, it’s worth generally understanding how JQuery relates to ‘plain’ or standard JS. As an external ‘helper’ library, JQuery’s charter is to abbreviate, standardize, and generally make JS interactions with HTML easier to create and maintain. However, standard JS (governed by a non-profit called ECMA) has come a long way toward making this type of work easier.
For example, the following snippet implements the search button functionality you saw above with plain JS: