Category Archives: Development

PHP On Azure Resources

I’m at JumpIn Camp in Zurich and we’ve been diving deep into PHP on Azure. One of the things that we’ve done is talk about a ton of resources that are available out there on the web to learn more about PHP on Azure. To that end, I thought I’d collect a few of them here on my blog.

In the morning, I talked at a high level about what Azure is, how the various roles work and how to run PHP on Azure. My deck that I used was the first half of the same deck that I used on the PHP On Azure World Tour.

Another great starting point and set of resources is Maarten Balliauw’s Blog itself. He’s been helping out here at JumpIn Camp from a technical perspective on Azure and running PHP on Windows in the first place. He did the next part of the session diving deep into the PHP on Azure SDK.

You’ll notice some overlap between our desk because we’re largely talking about the same SDK and leveraging the same code examples.

Maarten’s first deck that he used to talk about Blog, Queue and Table storage is:

The second one that Maarten used to talk about SQL Azure is:

Maarten also did a demo of an app called ImageCloud leverages both a Web and Worker role to do front end uploading of an image and backend processing of that image. That code can be found at ImageCloud Azure Demo Application.

For some great resources on architecture guidance, take a look at Windows Azure Architecture Guidance. This is put out by the Patterns and Practices group at Microsoft.

 

Another great resource is Benchmarking and Guidance for Windows Azure. This was created and launched by the Extreme Computing Group (aka XCG).

 

More resources:

Microsoft Windows Azure Interop

Microsoft Interop Bridges

Windows Azure 4 Eclipse

PHP Azure SDK

Windows Azure MySQL PHP Solution Accelerator

 

I’ll be adding to these resources over the course of the week so check back for lots more.

Solid Error Messages

Writing good error messages is an art form. It’s important though because the error messages are often the only communication with the user in an already frustrating situation for said user.

I was on Plaxo earlier and got this error message.

There seems to be a problem. I'll tell you what... let us fix it and this can be our little secret. Please wait 30 seconds and try again.

At first, I was a little annoyed that there was an error. But as I read the message, I was amused. The situation was completely defused and I tried again in 30 seconds. Guess what, it worked.

I’m not “keeping the secret” but I started thinking about it and realized how brilliant it is. Your user doesn’t care what the error was because they are not typically (yes we are anomalies because we, as techies, care) interested in if you are not able to connect to SQL Server, or a service that you’re depending on is down or anything else. They want to know that you didn’t just forget about them and that you’re aware of and working on the issue.

errorMethod '~' of object '~' failed They definitely don’t want you to speak techno-babble with them. One of the all-time failures is the “errorMethod ‘~’ of object ‘~’ failed” error message from VB6.

This not only spoke techno-babble at the user, but it gave no useful information or distinguishing information. And it popped up all the time. This error message told me that the developer had not done the appropriate error handling.

I guess that reminds me that the first thing that you need to do error handling in the first place. There are a lot of really good strategies for this. Personally, I really like to have belts and suspenders type methodology here. I use a combination of solid defensive programming (such as checking nulls) as well as global error handling and local error handling in every path. Down to the routine level is probably not the right choice in every case, but the path level is.

Keys to writing a solid error message

Inform. Let the user know that there was an error and you are aware of it. This is especially true with online or connected applications. It’s important for the user to know that the error didn’t just go into the bit bucket but is actually logged and will be looked at. This is, of course, assuming that it’s a true statement.

Apologize. It’s your fault for allowing the error to happen. I, and your user, don’t care that it was an outside service that caused the failure. I was accessing it from your application and you should have planned for this.

Give directions. Now that the usual flow has been upset, what should the user do next? Should they call someone for help? Should they write a letter? Should they just try it again?

Collect additional information if needed. I like the error collection routines that ask me what I was trying to do. This gives me a chance to talk about the other things that might or might not have contributed. This is not always going to be useful but occasionally this will surprise you.

Think. Very often, the error messages are an afterthought or written by the same devs that are writing the rest of the code. This is only appropriate when the dev has a background in linguistics and communications. You should check and double check every error message.

Software Development Meme

Jeff Blankenburg called me out with his Software Development Meme. It’s actually a funny thing that he did because I have a much different background than much of the industry. My undergrad is actually English with a minor in Drama and a minor in Communications. When others are talking about programming outside of the box, I ask the really simple question of “What box? – nobody told me about a box…”

How old were you when you started programming?

21. Yeah – you read that right – 21. Honestly, I couldn’t type until my junior year in college. Somehow I made it through high school without the “required” typing class.

How did you get started in programming?

There are two stories there. The first is my first bit of play/consulting and the second is my first job out of college.

