Bloat or Evolution?


There has been a lot of discussion over software bloat over the years (the latest entry at: http://www.codinghorror.com/blog/archives/000973.html)  The question is not whether it is bloated or not, it is.  The question is, how did it get that way?

 

The biggest reason software gets bigger over the years is because companies keep adding features (duh!).  Yet, people condemning "bloat" in all forms seem to think that companies and marketing departments exist in a vacuum and just pull new features out of the amazingly thin air of said vacuum.  The truth is that most of these features are requested by end-users and they are adding in order to keep the customer base happy.  A pretty important point in a market economy.

 

Once software is released in the wild, it tends to take on a life that the original developers never dreamed of.  People come up with all sorts of creative ways to use it and, naturally, hit limitations that they think should be removed.  With each broadening of the software's focus comes the infinite loop of new uses followed by further broadening.  Over time, you get products like Word and Excel which do pretty much everything but make mounds and mounds of Julienne french fries. 

 

Not all products should have all features and the business should exercise restraint on many of the features that are added.  You might want to add that as a standard question in your feature review: Should WordSheetViewer Deluxe Pro XXL be able to broast chicken while still fitting into a pocket and alleviating lower back pain?

 

It's hard to say "No" to a paying customer but perhaps the business should look on those situations as opportunities.  Each of those requests is a customer telling you that they have a need, and that your product is very close to filling it.  They are also telling you that you have achieved a modicum of trust in the relationship as well, otherwise they wouldn't talk to you at all.  What is the feasibility of some of those requests being rolled up into stand-alone products?  Even niche products have a market.  The benefit here is that development time would likely be small since you already have a substantial amount of the code written.  Support costs would also be reduced because the new product is based on a (hopefully) proven code base.

 

 

Where do we go from here?

I think that the add-in model is the way to go but instead of installing everything but the kitchen sink as part of the base product, include only the barest minimum as the core.  Then make all of the other features available as free or easily accessible add-ins.  That way, people who only use 50% of the functionality will only need to install 50% of the features.

 

Most importantly, make the API for your App and Add-ins detailed and readily available so that third parties can easily extend the product.  You might just gain a loyal following from people who would have been your competition's testimonials.

New Use for Gmail


 

I have been a user of Gmail for years and still love it as much today as I did back when I was able to first sign in.  That's why I was pleasantly surprised when I came up with yet another way to use it.

 

I deal with many servers that cross numerous system boundaries and I find myself occasionally having to copy textual information from one server to another and, in some configurations,  mapped drives and copy-paste simply aren't available.  This leaves the old stand-by of manually re-typing the information or getting a server support monkey involved and spending an hour talking it through a 3 minute change.  However, almost all of these systems have internet access, which is where I my idea came in.

 

The problem with commonly available internet applications is that there is no quick, easy and reasonably secure way to put data onto a public server on the internet that can be easily managed from multiple locations.  Those that are available involve setting up some form of CMS or FTP, and FTP is almost always disabled or blocked at the firewall. Then my idea struck – use the drafts feature of Gmail to move data across systems.

 

How it works

  • Sign into my Gmail account on the source machine and the destination machine using https://mail.google.com/
  • Create a new message on the Source machine and paste the text to be copied into the message body
  • Save the draft
  • I switch over to the destination machine and open  the draft
  • Copy the text and do whatever I need to with it
  • On rare occasions, I've also used the attached files option of the draft to move files between machines.

 

Advantages

  • Easily, quickly and securely copy data across systems without risking typing errors
  • The draft is shared between computers so you can make changes to either copy and have that change immediately available on the other computer with a simple refresh of the page
  • Drafts can be saved for quite a while or even forwarded on to someone else so that they can see what you had to change.  It's always nice to have changes saved in something a little more permanent than a clipboard buffer.  (Yes, I know, in large corporations, this is handled by a change control process.  This is for the 90% of us that don't work in that type of environment)

 

