Sunday, October 15, 2006

Building a Sample Core Data Application

I just finished going through a training blitz consisting of 15 very short screencasts. Each screencast had an audio narration by a guy who obviously knew what he was doing, and knew how to explain it quickly and simply.

Anyone who is programming the Mac, or contemplating it - needs to take a look at these videos. They teach the viewer/reader how to use Apple's powerful Core Data facility of Cocoa really fast, using the revolutionary Xcode 2 IDE. The sample program that is swiftly created is written in Objective-C, the primary language for writing Cocoa programs on the Macintosh.

In the 1970s, following publication of some articles on good/bad programming practices in the late 1960s, structured programming became all the rage. Structured programs were modular. They could be created and modified swiftly. All that was required was a little clear thinking, discipline, and organization.

In the 1980s, the computer programming field was revolutionized by OOP (object-oriented programming). OOP was basically structured programming on steroids. The buzzword MVC (model-view-controller) started getting bandied about as the ideal way to write GUI programs in an OOP language. The only popular implementation of MVC was MacApp, an Objective-Pascal library later rewritten in C++ (object-oriented C).

Most programs written in the late 1990s probably used OOP.

However, it is a virtually certainty that most programming in the late 1990s did not use MVC. Some used a watered down form of MVC called Document-View.

However, the granularity of the model and view objects in a Document-View application is too course. Most of the benefits of MVC are not obtained with Document-View.

In the 1990s, there was this big deal being made about RAD (rapid application development).

RAD (rapid application development) programming also arose in the 1980s. RAD was based on three elements common to objects in object-oriented GUI applications:
  1. properties
  2. methods
  3. events


This trio of things, which were available on any field or other control in a view, as well as the view itself, could be edited in a tabbed property sheet in a sidebar of a WYSIWYG editing window for the view being created.

This trick, which all major OOP IDEs had adopted by the early 2000s, solved the problem of GUI applications being written slowly or modified quickly. At least, if they were simple ones.

If they were database clients or graphical editors, then they would use parts of a framework to implement the glue between the screen and the back end of the program. Data management and graphical operations usually still had to be coded by hand, at a layer of the application built just above these framework facilities.

Apple changed all that for Mac programmers in 2005, when the company released Core Data as part of the Tiger operating system - accompanied by improvements in its free IDE for the Mac: Xcode.

Using the latest version of Xcode (now at version 2.4), a programmer can start off creating his application by defining its model in a graphical UML diagram view. There he defines entities, their properties, and their relationships to each other.

He then goes on to create his view, where controls that reference these model objects via bindings are organized onto a display view.

Custom controllers can be used to initialize/modify model objects at apropos times in response to events.

Here is the training series of screencasts that I mentioned at the beginning of this post.

Building a Sample Core Data Application (Apple Developer Connection video series):
Core Data is a powerful data-management framework
introduced with Mac OS X v10.4 Tiger. When you take
advantage of Core Data, it slashes the amount of custom code
you need to write in order to manage application data.
Opening, saving and undo management can all be handled by
Core Data, freeing you to concentrate on creating unique
features for your application.


If you are a programmer, and you own or use a Macintosh, you have to watch these videos. They are that good. You will be picking your jaw up after the floor, going I own that?.

Because you do.

Every Macintosh comes with the latest Developer kit for the Macintosh, as well as giving its owner the right to join the Apple Developer Connection (free!). That memvership gets you into the developer.apple.com website.

From that site, you can get the latest version of the Developer toolkit (Xcode, documentation, frameworks/libraries) as well as sample programs.

By the way, Mac OS X 10.5 (Leopard) will be coming out next year. Sometime around its release date - in early 2007 Q2, I would imagine - Xcode 3.0 will be released.

Two things that arrive with Xcode 3.0 are super-powerful new visual components: iChat-like chat views and Keynote-like presentation views, for example - and something really impressive.

The impressive new feature in Xcode 3.0 is the debugging timeline.

In electronics, it is well-recognized that the state of a device changes and that being able to watch, record, and affect these state changes (e.g. voltage levels, frequency changes, etc.) is extremely useful and important.

Well, Xcode 3.0 brings this capability to Mac programmers with a program called Xray. The Xray GUI sports a Garage-band like timeline that lets a programmer track I/O actions and GUI events in chronological order.

Xcode is built upon the DTrace utility from Sun.

Xcode 3.0 was written using Xcode 3.0 and Objective-C 2.0. Apple's own technology has proven itself.

While it has long been known that some other vendors eschew their own technology they sell to programmers when it comes to building their own application products, this is not the case with Apple.

And since Apple is closely tied into the whole open source movement, fantastic technologies like GCC, DTrace, and so on - come their way - and are passed on to the Apple programming community - easily and seamlessly.

Check out the Core Data training/demo video screencasts, and you will see what I am talking about. It is RAD MVC GUI OOP WYSIWYG MDA programming delivered to you in the form of one sweet little IDE that leverages off of some truly great frameworks.

Basically, this is the solution that the history of computing has been pointing to for the past four decades. Apple delivered it last year, and they are continuing to make it better as each year passes.

0 Comments:

Post a Comment

<< Home