In ’96 – when I was in my senior year of college, JavaScript was new and starting to be the hotness. Live everyone else, I got started creating a web sites. I tell you I wouldn’t have made it through without Stefan Koch. I’ve never met the guy but his Voodoo’s Introduction to JavaScript (which I can’t believe is still up), I wouldn’t have made it through. I actually did a few small consulting gigs with JavaScript including a web shopping cart. Lots of fun.

When I was approaching graduation, I was trying to figure out how I would support a family on an English degree so I got a job doing COBOL. It was while the banking industry was staring down the barrel or Y2K and they couldn’t hire enough people and non of the CS majors would dirty themselves with COBOL. They were looking for liberal arts majors that they could train in COBOL. I fit the bill and got the job. After about 6 months of that, I realized that I really enjoyed telling computers how to do what they do but I couldn’t put into words the loathing that I felt toward the main frame. When it would take me up to 6-8 hours to get an application change compiled and tested only to have to read a hexadecimal dump to debug the app – I about went nuts. It’s inhuman to subject people to that type of torture. Story continued below…

What was your first language?

As per above – HTML/JavaScript and COBOL.

What was the first real program you wrote?

As above, personal web sites, shopping carts and a checking account system.

What languages have you used since you started programming?

As above, I started with HTML/JavaScript. Then I moved to COBOL. Here’s where the story picks back up. I hated working on the main frame so I picked up a copy of Borland’s Delphi 2. I started doing little side projects and wrote a multi-player tic-tac-toe game and some other fun utilities. There wasn’t a problem that I couldn’t (and wouldn’t) throw my new hammer at.

After a year and a half in main frame hell and a year doing a Delphi on the side (Delphi 3 at this point), I heard that the Client/Server division was hiring. Not only were they hiring, they were putting the new college grads that they were hiring through a 6 month training course where they taught them VB, C++, NT, Unix, relational database design, Oracle, Tuxedo and all of the other tools/process/language/platforms that they used. The thinking behind it was that new hires direct from campus are typically 12+ months on the job before they are productive and they need to unlearn much of their CS degree anyway.

Desperately wanting out of the man frame division, I leveraged my English degree and picked up a book on C++ and read through it. I went over to my friend Tito Martinez (who I’ve since lost contact with and would really like to hear from hint hint) and he taught me what the critical things that I needed to know to get through an interview. I still wake up screaming in the middle of the night with the nightmares from that interview thanks to Denny Williford who was really tough on everyone that he interview. Somehow I made it though and got into the class.

In the CS University I learned Visual Basic 5, C++, relational database, Oracle, SQL, system design, UML, COM, UI design, NT, Unix and much more. It was a great class. It was during this class that I met Richard Hale Shaw – more on this later.

After class, I worked in the production environment building a teller system. The client was VB (VB6 by now) running on NT talking to C++/COM components talking via Tuxedo to the Unix server running C++, our own flavor of COM and Oracle as well as interfacing with the CICS regions on the main frame. Honestly, I’m terrified at how typical that was as I’ve talked to more and more companies that had almost that exact setup. During this time, we developed a VB6 based client framework that, on login, dynamically loaded up the components that this particular user in their role were allowed to load up. Later in life – CAB made complete sense as that’s basically what we had done.

While I was in the client/server division, I started speaking at conferences. At some point, I impressed someone well enough that they offered me a job doing Python dev, so I (in normal fashion for me) picked up a book and started playing around. It’s funny that I don’t remember that in normal conversations but I was playing with Python a little back in ’99/00 time frame.

At some point, they decided to train more main frame guys on the client/server technologies. And who better than a former main frame guy to do teach the class? I had 10 students for 6 months. That was intense! And it was my first shot at teaching so it was extra fun. I can tell you that I learned at least as much as the students did during that class. After the class, I joined the training department for a short time and then went independent.  

As an independent, I did a lot of training through the Richard Hale Shaw Group. I ended up writing all or part of and teaching the XML Bootcamp, C# Bootcamp (majority of this written by Richard or Martin Shoemaker), VB.NET Bootcamp, ASP.NET Bootcamp (C# most of which was written by Dominic Selly and VB.NET). I also did some side consulting. I could list XSLT, XML Schemas, VBScript and many other things that I used while teaching the classes but that’d be cheating as some people don’t consider them real languages.

I did do a little bit (and I mean a little bit) of Java. But I never really considered myself an expert by any stretch of the imagination. I got paid for it though so I’m counting it… 🙂

After that, I joined SRT Solutions for a year and a half or so. Then I joined Microsoft. While at Microsoft, I’ve played a little bit with Python again and fallen in love with Ruby.

What’s that make it (other than the wordiest answer to this questions you’ll find?) – HTML, JavaScript, Cobol, Delphi 2 and 3, VB5 and VB6, C++, COM, UML, SQL, XML, C#, VB.NET, Java, XML, XSLT, VBScript, Python and Ruby. That’s quite a few there on a single line but it’s nothing compared to some people like Jay Wren.

