Sharing Code Between Projects

Someone at Real World asked me about maintaining shared code between projects in Real Studio. He was using external project items (in XML format) and that makes it difficult to work with source control since the XML format isn’t really designed for that. We have a lot of code that we share between projects, both code that we’ve written like ActiveRecord and open source code or libraries that we’ve purchased.

We don’t try to share the code automatically. Instead we keep shared code in a separate project (ideally with testing code, although we’re not at 100%). That code is separately versioned and we update individual projects by copying the new version into the project’s that use it.

In our experience this works much better than trying to share code automatically. We work on a lot of projects and sometimes a project won’t have changes for months or even years. If the shared code has changed in the meantime, we don’t want to go back to the project that uses it and find that it may have bugs that were introduced by changes to the shared code.

This applies to other language also by the way. I can’t see myself ever having code shared between separate projects (with the exception of header files in C or C++).

If you search for vendor branches you can find some more information that’s specific to Subversion. We don’t use the vendor branch pattern ourselves but it’s worth knowing about.

Google search and Web Edition

If you use Real Studio Web Edition right now the contents of your app are invisible to Google. I think a lot of people are using WE for internal projects or for apps that need a user to log in before anything useful is available. This isn’t a problem for that kind of project but for some web apps it would be nice to have certain areas show up in Google’s search results.

This isn’t just an issue with WE, other AJAX based web apps have the same type of issue and Google has a document that describes how to make AJAX web apps crawlable:
http://code.google.com/web/ajaxcrawling/

The basic idea is that you have special hash tags for the parts of the your app that should be indexed. When Google sees those it asks your app for snapshot of what the app would look like after the JavaScript has been evaluated.

One approach that Google suggests for getting snapshots is to use something like HtmlUnit. HtmlUnit is a program that acts like a web browser but doesn’t have a user interface. It executes JavaScript just like a browser would and then you can extract the contents of the page.

I did a little bit of experimentation and found that this approach works for simple cases. I ran into a some problems with a real application but they probably have solutions. It seems like the best solution, though, is for WE to support Google’s approach itself. I’ve created a feedback report requesting this as a feature.

If there are parts of your app that could serve as entry points and you want to be able to drive search engine traffic to them, please sign to this report:
feedback://showreport?report_id=19412

ActiveRecord for Real Studio

We are Real Studio consultants.  It’s what we do and we do a LOT of projects.  If I had to put a percentage on the projects that are database driven I’d have to say that it’s above 95% for the past ten years.

Real Studio doesn’t have database binding like Visual Basic 6 but it’s not a real big deal.  If anything, the lack of binding makes the code more explicit (i.e. easier to read) and you don’t have to go hunting through control properties to find table and field names.  The Real Studio database classes are generic so it doesn’t matter, generally, what database you’re connecting to.  The drawback to the lack of binding and the generic classes is that it does lend itself to creating the same code over and over and over again.

Because of the nature of Real Studio many users tend to put their db code into the form (window) and tie it to controls.  This leads to spaghetti code with the database specific code all over the place and makes changes to your database harder.  Seth has done two presentations at ARBP conferences 2009, 2011 and introduced attendees to ActiveRecord that we’ve used for years now.

Active Record is a very simple, and limited Object Relational Model (ORM) system.  It allows us to create REALbasic classes that the IDE knows about.  It’s not exceptionally strong with the relational data, or large blobs, but it can be programmed to handle it.

In a new project we’re converting an existing Visual Basic 6 project with roughly 25 tables and several tables have over a hundred fields each.  Using conventional means it would mean having a database editor open so I can copy and paste field names all the time.  However, using ActiveRecord we created the classes (we have a utility to do this) and now the IDE knows the table and field names.  This makes coding very fast and they’re is no worrying about spelling errors and there’s no longer any issue of what the data type is because the class knows what it is.  This is nice since the compiler will pick up any many errors that may not usually find until runtime.

The client was ecstatic after the conversion since he figured that would have taken about 20 hours to convert the VB6 code into something useable in RB.  Instead, between our utility and ActiveRecord it took me less than 4 hours.  So now instead of spending all the time getting classes ready, we’re doing the real work of connecting up the UI to a set of data aware classes.

