MooPlan 1.0 is out!

June 9th, 2009

Yesterday evening has been  quite a night. I was watching a movie with a friend of mine when my cell phone rang, with a US number on screen.

Hi, I’m calling from Apple. I’m finishing the review of your MooPlan app. But I just miss a few things before it can go on sale.

I sent the application for review about a week ago, and 24 hours after that, I received feedback from Apple requesting me to modify 2 icons that infringed Apple’s trademark. No big deal, the app was resubmitted with the hour. And then I didn’t have any news for a whole week, and I was not worried because I had read so many people complain about the slow review process and the impossibility to get in touch with anyone inside Apple.

And then BOOM! A guy from Apple calls me twice the same evening, just to get my application in store as fast as possible. And a few minutes after the second call, TADAAAA! MooPlan 1.0 is ready for sale. Isn’t it great?

So ladies and gentlemen, it’s my pleasure to announce that my first iPhone application is on sale, and you can get it here for $0.99 or €0.79. If you want to know more about what it does, head to the official website.

Just a few thanks:

  • Special thanks to Groovy and Grails communities for producing such a great productive Java platform that allowed me to focus on the iPhone side of things. Grails was really ideal for me: RESTful services are so easy to build, and scaffolding is just great to quickly produce an administration interface. And it was so fast to learn! I didn’t know anything about Groovy and Grails 6 months ago. And thanks also to Guillaume Laforge and his buddies for the tweets.
  • Thanks to all my friends and colleagues who tested the app: Frédéric Navarro, Mounira Hamzaoui, Clément Mary, Geoffrey Bogaert, Thomas Le Goff, Quentin De Mot, Louis Jacomet, Jérôme Vanden Eynde.
  • Thanks to my employer, Axen, for supporting me in this self-training effort.
  • Special thanks to my Geekette friend, who beared with the movie interruption and supported me for the final steps. Hopefully in a few years, we’ll laugh about this screenshot.

So that’s it. I have the feeling that this release could be the beginning of something big. I feel it in my guts. Now it’s up to you guys. And as I read it in a German restaurant last week-end.

If you like it, tell others. If you don’t like it, please tell me.

Share and Enjoy:
  • DZone
  • Digg
  • del.icio.us
  • Slashdot
  • e-mail
  • Facebook
  • Google Bookmarks
  • blogmarks
  • Furl
  • StumbleUpon
  • Technorati
  • TwitThis
  • Reddit

Entrepreneurship, MooPlan, Projects , , , , ,

Apple MacBook Touch On Its Way?

May 23rd, 2009

Maybe I see too many things, but I’m currently reading iPhone documentation about Core Data (which is really great stuff by the way), and I came across this comment:

The framework is equally useful as the basis of a vector graphics application such as Sketch or a presentation application such as Keynote.

Now I know quite a lot of Mac applications, but I’ve never heard of anything called Sketch! Especially not in Apple portfolio, and it only makes sense they take their own apps as examples in their documentation.

Now combine it with this Apple tablet rumor that’s been going around for a while, and it makes even more sense to see a Sketch app added to iWork. Now don’t you see things coming together too?

OK, I just googled a little further and it seems that Sketch has been a demo app for XCode for quite a while. But still, wouldn’t that be great?

Share and Enjoy:
  • DZone
  • Digg
  • del.icio.us
  • Slashdot
  • e-mail
  • Facebook
  • Google Bookmarks
  • blogmarks
  • Furl
  • StumbleUpon
  • Technorati
  • TwitThis
  • Reddit

Geek Culture

Software Architecture Cheatsheet (Part 3/3)

May 7th, 2009

In the previous post, I tried to think of the business constraints that intervene in the choices of a software architect. In this one, I’ll take a feww shots at guessing which technologies are important nowadays to build software solutions for these constraints.

I see… I see…

There are so many technologies out there that I will not risk myself in designing some sort of female magazine test like “tell me about your application, I’ll tell you what technologies you should use”. That’s a very exciting part of what I perceive as what is the job of a software architect: finding the right combination of tools and techniques for a specific business context in order to develophigh-quality, high-value and robust software for customers.

That said, there are a few important areas that seem very important to explore or even master in this world, and more specifically in this new economy we’re facing.

Productive dynamic Java

Java is a very mature and popular technology, so much so that many people have predicted its death times and times again. But in my view, it’s very much alive, especially with recent developments that made Java development much more productive. Of course, SpringSource-originated frameworks like Spring and its galaxy have changed the enterprise Java environment for a long time.