What was your first professional programming gig?

Answered above.

If you knew then what you know now, would you have started programming?

I’ll answer in true form and say that it depends. It really depends on the day sometimes. I love technology, learning new things and all the things that go along with this industry. These are the days that I look around the industry and see great companies that are literally changing the world (not going to get into which ones because that is a political rathole that I’d like to avoid in this post) through software. The fact that I’m part of that is really exciting. I can look back on my career and the companies that I’ve consulted for or taught at and see the results of my work internationally. That’s a good day and I’m proud to be in tech on those days.

However, there are the days when I get a call from some poor user/mother/company/* and hear about how technology has made their lives much more complicated and made things harder for everyone. That’s when I wish that I had started a motorcycle repair shop instead. I’m hoping that’s my retirement.

If there is one thing you learned along the way that you would tell new developers, what would it be?

It’s the non-technology skills that really separate the good from the great in this industry. I’ve known a lot of really smart programmers that could go 10x as deep as I can in a given technology. However, those skills have a half-life. The {} style languages reinvent themselves about every 10 years. The data access methodologies move at close to that speed. Networks have changed the way that we’ve thought about software and the internet stirred the pot that much more. I could go through and talk about all the ways that the industry has leapt forward in the short time that I’ve been in it but that would pale in comparison to the war stories that a Martin Fowler or Neal Ford could tell.

What’s the most fun you’ve ever had … programming?

I’ve had a lot of fun over the years but one that stands out recently is working with J Sawyer and Chris Koenig on the We Are Microsoft weekend on the St. Vincent DePaul Volunteer Portal. I heard that there via Twitter was a team that bailed and Chris was scrambling to find some help so I volunteered from Michigan. We spend the weekend working on the portal and it was a ton of fun.

Who am I Calling Out?

Jay Wren

Joe O’Brien

Dustin Campbell

Rich Weston 

Larry Clarkin

Scott Hanselman

Who’s next?

Wanna Extend VS.NET? Let DonXML tell you how…

VS>NET is a great set of tools – however, sometimes it’s not all that you need. In those cases – VS.NET is a great platform to build tools on top of and you can extend it to do a ton of different things.

There’s a great webcast coming up on May 3rd presented by my good buddy DonXML… Don Demsak, AKA DonXML, is a Microsoft Most Valuable Professional (MVP) for XML and a Microsoft .NET solutions architect who specializes in architecting and programming multi-tier applications using the Microsoft .NET Framework. He is also a technology evangelist known for advocating the benefits of XML, Contract-First Web Services, and the .NET Framework through blogging and various Web discussion groups. Don is a cofounder of the Mvp.Xml open-source project (www.mvpxml.org) that enhances XML capabilities in the .NET Framework. The Mvp.Xml project includes XPathmania, which adds XPath testing support to the XML Editor in Visual Studio 2005.

http://shrinkster.com/o5a

Sharepoint Web Services For Remote Portlets (WSRP)

In conversation, someone brought up a Java WSRP implementation and I thought it was an interesting idea. Web Services for Remote Portlets (WSRP) is an Oasis standard defines a set of interfaces and behaviors that allow you to embed content from as web service on your page but more importantly, it allow that content to be interactive with the web service so it’s more than just pulling the HTML. Clicks and other events funnel back to the origional site so that you don’t have to write the backend processing for those controls. This is an interesting idea so I started looking into it.

I was thinking on what would be required to write one, but it turns out that I don’t have to since there’s already one on GotDotNet for Sharepoint. There you can find the WSRP Consumer Web Part Toolkit and the WSRP Producer Web Service Toolkit.

It’s a facinating idea and I can see real possibilities with it. The question that I have is – has anyone used this yet? How well does it work?

Test Driven Development

Last night Eric Maino (http://www.meeteric.net) gave a talk at GANG (http://www.migang.org) about Test Driven Development (TDD). It was a very good talk that touched on a lot of the important issues involved in testing. It was a good overview of NUnit (http://www.nunit.org) and how TDD works. The slides will be up on the GANG web site soon.

 

One of the questions that came up was how GUI testing works with NUnit. I happened to attend a talk at SD West (http://www.SDExpo.com) by Elisabeth Hendrickson from Quality Tree (http://www.qualitytree.com) on that exact topic. She has been working on a test harness for GUI testing that’s built on NUnit. You can learn more about it here – http://www.qualitytree.com/autotest/dotnetgui.htm.

NUnit Stands the Test – Follow up

Patrick Steele made a good point about my last post on Unit Testing. The code that I wrote just happened to use the Test keyword at the beginning of each of my methods. That’s not required. I just happed to like that convention because it reads well.

I do use the attributes and encourage everyone else to because, as Patrick also points out, TestDriven.NET and other tools don’t use it.

Look for another article on TestDriven.NET early next week.