God No! ...The ReBuilder
Do you ever have a software idea so horrible that you feel physically sick?
At times like that, you can block out the idea immediately, but I find it's best to follow the idea through to it's logical conclusion.
So here's a repulsive idea I had, which I've since discussed with a bunch of people who helped flesh it out a little more, making it extra terrible.
Introducing 'The ReBuilder'
Ah, yes. It's called 'The ReBuilder'
Here's an example of what happens when you're foolish enough to use it.
So, you open up Visual Studio and choose to create a new console application.
You type the line:
var person = new Person();
Try to compile and see an error, essentially 'Person? No such type!'
"Error 1 The type or namespace name 'Person' could not be found (are you missing a using directive or an assembly reference?)"
Rather than have the programmer waste his or her precious time creating this new class, the Rebuilder does it for you. It goes right ahead and creates a class with the name 'Person'. It doesn't ask you to confirm the action, it just goes ahead and does it. No ifs or buts. Where does it put this new class? Wherever is the most conventional place. It builds the application again, right away. There's no new compilation errors, so it rests.
You type another line of code... you now add:
person.FirstName = "Jim";
The rebuilder picks up on this straight away. (Actually, screw it, you don't need to specifically try and build... this is a background compilation. It's always present.)
Rebuilder notices the resulting error...
"Error 1 'Person' does not contain a definition for 'FirstName' and no extension method 'FirstName' accepting a first argument of type 'Person' could be found (are you missing a using directive or an assembly reference?)"
Clearly you're not after a method called FirstName, you're after a property. So rebuilder adds a property named FirstName of type string. No magic.
Next you try to save your object...
This yields a fresh error:
"Error 1 'Person' does not contain a definition for 'Save' and no extension method 'Save' accepting a first argument of type 'Person' could be found (are you missing a using directive or an assembly reference?)"
This time the missing method is, indeed, a missing method. So ReBuilder gets in builds a method with the appropriate signature.
And it doesn't flesh out the body of the method with some dodgy 'Throw New NotImplementedException()' bullshit like the 'Generate Method Stub' feature in Visual Studio. It analyzes the name of the method, and implements it on your behalf.
"Hmmm, 'Save'," thinks the ReBuilder. "I guess you want to 'save' a person." So rebuilder writes a save method, saving to the most conventional place it knows: the database.
If there's a useful database connection in the application, then it uses that. If not, it creates one.
If the database contains a table named 'person', it will save to there. If not, it will build a table.
If there's no database to begin with -- well the ReBuilder goes ahead and builds it.
Obviously, you wouldn't do all this without any code coverage, so hell, RB churns out a sweet suite of tests to cover all the branches of the save routine.
(If the database, and the person table already exist, then we make sure all the relevant properties exist. This might include creating a migration script for updating any other environments with previous versions of our database)
Next you type:
"Hmmm. Judging by the name
It looks like you expect a well understood pattern to be implemented.
(Yes, this bit is blatantly inspired by Ruby on Rails use of method_missing...
def method_missing(method_id, *arguments)")
if match = /find_(all_by|by)_([_a-zA-Z]\w*)/.match(method_id.to_s)
And rebuilder will add an index to the Person table, on the column indicated by the property name, plus create the relevant goo for performing the expected retrieval. (And again, whatever tests are needed to cover all paths.)
Finally, you branch out a little and type:
ReBuilder, naturally, doesn't have a freakin clue what that means. It doesn't fit any known convention -- so it falls back on its "Convention_Missing" convention.
First, ReBuilder looks on Koders, Krugle, codase, google codesearch... every last place it can to see if any indexed open source code contains a method like the one we're after.
Failing that, RB opens your email account and writes to a few of your coder buddies (on your behalf) to see if any of them have experience with a similar problem.
Failing that, it sends a polite (though assertive) email to Scott Hanselman, asking him if he can (a)help out, or (b)point you in the direction of someone who can.
When a suitable method is located as a starting point for 'ReCalibrateAfterSolarFlare' -- it is pasted into the code, and a new compilation is attempted.
Rebuilder attempts to complete any compiler errors at this point through simple deducation, through the use of markov chains, through Any compiler errors at this point are submitted as polite (though assertive) questions at StackOverflow, in the persona of a very awkward but honest noob, struggling to solve this one temporary and specific problem.
While waiting for the responses there, ReBuilder runs a logo competition online at 99designs or crowdSpring, then holds back, letting the community provide the content as well as picking the winner.
Once the responses from StackOverflow are sufficient to get the code compiling, ReBuilder checks that all the unit tests (written by the lowest bidder at www.RentABusinessAnalyst.com ) are beginning to pass.
Once all code compiles and all tests pass, the logo is in place and the typical page layout and css are fully baked (munged together from every cool site mentioned on every cool design blog) the app is shunted onto the first available cloud computing platform, cross promoted at your facebook and twitter profiles, cross posted to reddit, hacker news and digg, where it's upvoted and astroturfed by a distributed swarm of sockpuppets launched by every other PC on the planet running a copy of Rebuilder Zombie daemon, promoted with whatever relevant google adwords are cheap enough to suit your budget, and plastered with enough punch the monkey ads to bring in a steady trickly of cold cash.
You, meanwhile, sipping cocktails on the beaches of Tahiti, receive an SMS telling you the app is done, and your resume is automatically updated with glowing details of the amazing "ReCalibrate After Solar Flare" 2.0 app.
No magic. None.Next → ← Previous
My book "Choose Your First Product" is available now.
It gives you 4 easy steps to find and validate a humble product idea.