But even more recently, inspiration has come from the “casual programmer” side with Ruby on Rails and Python/Django yielding even more interesting developments like Groovy and Grails that combine the flexibility of a dynamic language with the incredible power and richness of the Java platform.

In my opinion, Groovy/Grails are about to rejuvenate enterprise development in an incredible way.

Modular Java

There has been a lot of marketing fuzz a few months ago about something called Service-Oriented Architecture. Unfortunately, although it was based on common sense, marketers and tool vendors completely killed the concept in the egg, but still, some important aspects have emerged and remain limitations of the most popular technology platforms. One of them is the importance of modularity: the ability to change one part of a system without touching anything else, whether it is to adapt them or to restart them.

OSGi (Open Service Gateway initiative) is a standard that has made a remarkable progression on the server side in the past few months, and with its massive adoption by major vendors, it’s definitely going to be something to watch.

Server-agnostic Rich Internet Applications

RIA-enabling technologies compose a very competive landscape: Adobe Flex, Microsoft Silverlight, Sun JavaFX, and even more niche technologies like OpenLaszlo, Curl. And I’m not even considering all those Javascript frameworks and AJAX-generating techniques that I personally don’t see as viable alternatives in an enterprise environment.

My technology of choice is definitely Adobe Flex: it’s open (and it’s even become one of the most impressive examples of Open Source development lately), it’s robust, it’s server-agnostic (it works with Java, .Net, PHP, Python, what have you), it offers desktop integration capabilities, making it possible to cover many of the use cases mentioned above, and it’s very elegant by design. More importantly it was one of the first RIA technologies out there, which makes it both very mature AND very popular.

Native Mobile Development

Mobile development has always been a hobby. Taking useful applications with you is an old fantasy. For a long time, it’s been so poor that it was difficult to turn this hobby of mine into a professional activity. That was until I came in touch with iPhone SDK development, which really blew me away. For the first time we have some great mobile hardware with unique usability capabilities, and we have the software development platform to use those capabilities like never before. And it’s going to be even better with the release of iPhone OS 3.0.

Of course, it’s about to become a very competitive area too, with the release of Palm WebOS, Google Android and Nokia Qt. But for now, the iPhone SDK is by far the most advanced native mobile development option.

What’s my point?

The purpose of this series is double:

1. try to show why software in general, and software architecture in particular are such exciting fields
2. wake up people who tend to have only one single hammer in their toolbox

Now if in addition to that, it can create a debate, then I have a few questions for you guys (and hopefully gals :oP) So, what technologies do you think are important to know in the current and future software world?

Share and Enjoy:
  • DZone
  • Digg
  • del.icio.us
  • Slashdot
  • e-mail
  • Facebook
  • Google Bookmarks
  • blogmarks
  • Furl
  • StumbleUpon
  • Technorati
  • TwitThis
  • Reddit

Dynamic Java, Mobile Services, OSGi, Rich Internet Applications

Software Architecture Cheatsheet (Part 2/3)

May 6th, 2009

In the previous post in this series, I tried to enumerate the most frequent kinds of applications. The question I’m going to ask myself here is what are the constraints that intervene in choosing the right paradigm and the correponding technologies to implement it.

Environment! Environment! Environment!

Before we start answering that question, let’s just be clear with something. We live in a world where there are plenty of free and Open Source libraries and frameworks and tools of all kinds. It doesn’t mean that free is always good, but at least it’s an option, and if you have a commercial option that can add some value somewhere, then go for it, it’ll be worth it. So I won’t consider tooling cost as a parameter here.

Performance (high computational power and low bandwidth)

Whenever you hear your customer say “I need it to handle several million transactions per second”or “I quickly want to make decisions based on thousands and thousands of records”, you know that you will have to think about performance. There can be several kinds of performance: memory consumption, CPU cycles, disk space, network bandwidth, hardware cost, etc. And all those metrics very often play together, which means that any change to one of these metrics has an impact on all of the others. For instance, it’s very common that you have to increase memory consumption to optimize CPU or disk access (caching).

Another important characteristics of performance is that optimization requires you to dig deeper into low-level details, because most of the performance is lost when abstracting machine constructs to be closer to human users. That’s why optimizing performance requires more work than doing things naively, and it’s very important to weigh the benefits of this work compared to the cost.

Moreover, it’s sometimes tempting to think of performance very early on and to focus on that more than the business value the application is supposed to create. But experience proves that you can quickly end up with very fast systems that don’t do what they are supposed to do because the closer you are to the machine, the harder it is to develop on it or maintain it. That’s why Donald Knuth said:

We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.

Distributivity (number and spreading of end-users)

Nowadays, it seems like all applications are meant to be web applications, all the more so with the recent fashion for cloud-based applications that attempt to “webify” traditionally desktop-based apps like word processors, worksheets, and so on.  And there has been so much effort spent in web apps in the past 10 years or so, that everyone knows about the technologies to build them. Yet it’s always important to ask yourself a few questions: will the application be accessible to the general public? Will it be extranet or intranet? How many users are likely to access the application at the same time? Are potential end users ALWAYS online? What would be the impact of the browser crashing in the middle of a session?

Sometimes, having to think about data access concurrency, network bandwidth or security is a useless hurdle that you can avoid just by developing a desktop application.

Automation (launch it regularly and in the background)

What if your application doesn’t need a complex user interface but requires just a few parameters to do its job? What if, on the other hand, it needs to be easily automated and integrated into a batch processing system? When you face such a business context, it’s important to consider the option of a CLI app, because then it can also be easier to integrate with other kernel system apps through scripting.

Whenever you hear your customer say words like “data analysis”, “system check” or “automatic synchronization”, you’d better think twice about your web app idea.

Ergonomics (easy and quick data input and visualization)

At the other hand of the data analysis pipeline, there is data input. And the more data there is to input, the higher the risk of rejection of the application by end users. And since end users generally wait a long time to get theirs hands on the application, this rejection traditionally happens very late in the development process. Combine that with the fact that people who ask for the application are not the ones using it, and the very special mindset of developers and you have all the chance in the world to miss your target and have the project fail before it reaches the finish line.

Of course, technology is not the primary solution to this problem. The first thing is to consider end users, consult them, talk with them, even if the business owner doesn’t think it’s useful. Then of course, methodology goes a long in putting the application into end users hands as soon and often as possible. But as soon as you realize the specificity of what users are expecting, you understand that you need a technology that gives you all the freedom to implement very complex use cases, without forgetting about the conventions and paradigms that people are used to.

Integration (with operating system and external systems)

Web apps have another big drawback in addition to ergonomic limitations, which is desktop integration. This issue comes from the security model of the web. Because it’s so easy to access a web application, because you don’t have anything to install and because the application is directly connected, it also creates a huge opportunity for malicious use. Which is why web apps usually work in what is called a sandbox: network access is limited to the originating domain (unless specified otherwise), no direct access to the file system is allowed, no native API access to things like system tray icons, drag and drop and so on.

And if your application has tom import or export very big files, or notify the user on a regular basis, those limitations can be a killer. There are some technologies now that create some sort of a bridge between a runtime plugin in your browser and a runtime app on your machine, but portability of this bridge across systems and across browsers is sometimes limited.

Productivity (getting things done and adapting fast)

How stable are the business rules you’re asking me to implement? How sure do you know what you expect from this application? If your customer answers “not very” to any of these questions, you might think twice about using this low-level highly-optimized programming language. Because if it takes you weeks to implement any change or new feature, your application might quickly end very far away from the business value is was supposed to create.

Fortunately, with the maturity of web application development, there has been a lot of very interesting developments in the area of development productivity lately. Development tools like integrated development environments certainly go a long way in making developers more productive, but when this concern is dealt with at the programming language level, it’s even better.

Maintenance cost (number and quality of resources)

Whatever technologies you plan to use, you definitely must consider the constraint of resources. There are so many techniques out there that it’s impossible for everyone to know all of them. Some of those technologies are very mature and popular, thus making it easier to find people to maintain and evolve your application on the long term. But the more mature the less innovative they often are. So finding the ideal compromise between the benefits of innovation versus the cost of resources to maintain your application is very important. Thus is might require some insight and technology watch in order to anticipate which of these innovative techniques will grow fast and be there for a long time.

And if you really need one of these innovative technologies that is not very popular yet, then don’t forget to include training costs in your plan. Last but not least, don’t forget to consider company-wide policies: IT architecture departments can create substantial impediments on your way, which might lead you to weigh in the cost of those impediments.

Continuity (robustness and evolutivity)

Beyond people able to maintain it, there is another thing that is very important for the longevity of your application: the intrinsic software quality assets of the technologies that you use. Testability, decoupling, Domain Specific Language support, portability, internationalization support, integration capabilities with other technologies and platforms, extensibility, modularity. All those characteristics can be very important to consider if your application is supposed to stay there for more than 5 years and evolve with the business at hand.

