To sum it all up…

April 9th, 2009

Like CakePHP, Yii is initially a bit confusing, but it’s also exciting, and so you keep going, wanting to explore deeper.. But the main difference, to me anyway, is that when the excitement fades, to no longer cloud your judgement, Yii has become an understanding and caring friend, while CakePHP leaves you wondering… Was the cake a lie after all?

Bad.. I know.. ^^ Couldn’t help it.

Thoughts on Yii

March 29th, 2009

I’ve been working with Yii for a while now, and my original, positive opinion of it, has only gotten stronger since then, to the point where I feel comfortable starting on one of my larger, paying projects in it. I’ve decided to write down my progress as I move along, hopefully resulting in a tutorial, to complement the Yii Blog tutorial. I’m not sure why it’s always a blog tutorial with these frameworks, maybe because so many would like their own blog, or maybe because they cover a lot of the basic elements, but personally I would like to see more advanced tutorials, that better showed off the depths of the framework, but that’s one of the reasons I really like Yii.. I feel like I can actually make a difference, and help out with it.

Anyway, before I get started on the larger project, I’ll share with you the experiences I’ve had so far, mainly comparing it to the experiences I had with CakePHP in some of the same situations.

The first task when developing a project with Yii is quite similar to that of CakePHP, namely to use the console to set up the basic application, then set up the database, followed by using the console to set up models and controllers. While the last step is really optional, I’d say it’s one I’m going to do every time, simply because it speeds up development time a bit, and prevents a lot of tedious typing. There are a few things I would have liked to have in the Yii console, that aren’t there, such as the ability to get help on setting up the DB connectivity with it, or at least having it make some educated guesses about the relationships between models, but they’re minor things, and due to the way relationships work in Yii, and the way they’re implemented, I’m not even sure if there would be a relatively simple way to do it.

So there’s less in the way of automation in the Yii console, but it comes with the added bonus of making the console more simple, and in addition to that, I find that it’s quite easy to extend the console, whereas this was an area I struggled a lot with in CakePHP, although I don’t know if that was because it really was complex, or because I found the rest of the framework complex, and thus automatically assumed that extending the console would be too, hence skewing my view of it.

When it comes to database connectivity, Yii uses PDO, which meant I had to read up on creating DSNs again, in particular doing so in relation to Yii, and while that wasn’t a huge issue, I would have appreciated having better help either in the console, or in the comment preceeding the database connection string configuration. It is nice, however, that you can quite easily get away with not having a database in Yii if you really don’t need one, like if you’re just doing quick prototyping. Just as you don’t -have- to have a model, and you’re free to make models that are or aren’t tied to a specific database table, so you could have a form that collected input from a form on the page, and either emailed it, or did something else entirely, without having to involve the database, which I find creates a feeling of -not- being locked inside the framework.

Once I had set up the connectivity, it was time to create the table structure. While I was using CakePHP, there was a rather rigid database structure you had to follow, and while that allowed for quite a bit of nifty automagic stuff from the framework, it was also contributing to my feeling of being locked inside the framework, as a sort of prison. But it means that there are things that, if you want them in your Yii project, you will have to make them yourself, which is surprisingly simple to do, actually. So after setting up the tables, including the needed foreign keys, I used the console to set up models for all the tables, and controllers for those areas that needed that, and after that, I was ready to start coding.

And let me tell you right now, that this was where I really started to like Yii, because everything just seemed so logical to me. The way everything was set up, while similar to CakePHP’s structure, never left me in doubt about where anything was. Some of this might be attributed to Yii’s rather thorough documentation, although sometimes I wish there were more documentation for the API reference, but be that as it may, it’s still quite brilliant. CakePHP’s documentation has also gotten a lot better over time, but when I first started out with it, it was incredibly messy, with whole chapters missing, and deprecated methods in which to do things.

So did I have absolutely no problems at all during this learning process? Well obviously I did, as it would be strange if I didn’t, but I again found that with Yii, I could get my answers far more easily than I ever could with CakePHP, because while CakePHP has a really large community, I found that coming into channel to ask questions could often result in not getting a response at all, either because no-one was awake to answer, or because people considered the question to be a newbie question, and thus couldn’t be arsed to answer it, and then there were times when people would want to help, but not know about that particular aspect of CakePHP, and all in all, it could be a rather frustrating experience. Yii, on the other hand, doesn’t have a big community yet, but it does have a very active developer, who responds to questions on the forum so quickly that I’ve sometimes wondered if he ever sleep or go out. Heh..