Another feature that was added was to flag the developer if a field is in the database that isn’t in the class.  How many times do you add a field to the database (or a coworker does) and you forget to hook it up.  This doesn’t happen using ActiveRecord.  You can have class properties that aren’t a field, but if you delete a field property that’s been used in the application the compiler will flag you on it and that’s very useful too.

ActiveRecord makes extensive use of Shared Methods so that all of the database code for that table is access from that class and that class only.  It has a number of methods built-in such as getting a list of rows (in array form) and finding a record by the primary key.  It’s easily extensible.

Like I said earlier, it’s not perfect.  It doesn’t handle relational data at all, but it can be modified to do so.  Large blobs can slow it down, but in the few times this has been a big deal we’ve implemented ‘lazy loading’ where we don’t load that particular field until we ask for it.

We have a single tutorial page up for it now at the main website.  We’ll eventually turn this into video tutorials and we’ll demonstrate it in more video’s.  It’s an MIT style license so feel free to use it.  If you have additions and suggestions, please don’t hesitate to contact us.

More information, and downloadable classes can be found at http://www.bkeeney.com/realbasic/activerecord

Mockups Using Balsamiq

Our Senior Developer, Seth Verrinder, introduces us to a tool for creating simple and effective mockups. – Bob

Like most developers I’ve had to mock up user interfaces for a lot of projects.

In the past I’ve used two approaches for this: a) Get everyone in the same room and share a whiteboard or a piece of paper or b) use Real Studio to create an interface that doesn’t have any code behind it. I’ve even scanned hand drawn mockups and sent those in an email.

I hate using Real Studio (or any other IDE, it’s nothing against Real) to mock up interfaces. The problem is that the end result looks like it’s a real program, so if I don’t make it look nice then it looks like a program that sucks instead of a mockup of a nice program. The whole point of mockups is that nobody is sure exactly what should be on a window or how different parts of a program should fit together so polishing the UI is a waste of time.

Another problem is that a mockup that looks like a finished program is easy to mistake for a finished program by a non-programmer. This is a point I first heard made by Joel Spolsky over at Joel on Software. Unless the goal is to actually design the final interface for a program I would stay away from this approach.

The advantage of the whiteboard and paper approach is that nobody looks at a freehand drawing and thinks that the end program is going to consist of blue lines that aren’t quite straight. But the end result is usually kind of disorganized and it’s hard to store much less revise it in the future.

Enter Balsamiq Mockups. This is a very slick program written by Peldi Guilizzoni (originally written during nights and weekends while he worked at Adobe). It’s basically a wireframe drawing tool with a bunch of standard UI components like buttons, windows, scrollbars, and many more that look like they’re hand drawn. You can drag things around and change labels pretty much like a designer in an IDE except without any real limitations on where things can go since it’s all just a drawing.

The end result is a surprisingly attractive design that could never be mistaken for a working program or an actual UI. Mockups is developed using Adobe AIR and as a developer of native apps for Mac and Windows, I wasn’t sure it would feel quite like a native app and it doesn’t, but it also turns out that it’s been so well designed that it’s actually fun to use and there’s not really any learning curve to speak of. Overall, I highly recommend mockups to anyone who develops software for a living.

What’s Your Real Studio Story? (Part two)

In part one of this series I talked about the early chapters of my Real Studio story.  Today I’ll talk about some of the things we (because we have multiple employees) with Real Studio.

Let’s go back to the 2008.  That was the last year that Real Software held the REAL World conference in Austin, Texas.  I begged Real Software to let me have a meeting at 8:00 AM to hold an organizational meeting for a REALbasic users group of some sort.  I was surprised at the turnout and the Association of REALbasic Professionals (ARBP) was born.  http://www.arbp.org

Starting ARBP has been a job of persistence and overcoming inertia.  Since we started with nothing: no organization, no leaders, no website, no expectations, we really had no idea what we were going to be when we grew up.  Thankfully I was supported by an awesome group of dedicated individuals that really helped push the organization, and me, along.

In three years, ARBP has hosted two conferences.  The first was in Boulder, Colorado in 2009 and the second was in Atlanta, Georgia this past March.  Both of those conferences were recorded and are available for ARBP paid members.