A lot of money is spent and sometimes wasted in reegineering entire applications just to keep up with current technologies or new business constraints, so much so that choosing robust and evolutive techniques can greatly reduce the long term ownership cost of the application.

In the final issue, I’ll risk myself into making some predictions about the technologies that seem very important in order to implement applications with that kind of constraints. But before I do that, do you see other business constraints that might be important to consider before choosing the best tools for the job?

Share and Enjoy:
  • DZone
  • Digg
  • del.icio.us
  • Slashdot
  • e-mail
  • Facebook
  • Google Bookmarks
  • blogmarks
  • Furl
  • StumbleUpon
  • Technorati
  • TwitThis
  • Reddit

Dynamic Java, Mobile Services, OSGi, Rich Internet Applications

Software Architecture Cheatsheet (Part 1/3)

May 5th, 2009

What I really like about being a software artist is the richness of tools and techniques you have at your disposal. And the more tools you have, the harder it is to use the right ones, the more tempting it is to limit yourself to a few of them. But to me it’s like analogic versus digital DJing: given that your ultimate purpose is to create sounds that make people move, why limit yourself to sync-and-scratch when you can have effects, loops, samples and a virtually unlimited library of tracks?

But I’m sort of missing my point here. Let’s get back to software. I’ve recently come to work on a new project that has been in the works for almost 2 years. For 2 years, wanna-be software developers have tried to solve a very difficult problem with very usual tools. It’s like Maslow said:

When you know how to use a hammer, everything starts to look like a nail.

Well, guess what! Everything is NOT a nail. And I’m gonna try to go over the reasons why in this post.

Software is one big family…

…and each member of the family has its own personality.

The most popular right now is certainly web applications. And by web applications, I mean traditional ones. HTML, CSS, throw is a little bit of Javascript, and maybe generate all of that with some server-side scripting like PHP, Python, JSF or whatever. Heavy load on the server, but very lightweight on the client. The interface is somehow poor because it relies heavily on technologies that were designed for documents gathered in websites, rather than for full-blown applications, with all the interactivity that it implies. Yes, some progress has been made in the past few years with all this AJAX stuff, but bear with me, this all seems like tinkering to me.

The mirror opposite of lightweight clients are certainly fat clients, aka desktop applications. Those applications are based on a composition of graphical widgets the user interacts with, throwing events around and interacting with the operating system. Contrary to their web counterpart, they usually require quite a procedure for deployment and maintenance, because they are physically running on the user’s machine and only check in with the server if they need to. But damn they’re fast.

More recently, a new compromise solution has shown up, offering the best of both worlds: the great ergonomy of desktop clients combined with the ease of deployment and maintenance of web clients. That’s what marketing guys have lovingly called Rich Internet Applications. Now behind this lovely RIA thing, there are a few technologies that make it a lot easier to write rich user interfaces that run within the confines of a web browser. But still, those have limitations compared to their pure desktop brethren: poor integration with the operating system, security constraints all over the place, heavily rely on server-side business code.

Now if Rich Internet Applications are web applications that solve the ergonomy problem, there is of course the other side of the compromise: desktop applications that solve the deployment and maintainability issues. Those are sometimes called smart clients: local database, offline mode, online synchronization, automatic updates, easy one-click installation.

Even though, those seem to fulfill the family picture, there are a few weird cousins out there that are good to be known. Command-Line Interface (CLI) applications have poor to no user interface at all. Their main purpose is to be run on the command-line by some geeky system administrator somewhere, or to be part of batch scripts running automatically every night. Very useful for maintenance apps, and for all long tasks like data analysis or system checks.

And of course there are mobile applications and all kinds of embedded systems. The user interface simply cannot be rich here, because the display is so small, and the computing resources are so limited. Small memory, small keyboard. The iPhone is certainly changing the landscape here, but you still have to manage memory!

Don’t forget extension apps, like SAP modules, CMS plugins, MS Access applications. Those are applications of their own. Usually highly specialized but very fast to develop for simple use cases, to get things done quickly.

Finally, even though, they’re less and less popular, there are still many mainframe applications out there. Now I won’t go into much details here because I’ve never set foot on that ground. But it certainly doesn’t harm to remember that it exists.