I could go on and on about Yii, but this post is already getting kinda cluttered, because there’s so much I want to say, yet I can’t think of a good way to structure it, so I’ll just end on the note of performance, which doesn’t cease to amaze me when it comes to Yii.. When I was running CakePHP it was running really sluggish on my development machine, and while I wouldn’t expect it to be high-performing, I did expect that it would be able to execute things in a timely manner, but it was incredibly slow. Yii runs a lot faster, making it a pleasure to work with, and to test things out in locally without having to upload to a fast production server.

As I work on my tutorial, I’ll be able to structure things a lot better, but before I end here, I would like to make it absolutely clear, that I am not saying that CakePHP is a bad framework, because it really isn’t. It’s just not the right framework for me, and it took trying out Yii for me to figure that out.

Very simple source control for personal projects

March 9th, 2009

I think that most developers have small projects, be they pet projects, or just ones made to test a specific programming language / framework, to get to know it more in depth by using it more practically, making the experiences that are often needed to make decisions, and avoid common pitfalls when working on larger, possibly commercial projects.

Personally I’m all for source control, but there are cases where my goals are not so much to keep a strict versioning information about the files, but rather just to make sure I have the source backed up, and I’m able to work on it from both my desktop workstation, and my laptop, without a lot of hassle, and while I normally prefer Subversion for my versioning needs, I find that it’s like shooting birds with a cannon when it comes to small projects.. It works, but it’s a lot of unnecessary work, especially since I’m the only one working on the project, I don’t need to do extensive testing of it before I commit the source. It also happens sometimes, that I forget to commit the changes when moving from one computer to the other, meaning I’ll either have to resolve conflicting commits later, or find another way to get it done..

Subversion can support WebDAV, which would of course help alleviate the problems with remembering to commit, but it’s still a bit overkill for my tastes. However I didn’t really look for another solution, instead it sorta dropped into my lap, and even though it took me a while to realize I could use this for my personal projects (where the safety of the code isn’t the primary concern, since with a service like this you can’t be 100% certain no-one will be able to read your files), I was incredibly happy when I did.

It’s called Dropbox, and is basically just an online file storage (and sharing, if you wish) solution, giving you 2 GB for free, with the ability to get more for referring friends (assuming they sign up), or by paying for it. They currently only offer a 50 GB package at $9.99 per month (or $99 per year), but will be offering other paid solutions in the future, which is nice.

So what’s so great about it? Well, other than it being 2 GB free (which isn’t really all that impressive if you compare it to other solutions available, which offers up to 50 GB for free), it’s so easy to use, since it’s basically just a folder on your computer, that syncs with the server whenever changes are made to it, and those changes are then passed on to your other computers, either right away, if they’re connected, or when they next connect (ie. has internet connection while the client is running).

“Wait a minute, this sounds familiar..” You may or may not be thinking right now, but if you are, you are indeed correct.. There are other services offering this very same thing, including Microsoft’s LiveMesh, which I used before I switched to Dropbox. But what made me switch? What’s better about Dropbox?

