Saturday, May 30, 2009, 12:16 PM -
Programming & ComputersPosted by Administrator
I think this is becoming an annual tradition, me musing on my biggest of all projects. But like a salmon going back to the spawning grounds because of some primitive urge, I feel the need to muse again. Unless you can sympathize with me as any other tormented programmer, or have a vested interest in my sanity and can handle plunging into its depths, I suggest you
move onto something else.
For those of you that are continuing reading and are new to the show, I have been working on a music composition application, strictly MIDI-based, off and on for the past few years. Okay, few really means several, but with an equal balance of both off and on, and I only write about it when I'm "off".
The application, for the most part, adds nothing new to MIDI apps that hasn't already been done. The standard features are there for note creation, editing, multiple tracks, undo/redo, etc. It's just that my take on the MIDI application has tools that I have yet to see in any other MIDI editor, and I'm still surprised
any of this stuff hasn't been done yet. It actually originally started as much as an exercise to see if I could do it. I'm also keen on making it easy-to-use, by not being bogged down with too many tools, and therefore affordable. The feature set that I have in mind makes it not necessarily competition against GarageBand (I can't compete against "free") or Logic (I wouldn't dare try), but instead to complement them.
The project is large for a solo developer, from what I understand to be considered large based on what I've read. It weighs in at over 10,000 lines of code, and that increases by another half if I take into account the amount of documentation I have about the current iteration, comments and otherwise. Although, most days it seems like so much more.
It has a couple of names, but for the most part, I just simply (affectionately) call it "The Widget". I've talked about this project so much, bouncing ideas off of people and ranting, that The Widget has become a part of the family's lexicon. I rarely get through a conversation without hearing "So, how is the Widget coming along?" That has been both a good and bad thing because it forces me to be brutally honest with myself about The Widget and yet I still keep thinking about it and what to do next.
I don't feel I'm any different from most other developers in wanting to create an application, any application, that people see as a "must have" or that raises the bar for all of the other applications of its type. The Widget could be one of those apps, or it could not but I think it has that potential. Either way, the more I develop it, the more I play with it, and that is what is most important to me ultimately. However, personal satisfaction only takes one so far, and there comes a point when there needs to be external validation.
No, this is not an announcement that The Widget is soon to be released. Far from it, in fact, though that would be totally awesome. I'm merely using this forum as a therapist of sorts, and to blow off a little steam. See, The Widget is stalled. Again.
The Widget, I feel, has a well-designed architecture. It's document-based, I use a lot of objects, modules, and methods to reuse code as much as possible, it's easy to use, and code (for the most part, I'll get to that bit later), and it has relatively scaled well over the long term. I've poured through Code Complete, Design Patterns, and a couple other classics enough times that I think their authors would give me a tacit approval of my work. As expected with anything this size, I've refactored it once, rebuilt it from scratch another time, and a gazillion little iterations in between. But I still found one fatal flaw in the current iteration: I totally didn't handle commands correctly and I've gummed up the works.
My original strategy was that I would put in all the functionality first, and then put in the undo and redo code. However, some of the initial features ended up having further-reaching implications than originally planned. I had to stop adding functionality and get to work on the undo engine so I could be sure that everything was being handled properly. It was after doing the commands for Add, Resize, Delete, Group, and a couple other basics that I realized that commands really need to be developed in tandem with new functionality.
The other problem with commands is that if not done right, a Command class can become a more than a little unwieldily when trying to record the state of affected widely-varied object types (Windows, Classes, and Files. Oh my!). They need to be refactored because handling the most basic of the higher editing functions ended up taking an
entire day and it
still isn't complete (Undo but the not Redo, and I think even that statement can be viewed as a symptom). I have a day job and chores to do so my time needs to be spent well.
There are some other refactors, though not as large, that could be done to make the code more manageable. I have various custom classes to handle editing that could easily be broken out into smaller chunks to give more focus, and I've already written up the documentation and cooked up the framework in REALbasic to do just that.
I could continue with The Widget as it is now, but I feel that it would just take far more effort than necessary and that just isn't reasonably sustainable through that magical, mystical version 1.
Do I see The Widget as a failure? Hell no. If anything, I see it as a victory, and a deeply personal one at that. The Widget has driven me to learn programming, and there are times I wish I had started down this path a long time ago. I don't think I have ever found a task so dynamic and rewarding. The Widget, because of its size and scope, steered me in directions that have helped me in almost everything else I do even in other languages. The journey has truly been the reward.
I have recently come to terms with the fact that I might not ever release The Widget; that The Widget is forever destined to be a personal pet project. In fact, I'm currently rolling around the idea of open-sourcing The Widget under the GPL and let it loose upon the world in source code form for some other newbie to pick up and hopefully learn a few things like I did with other code examples. How I got to that point is a bit random, and speaks to my oft-denied desire to just noodle around and yet complain about my noodling.
For the past couple of days, I've been researching more about the Command pattern, trying to pick up on something in an implementation that might help me in the situation I'm currently in. In doing so, I stumbled across an example Xcode project that closely resembled the example REALbasic projects that were the initial kernels that got The Widget going. Reading turned into noodling, noodling turned into more research into Widget-specific features, and a feasible framework was devised. Essentially, I began work on moving The Widget to Xcode and I think it's the direction I'm going to move in.
I have several goals I hope to achieve in moving The Widget over to Xcode. For one, it would give me a framework in which to learn different aspects of Cocoa. The Widget has it all: it's document-based, graphics, audio, etc. Cocoa has in place functions that I could really use that I had to write my own functions for that I'm not entirely happy with. So, in Cocoa's own way, I'm hoping to reduce the amount of "tool" code, for lack of a better word, I need to maintain and take advantage of its efficiencies. I originally wanted to reduce the line count, but that was quickly cast aside. The code will require however many lines of code it needs. 10,000+ lines of code is a milestone, but it can't be the primary metric by which the project is judged.
Of course, moving The Widget to Xcode is also going to mean a lot more hair-pulling, I'm sure. There's also no guarentee that I won't come across the same problems in Xcode that I have in REALbasic, and I know I will come across new ones. But much like The Widget and learning to code in the first place, I think the pleasure of Cocoa is going to be worth the pain, and I'm a much more experienced developer than I was when I picked up my first Objective-C book so many years ago.
There has also been the issues related with REALbasic itself. No proper Grid control (making a track list in a music application is all but impossible without one, container controls aside), and the flip-flop status of the NotePlayer class to name a couple. There are trade-offs to be sure, the track listing features were a cinch to solve in Interface Builder. CoreAudio is a rough, complex road but REALbasic's NotePlayer class can't be any easier. Besides, other than a couple projects for The Day Job, I only program for Macs, so the cross-platform aspect is lost on me, and I sometimes bump my head on the limited range of native controls that comes as a result of REALbasic's cross-platform paradigm.
So, then, what to do with all that REALbasic code? There's tons of good stuff in there, and while I don't consider it a waste of time, I think it could do more good than just sitting in my code library as a handy reference for various design patterns and techniques. So, that's why I'm thinking of open sourcing it under the GPL after stripping my unique functions. Someone is bound to find it useful. But, then what if I want to go back to the RB version? How does the GPL affect me then? Thus, the debate about open source.
Not too long ago, I wrote an article here about my future with REALbasic, and what I need to do to keep it as a viable tool in the toolkit. I concluded, and I still think this, that the onus is on me to keep up with REALbasic Studio, not for Real Software to pander to my individual needs. I have always seen The Widget as a large part of what direction I will go in, but I'm thinking now that doing so places too much pressure on myself and the project, and it's taking away from the the fun of it all. By direct result, I don't see The Widget as being bound to REALbasic anymore.
Does this mean that I will stop using REALbasic altogether? Hell no. REALbasic, for all of its foibles, is
far too useful to just walk away from it. Cocoa is
über-powerful, but with REALbasic, I get to just focus on the core of an application right from the very beginning in a clear syntax. MVC is nice, but there is something to be said about throwing the code into the interface and getting work out the door rather than futzing with hidden bindings and deep-featured Inspectors. There have been more times than I can to count where I have used REALbasic to whip up a solution that has earned me the reputation as a quick, comprehensive problem-solver (though the flavor of that reputation would be a matter of debate amongst my peers). Those who are quick to dismiss REALbasic are missing out, I think, and maybe a little jealous.
The question of whether I stick with REAL Studio or move back down to REALbasic Professional is the true question for that. Downgrading will depend on the state of projects when my license expires and how flush I feel with cash at the time (and with The Kid on the way, I don't have high hopes for REAL Studio). But there is no question that the licenses will get renewed one way or another. The only difference now is that I'm just going to stop worrying about what is going to happen in little over a year and focus on The Now.
As for The Widget, I'm just feeling as though my biggest, most favorite project needs a fresh start. I'm looking for a new journey, which is easy when I'm no longer so concerned about the destination.