Evidence of Adhocracy? 5
I really like open source, it gives clients comfort, developers solid foundations and end users never need to know about it. Why should they care!
Today, being the thick headed person that I am, I realise in my gut, what it actually means to companies. And this may be the biggest blow to the adoption of opensource.
To companies it means they no longer have a hold on things, no longer have ownership. To me, that’s a good thing, but to them I can see it would be scary.
Let me explain.
This morning I see an item on Slashdot (if you need a link, you just aren’t ready to read on!)
Sun’s JRuby Team Jumps Ship To Engine Yard
reading that, I realise, ‘software wants to be free’ is not just about being able to use ‘free software’ anywhere, it means the software itself is not tied to any company to develop it. The news of this team of developers jumping wholesale from one company to another AND TAKING THE PRODUCT WITH THEM is a sobering example of what this means. Companies do not ‘own’ the opensource projects they foster, they are mearly the custodian, and this custodianship is contingent entirely on them stepping up and being good citizens. That cannot translate to the balance sheet and the earnings call. I can see how, in the shareholder culture, opensource could be a very dangerous and difficult sell.
Finally, will MYSQL follow? Or, should the question be, when will it follow?
Amazing Languages - Broken Promises 6
Today, a friend linked me to this it is an scheme environment with extensions. It says it wants to be an environment for musicians and graphic artists to use for performance coding. There is an example here which is beautiful, haunting and inspiring.
But, watching that video, it reminds me soo much of "verse""http://www.uni-verse.org/ and a project using it called Love . It reminds me not because the two projects are similar, but for another reason.
I spent a little time playing with verse, not really enough to get any results, but enough to get the feeling that I did not ‘get’ the programming model. But watching screencasts by the author of verse, I could see he was getting amazing results.
When I watched the impromptu demo, I was struck by the same feeling. The language has amazing promise. The author is obviously able to make use of it to create wonderful things. But, looking at what was being typed, it looked like giberish.
So, I started thinking about both projects. Both verse and impromptu are systems that their authors are able to use to make incredible results very quickly. I fear that others attempting to use them would not fare so well.
So, what are these? I think they are a class of system I would like to call ‘personal expansions’. They fit tightly and intimately to the person who has created them and they have the internal models and mindset which allows them to make use of the tools to do mind boggling things. But, that because of that intimacy, it is hard for others to use them with anywhere near the same level of productivity amplification.
This is a shame, and brings me to the ‘broken promises’.
Both these tools are being pushed as ‘look what you can do’, when really, they should be honest and say ‘look what I can do’.
I am most definitely not scornful of either project, I think they are wonderful and I look forward to playing with impromptu some time when I have a few hours to spare, but probably only once I have revisited my copies of ‘The little schemer’ and ‘The seasoned schemer’.
Lost in the desert of freedom 9
In this time of frameworks and development tools, we rarely start from scratch. There is always some prescribed structure in place when we start a new project.
But, when there isn’t, we realise how much that structure leads us.
Microsoft Live Spaces, Metaweblog compliant, almost 9
Well, it IS microsoft after all.
I have spent this morning writing code to use the Metaweblog api access to Microsoft Live Spaces.
The problem is, that the api requires a field called BLOG_ID.
But, there is no way to know the value you need to use for this field. There is no setting for it in their settings panels.
There is no way to get a list of the blog ids through the metaweblog api.
BUT, in typical fashion, Microsoft have implemented 1/2 of the metaweblog api, and small portions of the blogger api.
There is no method to upload image files (metaweblog.newMediaObject is missing) but there is blogger.getUsersBlogs, which allows me to find the value.
For my blog it was ‘MyBlog’ but because I cannot be sure if there is some place I have missed, where you can edit this, I have made the system pick out the blog id of your first blog.
Now, on to looking at MoveableType.
Sometimes I could cry. 60
I have been working recently on a project I started about 2 years ago, and which has subsequently been through several sets of hands.
The project involves recreating the functionality of a visual basic application as a web app in ruby on rails.
The original application was written by a non-coder, slowly and painfully, and with no regard to good design practices.
When I started it, I rationalised the database format to remove duplication of information and make it much more normalised.
Since then, ‘other hands’ had the job of writing code to bring over the historic information from the vb system to allow us continuity. Now, when they did it, did they take time to appreciate the nicely denormalised database structure, the power and elegance of the code supporting this new db layout and code to the new layout?
OR! did they denormalise a load of the tables taking them closer to what the other application does? and in so doing require loads of additional standing data tables, that had been replaced by class bourn settings?
Yes, the latter, and now, I have been tasked with setting up a new instance, and I don’t have what should be in those other tables.
I could cry, I really could.
Don't cross the BEAMS! or, RSPEC? where's my data?
I am working on a project at the moment, using RSPEC.
All was going swimmingly until I started using fixtures for some of the data.
Once I did, some of the specs (not always the ones mentioning fixtures) started falling out of bed.
Tracing why is a salutary lesson.
On recommendation from peepcode, the original developer of some of these classes had populated the database from ‘before’ clauses.
But, then he had got inventive, and moved the calls from the spec files into the spec helper, to be executed at global scope.
This was ok, until I started to add fixture data for some of the specs. When I did, I started receiving errors from the rspec code itself, not caught by rspec and reported nicely as a runtime error from the specs. This meant it was very difficult to find where the failures where.
Note, I have not looked at the appropriate source for the parts of rspec that are causing the problem, so this is based on observation of the actual results, not from analysis if code.
I added a fixture, and using fixtures seems to trigger the database tables to be handled in a different way. Specifically, it seems to alter when the tables get cleared down. This was causing the attempted writing of duplicated data into the tables to fall foul of validations. Because the errors where happening ‘behind the rspec curtain’ they where just bombing rspec, not telling rspec to report a problem intelligently.
Also, the test suite used to work such that if you did not mention a fixture for a specific test, it assumed you where not using that table, and did nothing to it, thus leaving all sorts of detritus there from other tests, it feels like rspec does something similar.
So, in summary, it is a REALLY bad idea to start loading data into tables from your spec_helper.rb file. And if you do, be aware that then using fixtures can cause you untold sessions of headbanging and ‘angry german kid’
Bending sql to your will. Crossing an sql table with immediate data. 1
Well, you are probably wondering what prompted my last post about ‘sql ghettos’. And well you might. The incident that spawned the term happened over a year ago.
But, I thought I should get my personal stand on the matter documented before I offer this little tid-bit of sql twistedness.
In a current application I am working on, I need to produce a list of items for which work has NOT been done.
Work being done is recorded against the item by attaching a tag with the name of the work task.
Gathering a list of items to be worked on next therefore means looking for items which do NOT have specific tag values associated with them.
Previously, it was good enough to find items for which not all the tags where defined and then spit out a list of the items. That was fine, and handled by a simple piece of code that just counted up how many tags of specific names each item had, and if it had less than the number I was looking for, include it in the list. Fine, jobs a good un, put your feet up, have a cuppa.
But NOW, I need to start keeping track of which tasks have been released to which systems running the jobs.
In order to do this, I need the end result to be a list of items, and where that item does not have a tag, I want a ROW returned with the id of the item and the tag THAT IS NOT THERE.
This is a vastly different argument, and requires you to start searching not just for a low count, but searching AND FINDING things that are not there.
This can be split up into two steps…
- generating a list of the items crossed by the tags you are looking for.
- decimating that list on finding the tag present.
The first step sounds simple, until you remember that the tag might be referencing a totally new piece of work that has never been done before, and so will not be resident anywhere in the tag table.
So, what you are asking to do is to be able to ‘cross’ an sql table with an array of string literals.
Now, stop, go away and try to do it.
I will discuss my solution after the break…
Web development frameworks and SQL ghettos. 2
My platform of choice is Ruby on Rails.
In an early project, I implemented some reports by coding special purpose sql statements embedded within model methods. This worked well, and allowed the reports to run reasonably speedily.
As I continued to maintain the application and requirements changed, I found that I was reluctant to change the way the model objects interacted as it would require not only changing the model code, but sifting through the mounds of complex and convoluted sql.
What had been an efficient way to handle a problem (generating the reports quickly but in coding time and in runtime) had resulted in ‘scar tissue’, or maybe a fossilisation of my object model structure within the body of the sql.
Over time, this caused me to change the way I was altering the design, by forcing me to add layers around classes instead of refactoring within them.
After I finished on that project, I reviewed what I had done and vowed never to create sql ghettos again.
I think it is an apt term ‘sql ghetto’. An area in your application that you almost dare not go. that hinders future development, forcing it to work around it.
Resist the temptation to make ghettos, for they will surely come back to haunt you.
Rails to_xml, thar be dragons.
Ok, so I have been using to_xml to handle generating xml serialised lists for a restful xml interface.
I came across this interesting situation.
If you are serialising a collection which is implemented as a set of subclasses using STI, the to_xml will generate different xml depending on which class of items it sees first.
For instance, if you start the list with an instance of the base class, it will generate a list encapsulated with the plural name of the class name, and each element will be a singular of the class name for the base class, irrespective of which classes each of the objects are.
BUT, if the first item in the list is one of the subclasses, the to_xml call will see that it is a heterogenious list (presumably because the successive items don’t all return ‘true’ for .kind_of? of the class of the first item, and will generate a xml list encapsulated as <record> entities within a <records> list.
Oh, that makes me SOO happy.
Quote of the Day
“A software developer is in the unhappy state that by the time he knows everything he needs to start work, he has probably finished”
Who said that?
Peter Morris, 2008.