A lot of things, but I’ll quickly list off the ones that I like the most:

  • Dropbox works on Windows, Mac OS X, and several if not all Linux variants, which is a huge plus for me, because although I mainly just use Windows, I have friends who use other OS’s, and this way I will more easily be able to share files with them if I need their input on something, if they have Dropbox installed too, since I can create a so-called “Shared folder” where I decide who gets to share it with me.
  • Contrary to LiveMesh, Dropbox does not have a built-in VNC-like server, which cannot be disabled, and works absolutely horribly anyway, since a person needs to be physically present at the computer to accept the connection through LiveMesh, before it will allow the remote user to do anything.. If I need to remote-control one of my computers, it’s because I’m not currently sitting in front of it, Microsoft!
  • All synchronized files are automatically versioned, so that you can return to an earlier version of the file if you make a mistake on it, something I haven’t had a need for yet, but it’s ever so nice a feature to have, and the revisions are not only stored as a “delta” on the server (meaning it contains only the differences from last version), but they do not count against your storage space, so even a 10 MB file with 100+ modifications will still only take up 10 MB. I don’t know if all revisions are stored forever, but again, this is for personal projects, not production-grade ones.
  • In relation to the versioning of files, there’s another advantage.. Deleting a file will flag it as deleted on the server, but it will still be there so you can restore it, unless you choose to purge it, in which case it will be gone forever, but that is another very nice feature, since I sometimes end up deleting something accidentally, and I tend to do so with shift+delete, meaning it bypasses the garbage bin, and is deleted fully (for those of you who may not know).
  • The sharing, public folder, and photos folder, are all very nice features as well, that I tend to use to quickly show off pictures and other files to friends, and for collaboration on documents.
  • You can limit the traffic used, which is wonderful if you’re on a shared network where hogging all the bandwidth is a sure way to get lynched. ;)

One thing that Dropbox doesn’t yet have, that LiveMesh does, is the ability to have multiple folders, and then only syncing those you have an interest in, which serves two purposes (for me). First of all, it enabled me to only get the folders I needed on my laptop, where the amount of free space is limited, and second, it allowed me to decide where each folder was on each computer, so if I had used them for projects, I could have had the folder in the project folder, and then it would have synced automatically.

Until Dropbox gets multiple folders, the first usage is impossible to simulate, but the second one can be done by the use of symbolic links (called Junctions (folders) and Hard Links (files) on Windows XP). One thing that I found out is, that you cannot place the folder you wish to sync, outside of Dropbox and then create the junction inside the Dropbox folder, as it will upload the files initially, but won’t sync when you alter a file. This applies to Windows, btw, as OS X and Linux should work perfectly. Anyway, if you place the folder inside the Dropbox folder, and then create the symbolic link / junction where you normally use it, everything will work flawlessly.

I’m using this for my Yii test project, and it’s working very well indeed, so I can warmly recommend it, although for larger projects, I would still recommends Subversion.

A quick note… Daniel Hofstetter posted in his blog yesterday, an article about another single-developer solution if you wish to avoid Subversion for whatever reason (his being that he couldn’t get Subversion and NetBeans to interact, a problem I haven’t had personally, but then I’ve never done Ruby stuff in NetBeans). So if you want to check it out, you can find it here.

My last slice of cake

March 7th, 2009

For a long while now, I’ve been trying to approach CakePHP, and have somewhat enjoyed working with it, but it has been a long and rather troublesome path. CakePHP is a great framework, that much is certain, but it kept getting in my way, being a bit too automagic for my tastes, bugging me down with a lot of requirements in regards to conventions, and while those are good for many things, I found them to be in my way.

So when Daniel Hofstetter wrote about other possible frameworks, I decided to check them out, and I fell in love with one of them. Namely Yii Framework, which is another PHP framework based on the MVC design, and it has a lot of features that I like, but what I love about it is, that it took me only 2-3 days to understand how it’s all connected, and while CakePHP has a really nice community of people ready to try and help, with Yii, it seems that the main developer spends a lot of his time helping, getting people up and running with the framework, which I assume will enable the users to start helping with support, although I must admit that the documentation is excellent, and whenever a sensible suggestion to the documentation is made, it is carried out rather fast, usually within a few hours.

Now that I have a tool I feel comfortable using, I’ll probably start updating again more.

Missing documentation

October 19th, 2008

I’ve been reading up on the CakePHP documentation (as I have mentioned a few times before), and I’ve noticed that there are some sections missing from it. Not a whole lot, but enough that one can miss some things. I have also noticed a lot of people complaining about it, or at least commenting on it, but I’m of the belief that one shouldn’t complain about things that one can change, and since they enable people to edit the manual, I’m determined to do so once I feel secure enough in my knowledge of CakePHP.

That being said, I’m almost done reading the manual, or the bits I need anyway, so I’m going to get started on the actual development. Also, a quick side-note here.. The Containable behaviour is brilliant and quite definitely one I’m going to use for my projects.

Regarding the CakePHP manual

October 16th, 2008