Ok, so how does this even remotely touch on SharePoint?  One word: Web.config .  The changes that often need to be made in the SharePoint Web.Config tend to be rather difficult to type without error.  Things like GUIDs and Keys abound and are amazingly annoying to type.  This way, those items can be copied intact and I won't have to spend hours troubleshooting a fat-fingered GUID.

 

Obviously, this will not always work due to firewall, proxy, policy and security restrictions but it has worked well the few times I've needed it.  Also, be aware that it likely a violation of company policy to host confidential data on a public server (even temporarily) so be careful what you use this for.

How to access the Embedded database used by Sharepoint


Sharepoint likes to use the Embedded version of SQL Server when you choose a stand-alone install of WSS.  Normally, this is not an issue but there are times when you need to get into that database.  Unfortunately, getting into that database is considerably more difficult than you might expect.

Why would you want to get into a database that Microsoft keeps you out of intentionally?  In my case, I had to switch an existing installation from using the default NETWORK_SERVICE account to a domain account.  An account that had no permissions in the WSS databases whatsoever.

In order to get into MICROSOFT##SSEE

  1. Log on to the machine running WSS as a user that is in the Administrators group
  2. Open Sql Management Studio (I'm told that the Management Studio from Sql Server Express will also work)
  3. Enter '\.pipemssql$microsoft##sseesqlquery' as the Server Name (minus the quotes)
  4. Rejoice

From there, I just added my domain account with the proper permissions and WSS was happy again.

The Value of a TestApp


The single greatest programming I’ve ever received is this: Use test apps religiously.  In this world of Nunit and the like, perhaps I should explain what I mean by test apps.

What is a test app?

A test app is simply the absolute smallest amount of code that you can use to create your new functionality in.  In my case, I usually create a new Windows Application in Visual Studio and put starter code in the Load event.  If I feel like being extravagant, I’ll drop a button on the form and put the hook code in there instead.  That’s it; the entire framework of a test app.

A test app is meant for creating a single piece of production code.  It lives for the code, it dies for the code and nothing beyond what is needed to support that code should *ever* be added.  Do not fall into the trap of creating a complex test application that can handle dozens of bits of code.  This is unmanageable and defeats its own purpose as the code in it gets further removed from the real code over time.  Disk space is cheap, don’t be afraid to create a few folders.

Test apps are not to be confused with Test Harnesses and utilities like NUnit.  These tools are invaluable but are meant to be applied to the full body of code.  The test app is only for one little bit of functionality.  If you really feel that compelled to use NUnit everywhere, you can wire it into your test app as well 🙂

Why a test app?

  • Lightning fast revisions and compilation. Since the test app is so small, you can test, fix, build and retest several times in the same amount of time that it would take to compile the main application once.
  • Fully Isolated debugging. If it breaks in the test app, you are 99.999% sure that it is your code. In the main app, things can break for an almost infinite number of reasons. Perhaps someone checked in bad code, the database is down, someone playing with test data – all of that is completely unrelated to the code you are working on but slows you down nonetheless
  • You get full debugging abilities on the test app. This may not always be the case in your test environment. In many test environments, you are limited to writing to logs for everything. This is nice, but far less useful than a fully interactive debugger.
  • Rich testing. You can define any number of scenarios to run your new functionality through simply by copy-pasting a line a code in the Shell and changing a parameter or two.
  • Performance testing. If you suspect that your code might be a bit slow, it is trivial to set up loops and timers in the test app. I can run my code through millions of iterations with almost no effort in the test app. Try setting up this type of test in the main application and you will immediately see the perks.
  • Easy experimentation with unproven algorithms. There are times that you need to feel your way to a solution in code. This provides a completely safe environment to do this in. Trying to do this in the main app often requires a lot of instrumentation in order to call the new logic, all of which might just have to be undone if the algorithm doesn’t work.
  • Known code. Because of how small the test app is, odds are good that you will walk through the code in the debugger quite a few times while working on it. This simple task might be all but impossible in a shared dev environment.
  • Generic. In creating your new code so that it can be tested in the harness, you might discover that it works just fine if you define a parameter as IEnumerable instead of ArrayList or a custom collection, making it potentially even more useful to the main application.
  • There’s also a free bonus benefit at the end of the article

The Code

Here is where a little design goes a long way.  Write your new logic so that everything can be passed into it as parameters (your eventual production code will thank you for this!).  If you are creating a new class, provide constructors that allow it to be set up with enough information to make the class think it is in the real app.  Ideally, your new code should know nothing about it’s environment other than what is fed to it.

ABOVE ALL – TREAT THIS CODE LIKE YOU WOULD PRODUCTION CODE.  No hard-coded values, no assumed paths, etc.  If you need something like that, pass it in as a parameter.  This is so that you can literally copy-paste this logic into the larger application unchanged.

The Shell

Create the absolute least amount of code needed in order to support the functionality you are about to write.  By this, I mean hard-coded parameters and the like.   The shell is meant to be dirty, ugly code that you wouldn’t show to anyone – even for money.  Its sole reason for existing is to be a fast way to call your new functionality, not as a show piece for CodeProject.

Connect it up

Go back to your shell code and connect it to your new code.  Does it work?

Test it and test it again

Once you have it working the way you want with the expected inputs, you can play all sorts of games with the code.  Hard code values in the parameters to test out error handling or to simulate conditions that may be very hard to reproduce in the main application.  Testing and fixing these sort of issues in a test app is easily 10 times faster than trying the same thing in the main application.  The bigger the main app, the greater the advantage of using a test app

Drop it in

Since you went through the effort of putting your new code into its own black box of sorts by parameterizing so much of it, dropping it into your real application is almost a no brainer – just feed it the parameters it needs and you are pretty sure that you have a reasonably well tested body of logic in place.

Revisit

Once you have the code in there, run it through it’s paces in the main app.  If it breaks because you have, say, a null coming in where you hadn’t planned for one, its nothing to fix.  Just create another test in your Test App to simulate the new situation and debug away happily.  When fixed, drop the updated code back in again.

I Object!

This is great and all, but isn’t this actually extra coding?  Yes, slightly.  The shell might take you 30 seconds to create if you type really slow, and then the main hooks another 2-3 minutes or so.  The rest of the code you have to write anyway so you might as well do it in a place where you can beat the snot out of it easily and quickly.

No way, my test environment is SO complex.  That might be true, but that doesn’t mean the functionality you are writing needs to know about it.  Odds are good that it can be abstracted pretty easily.  Not always, but more often than you might think.

Enjoy!

I have written several thousand test apps in the 12 or so years that I have been using them and have never thought even one to be a waste of time.

Freebie benefit

Remember I said that you should never show your test app to anyone?  That’s not entirely true.  There is one person who will be *very* grateful for it – the guy who comes to you and asks: “How do I use your object?”  You just toss him your test app and he can immediately see not only how to call it, but what you had in mind for it when you created it.  For most of us, a quick example with actual code is worth a 1024 words.

Speaking of which, here’s a somewhat contrived example of a test app:

Sample Code

Worthless Backups


What is with corporate backups? I’ve been in this field over a decade and have yet to actually see a Restore of anything actually work. Seriously! Files, databases, anything. Anytime that I’ve been in a situation that needed something restored from backup, the backup was either corrupted or the systems people lacked the ability to selectively restore only the item needed.

I actually had a system admin tell me that in order to restore a file, he would have to restore the whole volume. This was all the worse because this was a Fortune 500 company and I know that their backup software and systems were state of the art. They just put a moron in front of it and assumed it would still do miracles.

Companies spend a fortune on backup software, disaster recovery planning and the like, yet, when it is really needed, the data is nowhere to be found – as the recent incident in Alaska is yet another indication. (Alaska Department of Revenue vaporizes $38 billion account)

Thoughts and comments from deep in the software development jungle