Sword 1.0b5 · A simple and friendly weblogging tool for academic environments created by Fingertips design & development.

 
 
 
 
 

Ajax makes life more fun :)

TrackBack link: http://blog.markjuh.net/markjuh/trackback/2005/4/13/ajax_makes_life_more_fun

Published on 13 April 2005 at 11:09.

So, what have I been doing since last Friday?

Well, I’ve been busy with the prototype I’m building. Not quite sure what I did exactly on which day, but so far I’ve got comments to work. Mostly adding comments Ajax-style. Ajax, shorthand for Asynchronous JavaScript + XML, makes web interfaces more interactive. It relies heavily on XMLHttpRequest, which enables the use of asynchronous server communication. For more information see Ajax: A New Approach to Web Applications.
After that I added deleting of comments. Having done this in a more traditional way, I had to wait for a new page every time I deleted a comment. Since this too was annoying, I used Ajax here too. And it sure made the page more responsive.

I’ve also added very basic authentication support, which basically boils down to having to login to be able to edit, delete or post a new entry. During this process, I made sure that users who are not logged in are shielded from all this management functionaly.

Next in line is support for multiple blogs and after that caching is waiting around the corner.

Shifting design perspective

TrackBack link: http://blog.markjuh.net/markjuh/trackback/2005/4/7/shifting_design_perspective

Published on 7 April 2005 at 23:23.

Today I got home around 13:00 after having a hard time with the trains yesterday and today.

So, after lunch, I started working on the prototype of the blogging application, which is what I’ve mostly been busy with since Tuesday.

Tuesday I mostly learned how to deal with database design in combination with Rails and how to use the console script to test your models. My first idea was to define my foreign keys as NOT NULL, but this gives the key a default value of 0. In it’s own not much of a problem. I thought that validates_presence_of and validates_associated would take care of this and not accept non-existant foreign key values. But that wasn’t quite right.
So then my idea was to enforce the foreign key constraint directly in the database. But this made sure I could never get my unit tests to work again, since you cannot independently test one of the tables of the one-to-many relationship. Back to the old idea then. But now defined my foreign keys as NULL and giving them a default value of NULL. This at least makes validates_presence_of work and you have to actually change the value of the foreign key to be able to save a record.

But setting a default value of NULL is ugly, right? Sure, if you are looking at it from the old RDBMS-view, that’s absolutely right. But we are now looking at it from the Rails side, which is quite innovative. I had a hard time grasping this too at first, but after a day of discussing it, I remembered an article by Date I had read a couple of years ago in which he argued (quite well I must say) that a RDBMS combined with business logic is in itself again a RDBMS. So when you look at Rails, you have to see for example MySQL + ActiveRecord + models as the RDBMS. And when you take that perspective, it all makes sense. It’s not MySQL anymore that does the constraints, it’s actually defined in the models, so you can use the DRY (Don’t Repeat Yourself) way of working.

Then Wednesday, I’ve mostly been busy with giving functional tests a try and working on the controller and view part of adding a new post to the blog.

Which brings me to the work of today. Mostly been working at some functional tests, getting some green lights and finally some refactoring (mostly of views). I really like working TDD-style, but it annoys me that it’s so hard to write functional tests.

Tomorrow I want to work out comments, logins and creation of new blogs (which requires some database remodeling). So that will mostly be “yay for refactoring”-day.

Mondays

TrackBack link: http://blog.markjuh.net/markjuh/trackback/2005/4/5/mondays

Published on 5 April 2005 at 11:02.

Yesterday was a typical Monday. Lots of things just didn’t work out the way you expected them to go.

But in the process of writing the use case/evaluation for Blogger, I found out that I had overseen some details and that it was actually a better blogging site than expected.

Other than that, I’ve been watching Thijs being busy with a nice script that creates a graph of the Rails models in your project. See Graphing graphers graphically for more information. Although it contained some bugs, it surely helped us to spot errors in the model code. And while we were playing around with this script, Thijs was also trying out single table inheritance. It took him some time to get it working, but we both learned a lot from it.

Thijs left early, I finished up some documentation and read how components are supposed to work in Rails.
For the most part, it was a typical 8:30 to 16:30 day, which I normally don’t have. :)

FlySketch to the rescue!

TrackBack link: http://blog.markjuh.net/markjuh/trackback/2005/4/4/flysketch_to_the_rescue

Published on 4 April 2005 at 09:52.

So, what did I do last Friday?

Mostly, I’ve been busy all day with making screenshots of all those beautiful (read: annoying) weblog tools/sites. Fortunately Thijs came up with a nice application which helped me to get all the screenshots and yellow markings on those shots done in just one day, called FlySketch”. So basically, today I will be busy with working out the use cases and getting the images in.

Furthermore, this morning (in the train from Eindhoven to Utrecht), I’ve been playing around with the console script of Rails to see how I can interact with database models that way. It was interesting to find out how it all works.

1 2