I have to admit that I am very impressed with the manual for CakePHP v1.2. Back when I was using v1.1 it was lacking in a lot of areas, and my guess is that enabling users to edit it has done quite a bit, although from I understand, there are still a lot of people who use the Trac to suggest updates to the manual, rather than just adding them, but I guess that’s likely to happen.. After all, we are dealing with users here.

I’ve been reading the manual, and I’m about halfway through, reading it page-to-page, but I have a feeling I’ll be going back to some of the areas when I need them, until I get a hang of it again. I’m also thinking about going back to the CakePHP IRC channel, which is a really nice place, with friendly, helpful people.

Actually, I think that’s one of the things I like best about CakePHP, the friendly community. Of course, the structure of CakePHP and the way it works has a lot of say as well, but the community is what makes me stay there, and especially what makes me want to help out if I can. It’s also why I donated a while back, and why I’m going to donate more once I finish with this project and get paid for it. It’s one of those projects that I feel deserve donation. :)

So anyway, I will be posting more about CakePHP and my experiences with it, as I get further, but for now, I have set up my database tables, baked the application as well as models, controllers, and views for it. I’ve also added the tables needed for ACL, but I’m not entirely sure I will be using ACL for this project, so I’m skipping that bit for now. Once I actually know if I need it, or I need it for another project, I will return to it.

CakePHP major minor version

October 14th, 2008

I was discussing this with a dear friend, and fellow CakePHP enthusiast, the other day, and I felt like writing about it in my blog..

Over the past couple of years or so, CakePHP v1.2 has been developed, and while it isn’t officially ready for production use, I have to say I have found little to no problems with it, that would prevent me from using it.. So I am.. But what baffles me, as well as my friend, is the fact that this is a minor version change.. Going from v1.1 to v1.2 is supposed to be a minor version jump, and perhaps it is, but the number of changes, and the importance of these changes, are astronomical. I recently installed OpenOffice.org v3.0, after having used the v2.x range for a while, and I thought to myself, that this is actually the magnitude of changes found in that minor version update in CakePHP..

This, of course, beckons the question.. If so much goes into a minor release.. What sort of changes would then go into a major release? I’ve looked at the CakePHP Roadmap and it doesn’t even have a v2.0 yet.. There’s the v1.2, and some Bakery versions, as well as the usual Manual stuff, so I guess we won’t really know what the plans are for v2.0.. Unless of course we ask.. ;)

Change of plans.. Focus changed to Swimulator

October 12th, 2008

I know I recently posted about getting started on another project, and I’m probably still going to be working on it once in a while, but I tend to push personal projects aside whenever I have a paying assignment I can focus on (who wouldn’t, right?)

So.. What is this project? Well it’s actually one I’ve been working on for a while, but I just haven’t really disclosed anything about it, mainly because I wanted to get it to a state where I felt confident enough about it, and this step has been reached, with the conclusion of the first, initial part of the assignment. It’s a specialized J2ME stopwatch meant for swim coaches. It will register so-called splits and strokes, and will calculate various statistics based on these numbers, including the FINA score, if the event in question was a FINA event.

There were quite a few challenges in relation to this project, including handling floating-point numbers, which MIDP1 does not support, and also sending data to the web server, to store in a database.

That was the first part of it, and it works like it should, so now I have been asked to make modifications to it, expanding the application with some extra features, the main ones being to retrieve some data from the server again, as well as an auto-update feature. In addition to the application changes, and the obvious web server alterations to accommodate these changes, I have been asked to write a website without any particular design, that will handle these things, and enable people to go in and check the statistics for a particular swimmer, searching by a coach’s ID.

I’m really glad I got this assignment. Not because it pays well, because God knows it really doesn’t.. It’s a personal project for my client, and not something he’s probably going to make any money of ever (by choice, that is, because I personally think he could earn a bit from it).. Anyway, I’m side-tracking here.. The reason I’m so happy about it is, that this is a really nice project to work on, first of all, and second.. It allows me to play with CakePHP again, which I haven’t done since v1.1, and there are so many nice features in the new 1.2, that I’ve been itching, trying to come up with an excuse to get back to programming stuff with CakePHP. Here’s that chance, and I’m happy to have gotten it.