Now there certainly are a few other kinds of software applications out there that I didn’t think of, but you get my point. There are a lot of different tools out there, and very different techniques to use those tools in order to create software solutions to very different problems. And what makes those problems so different, you might ask. Well, it’s all about the business context. In the second part of this series, I’ll focus on the characteristics of a business environment can influence the tools you choose to implement the solution to a problem.

But before we get there, do you see other kinds of applications that I forgot to mention?

Share and Enjoy:
  • DZone
  • Digg
  • del.icio.us
  • Slashdot
  • e-mail
  • Facebook
  • Google Bookmarks
  • blogmarks
  • Furl
  • StumbleUpon
  • Technorati
  • TwitThis
  • Reddit

Dynamic Java, Mobile Services, OSGi, Rich Internet Applications

Hello MooPlan!

March 30th, 2009

logoHave you ever tried to organize a meeting or a gathering of some sort, whether it be for business, a birthday party or something like that? Well, if you have, you have certainly experienced the pain of finding the right moment when everyone is available at the same time. When one is available, another one is not, and vice versa, and then people change their mind. Really painful.

Fortunately for us, there are solutions on the web. One of them, and the one I use all the time, is called Doodle. Basically, what Doodle allows you to do is to set up some sort of a quick poll, saying “I want to organize such event and I propose a few time slots”. When your poll is created, you send an email to all the people you want to invite, with a link to your online poll. Invitees go there, check boxes to say if they are available or not on each slot, and once everyone has answered, you can determine which slot is the best option. All good, right?

Well, this solution is better than nothing, but it still has 2 major shortcomings. First off, it’s not integrated with anything like your mailbox, your address book or your agenda, which means you have to enter all the information manually, and invitees have to check their agenda manually too. Second, it’s on the web, which means that you can only organize meetings or check your availabilities when you are connected. Those shortcomings have a very important consequence: it can take an awful amount of time to get everyone to reply and send the final invitation, which means that the first invitee to answer might not be available anymore by the time your send him the final date… and we’re back where we started.

I use Doodle a lot, for business meetings, for Poker games with friends, and so on, and I’ve seen that happen a lot. And boy it’s frustrating. Then a couple of months ago, I was playing with my iPhone and I thought “Wait a minute! I have my calendar, my emails and my address book in there. Wouldn’t it be nice to integrate all of that to make it easier to set up gatherings?” Guess what! That’s what MooPlan does now!

So let’s see what it does. It’s a simple 3-step process:

  1. The organizer sets up a meeting, gives it a title, a description, invites a few people from his address book and proposes a few time slots. Then he sends all of that to MooPlan which dispatches invitation emails to everyone.
  2. Every invitee gets an email with a link inside. If they are reading the email on an iPhone, they can click a link to install MooPlan application from the App Store, if they have not already done so. If they have, they can just click the other link to open the invitation directly into MooPlan. They click on the slots on which they are available, and they reply.
  3. Back to the organizer, who sees how many people have already replied. And when enough people have, he just chooses a time slot, clicks “Send Final Invitation”, and BOOM! All the invitees get another email with the final date, location, and all the details of the event.

Now I know what you’re thinking. How is that better than Doodle? Well first, it works on your phone, natively, without any weird web interface, so it’s very easy to use, and you can organize meetings and reply to invitations on the go. Second, it’s already integrated with your address book and your emails. Now of course it still misses integration with the most important part: your calendar. Wouldn’t it be awesome if MooPlan could automatically check your availabilities, or create events in your calendar? Sure it would, and the good news is that MooPlan will do just that… once those capabilities are available for iPhone native applications. And with all the fuzz going around concerning the next version of iPhone internal software, good stuff is coming, that’s all I can say for now. This is just a first version.

When is it going to be available? Well, not tomorrow. I’ve just completed the first full cycle, but there are still a few things to fix, and a lot of testing to do. I don’t think I will be adding any new features in this release, even if I have plenty of ideas. Hopefully, I’ll be able to send it to Apple by mid-April. So stay tuned…

Share and Enjoy:
  • DZone
  • Digg
  • del.icio.us
  • Slashdot
  • e-mail
  • Facebook
  • Google Bookmarks
  • blogmarks
  • Furl
  • StumbleUpon
  • Technorati
  • TwitThis
  • Reddit

Mobile Services, Projects , , , ,

Why The H*** Would I Open Source My Project?

March 25th, 2009

A friend of mine asked me this question today. And even though I’m NOT one of these “free software” zealots who think that beyond Open Source, there is nothing valuable, I found it interesting to think about a few arguments. But let’s be clear right away:

  • I’m not opposing Open Source and commercial software, so I focused on the reasons to open source a project, not the reasons NOT TO sell it
  • Even though I do believe in those, I won’t mention philosophical reasons, but only on reasons that could convince my boss (and my boss doesn’t give a damn about “users should be free”)