Besides helping organize both events I’ve spoken at both of them.  So has my #1 employee, über programmer, Seth Verrinder.  Seth has been with us for three and a half years and has been an awesome addition to the team.  Without him, we wouldn’t be as successful as we are.  Between the two of us we’ve also written a fair number of the tutorials, newer projects in the source code repository, and articles.

Sharing code with the community is great way to contribute.  Many of us ‘old timers’ have a library of code just sitting around that would contribute to the community and help people just starting out with Real Studio.  Think about adding your source code to the ARBP Source Code Repository.

Speaking of training, in late 2009 I was contacted to do some video training for Real Studio.  They only wanted about eight hours of video and I felt that I couldn’t do the language or the IDE justice in that short amount of time.  But it did start my creative juices flowing and now I have over 30 hours of Real Studio video training material available at http://www.bkeeney.com.  That 30 hours comprises over 110 separate videos including most of the common Real Studio controls for both desktop and Web Edition.  Most videos come with a project file that you’re free to use in your own projects.  I have two complete series where I start at the beginning of a project and follow it through to the end.  Needless to say, I’ve been very happy with the results and the comments I get from users are very encouraging.

What sort of work do we do with Real Studio?  Well, it varies all the time since we’re a consulting firm.  In the past year we’ve done major updates to professional athletic training system (we did version 1 as well), updates to teleprompting software (we did the version 2 rewrite), major work a Web Edition project for an underwriting company, fixed some right-to-left language support in an existing Real Studio app, updates to a veterinary management app, and updates to credit repair software.

From-scratch projects include a PDF viewer/annotation/organizer app, a military strategy simulator, a family genealogy organizer, a front end user interface to a serial lightning detection device, a neurological test for patients with brain damage, a proof-of-concept app for a Mac OS X computer to talk to a electronic keyboard that uses a proprietary ethernet protocol, and a Web Edition app to share URL’s among registered users.  Most desktop projects are cross-platform.

On top of all that, we’ve created a number of smaller, proof-of-concept/training projects for folks that want to do something specific in RB but don’t have the time or inclination to learn it on their own.  These projects are actually kind of fun since they’re very specific and allow us to explore a control or API that we’ve not spent much time on without having to worry about the nit picky details of a full-blown application.

I’m very picky on how I organize documents (I am an engineer after all) so every now and then I go through the older directories as a refresher.  We’ve done a LOT of projects over the years and not one of them is similar to another one.

So how do I find the clients?  At this point we’ve been doing Real Studio consulting for a long time and a lot of long-term clients keep coming back for rewrites and major new additions.  I’m very happy about that as the relationship is already in place and they trust us.  It’s an awesome feeling.

Believe it or not, the video training has been a nice addition to our consulting business.  The progression is that people sign up for the videos and then after a couple of weeks (or months) they send us an email asking if we are available for work.  Because of the videos we already have a ‘relationship’ even if I’ve never talked to them before because they see how I work with Real Studio.

I’m also a member of the Real Studio Consulting Referral Program https://secure.realsoftware.com/store/consulting.php.  It currently costs $495 for twelve months and $295 for six months.  It’s worth it.  By the time a potential client sends in their information to the Find a Developer Page at https://secure.realsoftware.com/support/consultants.php they’ve already decided that Real Studio is what they’re looking for.

At one Real World I said being part of the Referral Program is “like shooting fish in a barrel”.  I still believe that.  The cost is insignificant.  One very small project and it pays for itself.  If you want to start working with Real Studio on a full-time basis, this is the place to start.

One last note on ARBP.  I’m happy, and a little sad, to say that today is my last official day as leader of the organization.  Tonight is our board meeting where a new board will take over and a new president will lead ARBP into the future.  I’m still on the board as Treasurer (assuming no one else wants it) but the day to day stuff will no longer be in my hands.  I urge you to volunteer as it’s a great organization that is always looking for help.  You don’t have to be a Real Studio expert (or professional) help out.

So those are the current chapters in the BKeeney Software Real Studio story.  What sort of projects are you working on?  How are you finding work?