CakePHP is a really nifty implementation of MVC (Model, View, Controller), and while I know that there are quite a lot of purists out there, who will claim that it is in no way as complete an implementation as Ruby on Rails, I have to say that I tried that, and I could never really get properly used to Ruby, plus there are still more hosts that supports PHP, which makes it more plausible for smaller clients, like I usually have. The larger ones can afford dedicated servers, where they decide what to install.. My clients cannot, and they usually already have a hosting plan, which has so far always included PHP, and never RoR.

There are of course other MVC-based frameworks for PHP, but of the ones I’ve tried, I’ve found CakePHP to be the best, and not just in functionality, but also in terms of support. Whenever I’ve had a question, that I couldn’t answer by looking in the manual, the “bakery” (where people can post articles, including tutorials), and occasionally in the API documentation, I have been able to ask on the IRC channel, and get a really helpful answer. This type of support is really good, and a powerful community goes a long way, at least for me, when selecting something like a framework.

I think I will be posting updates on this project, as well as experiences with CakePHP as I work on this site, since this will be my first v1.2 project, and thus I’m bound to come across new stuff I haven’t dealt with before. I’m getting all giddy just thinking about it. Heh.

BSCurrency – Eve Edition

September 30th, 2008

So I started coding today. I haven’t really gotten very far, as I have been out most of the day, but still, I’ve decided to write the Eve VM edition of my BS Currency application.

But why did I choose this over the other projects I had in mind? I guess it was a combination of things, really. The main being that I would really like the ability to look up rates while I’m out, but it was also a need to learn to use the Eve VM properly. I’ve written a small test app in it, and that didn’t work on my HTC Touch Diamond, so I sorta just let it rest, but the people at the Eve VM forum are really helpful, so with their latest suggestions, I’m going to try and see if I can’t make a functional application for my mobile, and then afterward, I just might make a J2ME version of it as well.

Also, I just might write down and publish the steps I’m taking in programming this application, though first, I might publish a small tutorial on how to make Eve VM work in the newer versions of NetBeans.

Deciding on my next project

September 29th, 2008

I haven’t really been keeping this blog updated, which is a shame, but then again.. I wanted it to be tutorials and tips and such, and that hasn’t really worked out so well, because I never really know where to begin when writing a tutorial..

But perhaps a developer’s diary will be better anyway? I think it might be, and that’s what I’m going to try and do, as soon as I decide on a project, that is. It’s not that I’m lacking the inspiration for projects, because I actually have quite a few projects I’m thinking about these days.

My first idea is a game, actually.. One that exists in quite a lot of editions already, and creating it would mainly be for my own benefit anyway, unless someone actually found it useful.. Anyway, it’s Sudoku. It’s a simple game really, and shouldn’t take too long to program, once I get the interface created. The pros for this project are, other than the obvious satisfaction of writing a game, that I enjoy Sudoku, and I can make it the way I enjoy playing it.. But there are some cons as well, the biggest being that it’s not exactly a constructive piece of software.. It cannot be used for anything practical.

The next idea is a currency converter, like the one I’ve already made, only better and faster, and with support for more units, as I would write both a J2ME version, as well as a version for the Eve VM. This is a piece of software that I know I will eventually write, but is it something I want to focus on now? I’m not entirely sure it is..

There’s also an expense tracker that I’ve been thinking about creating. That would primarily be for Eve VM, but I might also consider making a J2ME version as well.. Again, I’m not entirely sure I want to do this right now, even if it could potentially be very useful.. Why? Because so far it’ll only be useful for me. I don’t have any readers here, I think, so it’s highly unlikely that anyone is going to find them, much less a chance that they will actually have a use for it. Of course, I could find a way to spread it around, but it would also be a learning experience, which is why I’m considering it in the first place.

The final project I’ve been considering, is a calorie counter. It would be an obvious choice, if it wasn’t for the fact that my friend is working on one too, and from what I’ve been told, it has quite a lot of potential to be good, but on the other hand, we note things down differently when we register calories, so perhaps I should try making a version for myself, just for kicks.. And just to have something to do.. I don’t know.. But at least now I have it down in writing, even if no one else is actually going to see it. So I can think it through a lot better.