Saturday, October 22, 2005

Daily devotions - getting started

I spent today getting started on my Daily Devotions software project, that I mentioned in my previous post. So much trial and error was involved for a PHP novice like me I decided to document it here.

The first thing I decided was I would try and procede in an XP (eXtreme Programming) style way. This involves many things, including writing stories on cards for what you want the software to do, and then proceeding forward in very small steps. This is ideal for a project like this I'm doing in my spare time. Unfortunately, some of the other practices like pair programming I will not be able to do as an individual, but we will see how it goes.

The first story I started with was "show a web page with the correct 'Through the bible' reading for that day on it". So the first thing I needed was some webhosting. I found "Perfect Free Web Hosting" (PFWH) which offes free MySQL and PHP as well as webhosting. Another option was MyJavaServer which offers free Java as Hypersonic SQL. I decided to go with PFWH as:
  • it gave me an opportunity to learn PHP
  • it meant I was likely to resist the temptation to make things too complicated starting in Java
  • it was likely to be able to move the site to somewhere else fairly easily, as lots of people offer PHP and MySQL, including BlackCat, who I use to host this site
  • I thought I was going to need a database to store the lists of readings. I could have used a flat file, but I've learnt its usually better in the end to start with a database, you always want one ventually. And I couldn't find a flat file database that worked easily with PHP and Java, if I wanted to change languages in the future. If I use MySQL then I can swap to another language very easily.

So having done this, the first step in XP is always to write a testcase. Now, I normally develop in Java where I am spoilt having IntelliJ IDEA, the best IDE I've ever come across for any language, with fantastic JUnit integration. I wanted something as similar as possible for PHP.

I spent all of today searching and to save you the effort, here is the configuration I ended up with. It turns out that if you are paying for an IDE for PHP then Zend Studio seems like the only choice, but I'm a cheapskate, so couldn't go for that. After much trial and error I finished up with PHP-Eclipse, with a local copy of Apache and MySQL for development, before deployment to PFWH. I installed Apache, PHP and MySQL through XAMPP. This took quite a few tries to get it right. I'm sure there are lot's of other solutions to get a free PHP IDE with PHPUnit etc, but I recommend following these instructions exactly.

Make sure you follow just that page. Even following the other instructions on the PHP-Eclipse Wiki it is possible to get in a mess, with editing files etc. Use the page linked to above. That's why I haven't added any other links, as that page has all you need to get set up on it. And now I have an IDE which will create PHP that connects to a local MySQL and Apache, within the IDE.

It also gives me the benefit of gaining familiarity with Eclipse, which is something I've been meaning to do.

Ideas Factory: Daily Devotions

Well, after an initial burst of enthusiasm, my blog petered out like so many others. My excuse for this is I just had my final exam for my Open University degree in psychology. This has meant my spare time has been spent revising or feeling guilty about not revising. But now that's out of the way here's an idea which I've been meaning to post about for ages.

Daily Devotions

As a Christian I think it is good to spend part of each day in prayer and reading God's word - the Bible. This is not what gets you to heaven, only accepting Jesus as your Lord and Savoiur can do that. Christianity is all about having a relationship with God, and part of having a relationship is communicating. Prayer lets us talk to God, and reading the Bible lets God talk to us.

Anyone who has tried to be dedicated in these two activities will know how hard it can be. If you are not a Christian, it can be similar to revising for an exam. You want to to do it, you know it is important, but unless you get into good habits it is possible for a million and one other things to distract you.

Part of my day job is writing software tools which make the lives of me and my colleagues easier. This means my brain is trained to think in statements like "How can I automate that?" or "How can I get a computer to help me overcome my mistakes in that?". Automation of prayer has been tried by other religions, but I do not believe in it. However, a tool to help in the discipline of daily reading the bible and prayer has been something I've looked for and haven't found.

It would be nice if this tool had features similar to several other programs:
  • A Calendar/Diary program, so it would help you overcome apathy by giving you a reminder (maybe by email)
  • A collaborative information tool like a Wiki, so things like a Church prayer diary could be shared
  • A database of resources, so for example you could automatically get the M' Cheyne reading each day
  • An educational software tool, maybe testing you on memorisation of bible verses
  • A statistical/bug tracking/Business Intelligence tool so for accountability you could keep track of how you were doing

There are several general tools which will do this job, for example, with a bit of hacking I'm sure you could get Lotus Notes to do a lot of it. But by creating a specific tool you could make it very easy to use for this one particular job, and that would mean people are more likely to use it.

I haven't managed to find anything which does this yet. I think this idea from the ideas factory I will start to do myself.