#1 To build an indirect but wider business model

Most people think of software applications as normal products. Exactly like RIAA majors would like to reduce music to the same status. But common usage has proven them wrong, and for a very simple reason: a traditional product is something that you don’t have anymore once you’ve sold it to somebody. The main part of the unit price for each instance of this product covers raw materials and production cost. Software is fundamentally different, so the business model has to be adapted. Many big companies have already understood that: instead of selling a few instances to those who can afford it, you give it to everybody for free and then you charge them for additional services: training, customization, hosting. Of course, this implies that your product can generate such satellite services, that it can be of some interest to professional users. The general idea is: the wider your user base, the more services you can sell, which can potentially be much more profitable.

#2 More hands and brains

Sometimes, a software application becomes really interesting once it has enough features to be adapted in as many different situations as possible. But on the other hand, it’s very important to focus. So if your application is modular, like a CMS for example, the bigger the developer community, the more feature-rich your application, the wider your user base… and back to #1.

#3 Believe it or not, some returns from users are more important than money

Feedback, ideas, feature requests are the best way to make your product evolve in the right direction and make sure it is as useful as it can be. But gathering feedback for something you sell is more difficult: “why would I contribute to a product I’ve already paid for, all the more so as I have nothing to gain from contributing?” On the contrary, Open Source plays on what is called “the reciprocity principle”: people who get something for free are more volunteer to “pay for it” in other ways. The general idea is simple: give it to one user for free, he will suggest one excellent feature that will convince 10 more users to use it, 5 out of which will buy satellite services… and back to #1.

#4 Double licensing

Open Source doesn’t mean that anyone can do anything with your code. Open Source projects are protected by a license. The most popular Open Source license out there is GPLv3. It might be controversial, it offers one major protection: anyone that reuses or integrates your code MUST open source their project under GPLv3 too. This has a very important corollary: no one is allowed to sell your product instead of you. Practically, this is just a legal protection and some big companies violate it every day. But if it happens to you, you can sue them!

But since you understand that some users might be interested in reusing or embedding your product for commercial purposes, it makes a lot of sense to offer an alternative: a commercial license that people will have to pay for. And all of a sudden, your free users become your best salesmen: they use your product for free at home, they suggest it at work, and their boss buys a commercial license… and satellite services. You win!

#5 Do it first, before someone else does

If you are not convinced yet with the 4 reasons before, someone else might be. And even if you don’t release your code, unless you have protected your application with a patent (which doesn’t exist here in Europe since it’s pure nonsense, but that’s another debate :oP), anyone can take your idea, do it better, and open source it, thus cutting the grass right under your feet. On the other hand, if you open source your project, people will have more interest in contributing to it than creating their own version. And if they still do, it means your execution of the idea is really bad anyway so…

Now what do YOU think? Do you see other reasons why Open Source might be a good option for your next big idea? On the contrary, what reasons do you see NOT to Open Source a project?

Share and Enjoy:
  • DZone
  • Digg
  • del.icio.us
  • Slashdot
  • e-mail
  • Facebook
  • Google Bookmarks
  • blogmarks
  • Furl
  • StumbleUpon
  • Technorati
  • TwitThis
  • Reddit

Geek Culture , ,

iPhone ORM Just Rocks

February 24th, 2009

I have been pretty quiet lately, mostly for 2 reasons:

  1. I’ve been busy with betRway.com
  2. I’ve been playing a lot with the iPhone SDK.

I didn’t know anything about Objective-C so it is a challenging experience to go back to the C world, but I’m starting to find it very exciting. After I had read Cocoa Fundamentals and the iPhone Application Programming Guide (very boring stuff, but hardly avoidable), after having gone through “Your First iPhone Application“, I found myself pretty frustrated because I missed a lot of knowledge to jump into sample projects.

Fortunately, I stumbled upon this great blog with plenty of very complete and up-to-date tutorials. There is this especially this TodoList example that taught me how to do most of the things I couldn’t figure out by myself just by reading the code of the Books sample.

But at the end of that tutorial, I realized that a very important part of my code was made of boilerplate and ugly ANSI-C code to setup database stuff, like in the old days of JDBC. Google was my best friend and allowed me to find SQLitePersistentObjects.  And boy it works great! And it makes the code so simpler. Make your own mind:

This used to be the application launching code:

- (void)applicationDidFinishLaunching:(UIApplication *)application {
    [self createEditableCopyOfDatabaseIfNeeded];
    [self initializeDatabase];
    // Configure and show the window
    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];
}
// Creates a writable copy of the bundled default database in the application Documents directory.
- (void)createEditableCopyOfDatabaseIfNeeded {
    // First, test for existence.
    BOOL success;
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSError *error;
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:@"todo.sqlite"];
    success = [fileManager fileExistsAtPath:writableDBPath];
    if (success) return;
    // The writable database does not exist, so copy the default to the appropriate location.
    NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"todo.sqlite"];
    success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error];
    if (!success) {
        NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]);
    }
}
// Open the database connection and retrieve minimal information for all objects.
- (void)initializeDatabase {
    NSMutableArray *todoArray = [[NSMutableArray alloc] init];
    self.todos = todoArray;
    [todoArray release];
    // The database is stored in the application bundle.
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"todo.sqlite"];
    // Open the database. The database was prepared outside the application.
    if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) {
        // Get the primary key for all books.
        const char *sql = "SELECT pk FROM todo";
        sqlite3_stmt *statement;
        // Preparing a statement compiles the SQL query into a byte-code program in the SQLite library.
        // The third parameter is either the length of the SQL string or -1 to read up to the first null terminator.
        if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) {
            // We "step" through the results - once for each row.
            while (sqlite3_step(statement) == SQLITE_ROW) {
                // The second parameter indicates the column index into the result set.
                int primaryKey = sqlite3_column_int(statement, 0);
                // We avoid the alloc-init-autorelease pattern here because we are in a tight loop and
                // autorelease is slightly more expensive than release. This design choice has nothing to do with
                // actual memory management - at the end of this block of code, all the book objects allocated
                // here will be in memory regardless of whether we use autorelease or release, because they are
                // retained by the books array.
                Todo *td = [[Todo alloc] initWithPrimaryKey:primaryKey database:database];
                [todos addObject:td];
                [td release];
            }
        }
        // "Finalize" the statement - releases the resources associated with the statement.
        sqlite3_finalize(statement);
    } else {
        // Even though the open failed, call close to properly clean up resources.
        sqlite3_close(database);
        NSAssert1(0, @"Failed to open database with message '%s'.", sqlite3_errmsg(database));
        // Additional error handling, as appropriate...
    }
}

Now it’s just that:

- (void)applicationDidFinishLaunching:(UIApplication *)application {
	NSMutableArray *todoArray = [[NSMutableArray alloc] init];
	self.todos = todoArray;
	[todoArray release];
	[self.todos addObjectsFromArray:[Todo allObjects]];
	// Configure and show the window
	[window addSubview:[navigationController view]];
	[window makeKeyAndVisible];
}

And this is just one example. All the CRUD operations are so much simpler. And I didn’t even need to create the SQLite database. It’s almost a shame Apple didn’t include such a framework in the SDK. For your curiosity, you can download the project here.

I love it! Now I should be able to get my hands dirty with my real project. More on that later ;o)

Share and Enjoy:
  • DZone
  • Digg
  • del.icio.us
  • Slashdot
  • e-mail
  • Facebook
  • Google Bookmarks
  • blogmarks
  • Furl
  • StumbleUpon
  • Technorati
  • TwitThis
  • Reddit

Geek Culture , ,

Flex Guys Are Going Too Far

February 11th, 2009

There’s been a lot of fuzz lately in the Flex community around the way the Flex SDK Open Source efforts are handled by Adobe. And let’s just say things have gotten a little messy around here. It’s funny because I’ve just watched the last episode of Battlestar Galactica, and without any spoiler, let’s just say that people tend to get things wrong when it comes to rebellion.

I mean, sure, everything is not perfect. Especially, Adobe doesn’t seem to be listening to votes on bugs.adobe.com as much as I hoped. But when I read things like “the war of open sourcing the Flex framework”! I mean… come on, guys!

When Simeon Bateman started to take matters into his own hands and talked about forking the Flex SDK, I already thought he was going too far because I think Adobe is really trying here, and I respect their effort considering what’s at stake and the size of the boat they’re steering. And what surprised me even more is that Adobe actually responded to the feedback from the community by organizing a big open live discussion with the whole community. And then they even got way further by opening up their Open Iteration Kick-Off meeting. Hey, that’s an amazing effort! Can you imagine what it takes in a big “old school” company like Adobe to do that.

But as in every rebellion, it seems that people can’t seem to be satisfied now. They’re forming committees, gathering grievances, it looks more and more like a French revolution to me. And let’s just say that’s part of the reasons I don’t particularly like the country where I was born. But that’s another topic.

The problem with that kind of mutiny is that you always end up with self-proclaimed representatives who are honestly convinced they’re speaking up for the greater good, but they always forget about crowd control, about how people can forget everything about reason and lucidity when you inject in them the “it’s unfair” feeling.

I say thank you Adobe for Open Sourcing the Flex SDK. I say, let’s not forget that you were not forced to do so, that you could have kept it free as in “free beer”, as it was with Flex 2. I say, let’s not forget that Open Source licenses still guarantee intellectual property and ownership to the people who actually created all this code for us. And I say yes, they made the decision to move to Open Source and they should take the good side as well as the responsibility side of it, and really involve the community. But I don’t think that threatening them to fork, or getting into a war with them is going to make things any better… unless your only goal is to cover your butt for your ultimate purpose to actually fork it.

I think we should all calm down here, take a deep breath, show some acknowledgement of the efforts they’ve made so far, and insist on the fact that the community is here to help and work WITH them, and not to undermine their efforts, “start working on Flex 5 as a community now and let them join us when they are ready”. Uservoice, committees, those can be good ideas, but we have to show some good will and honesty here, because nothing is owed to us and because it’s not in our best interest to get people nervous and vindictive now.

Share and Enjoy:
  • DZone
  • Digg
  • del.icio.us
  • Slashdot
  • e-mail
  • Facebook
  • Google Bookmarks
  • blogmarks
  • Furl
  • StumbleUpon
  • Technorati
  • TwitThis
  • Reddit

Geek Culture, Rich Internet Applications

We don’t need an online IDE!

February 3rd, 2009

I’m on vacation this week, and it’s great. I usually try to take at least one week off in between missions because it’s the best time to do it. Nothing to worry anymore about the one before, no knowledge of the one ahead, my head is free to dream and wander around and I have plenty of time to move forward on personal projects.

Now beyond my work on betRway.com, I’ve been thinking a lot today about the idea of an online development environment. On my last project, I’ve seen a lot of the possibilities AND limitations of current RIA technology, and more specifically the most advanced one IMO, ie Flex. Combine that with some of the modularity offered by OSGi on the server-side, the productivity brought by things like Grails, and more importantly the promise of unification of all of those technologies under SpringSource’s sponsorship… and it’s starting to become more and more interesting.

So I googled “online IDE”, and I found this great article on DZone, which is a few months old but gives a lot of links to some of the services that are already offering both niche and generic online environments. I’ve browsed through all of these and I have a bad feeling of “déjà vu”. It’s like those mobile web sites that try to reproduce a trimmed down version of their web counterpart: it doesn’t really work, and worse, it doesn’t even use all the potential of mobile platforms. It’s like we’re trying to copy our desktop IDE onto the web.

But when you really think of it for a moment, the reason why we need version control systems for example, it’s because everyone is working on its own, and we need to synchronize at some point. But this constraint almost disappears if we’re all working online. And online development can have impacts of similar magnitude on things like continuous integration, deployment, monitoring. Some of these tasks don’t even make sense anymore. And how about several programmers working on the same artifact at the same time? And think about the computing power that could be available for code generation or compilation…

The way I see it, even the programming languages that we use today are not designed to work like that. Think of Java packages correlated with file system directories. Think of all these destructured text files that our IDE’s have to parse and index to make some sense out of them and allow us to navigate through them: what if text files are replaced by databases at some point?

I’m just thinking out loud here, but I’m wondering whether we shouldn’t forget about everything we know in terms of programming paradigms, and get back to the objective: producing working software collaboratively. What would be the best and simplest way to do that, knowing that we are starting to have all the tools we will need in order to move our workspace into the cloud?

As far as I’m concerned, I already know what I would like in such an environment:

  • More graphical programming, especially for high-level design, because visualizing is still the most efficient way to create and design IMO.
  • No more boilerplate tasks like “check out”, “check in”, “run tests” and things like that. Just “share my code in the public workspace” and “test on save”.
  • The ultimate reproducible build environment: everyone is using the very same frameworks and libraries at any time. No more environment variables or shell idiosyncrasies.
  • Smart client stuff, with offline mode, auto-synchronization and conflict resolution when back online.
  • Methodology directly integrated into the envir