|
(c) 1998 Andrew C Stone, All Rights Reserved.
Today I'd like to share what makes Rhapsody so lovable as well as what's bringing me down about it. To provide you with a concrete example of what makes Rhapsody/Yellow Box so powerful, I'm going to outline a programming task, and you can guess how much code it would take to implement. Even if you have never programmed a single line of code in your life, you may still find this understandable.
The task: given an image file, create and save a new HTML file on the fly with a similar file name, but with the .html ending. For completeness, we must delete any previous version on disk first. Then, we need to display that image by calling the user's personal favorite Web Browser, even if this changes while our program is running, to open our newly created HTML file.
Before you answer, remember, I need a cross-platform, works on Yellow Box for WINDOWS 95 as well as the Rhapsody operating system version, so all of the path names must honor either the C:\\someSillyWindows\path and the UNIX /now/this_is/aPath format, or any other file name path format used by any operating system that supports Yellow Box.
Answer: 5 lines of code!
How is this possible? Through excellent engineering and reapplying the lessons we have learned over the last decade in object programming, and through successive iterations of refinement of the AppKit and Foundation frameworks.
Here's the code:
#define HTML_CODE @"<HTML><HEAD><title>%@</title></HEAD><BODY BGCOLOR=\"#eeeeff\"><IMG SRC=\"%@\"></BODY></HTML>"
- (void)createAndOpenHTML:(NSString *)imagePath
{
NSString *htmlFile = [[imagePath stringByDeletingPathExtension]
stringByAppendingPathExtension:@"html"];
NSString *s = [NSString stringWithFormat:HTML_CODE,imagePath,
[imagePath lastPathComponent]];
[[NSFileManager defaultManager] removeFileAtPath:htmlFile handler:nil];
if ([s writeToFile:htmlFile atomically:NO])
[[NSWorkspace sharedWorkspace] openFile:htmlFile];
}
Here's a line-by-line explanation:
// given the image file path, "imagePath", strip off the Image extension
// and then add the "html" extension:
NSString *htmlFile = [[imagePath stringByDeletingPathExtension]
stringByAppendingPathExtension:@"html"];
// Create a string using the defined HTML_CODE as a template
// and feed it the parameters of the image file path:
NSString *s = [NSString stringWithFormat:HTML_CODE,imagePath,
[imagePath lastPathComponent]];
// Ask the FileManager to remove the file, no matter
// what Operating System we are under:
[[NSFileManager defaultManager] removeFileAtPath:htmlFile handler:nil];
// Strings know how to write themselves to a file...
// we don't have to know anything about disk I/0!
if ([s writeToFile:htmlFile atomically:NO])
// We ask the Workspace, which keeps track of user's favorite app
// for "html" files, to launch & open the file:
[[NSWorkspace sharedWorkspace] openFile:htmlFile];
That's why I love Rhapsody & Yellow Box - I can quickly build powerful apps that leverage on this amazing object power, and even non-programmers can read and understand the code, because it is written in almost plain English!
So what's the downside? Number one is that hardly anyone has this awesome technology yet, and very few people understand all of its advantages. Most disturbing is the constant change of focus of Apple's marketing staff - they seem to be having a very difficult time figuring out how to "position" Rhapsody, and then keep to that position with a consistent message.
To think that Rhapsody is "Just" a super-robust server operating system is to miss the point entirely. I am somewhat relieved that the phrase "and Power Users like Web Developers" has been added to the "Server OS" marketing position, because, by definition, most Macintosh users ARE power users, and many are doing web development!
It seems like Apple Marketing has been waffling back and forth and have delayed or under-budgeted Rhapsody promotion because of these, perhaps false, perceptions:
1. That promotion of Rhapsody for INTEL or YellowBox for Windows will cannabalize hardware sales of Power PC units. Let's analyze this a moment - first of all, the PPC version of Rhapsody is truly optimized and superior to the INTEL version. Secondly, there is an order of magnitude of more Pentium boxes to run Rhapsody/YB already out there - this is a brand new market that is much larger than the existing Macintosh community, and should not be ignored. Thirdly, the profit margin on hardware sales is small, but the profit margin on software is tremendous. So what are they waiting for?
2. The Large Mac Software Houses (MS, Claris, Adobe, etc) would not like the disturbance of the comfortable status quo because even though they were told about Rhapsody a year ago, they haven't yet mobilized their resources and perhaps do not have any Rhapsody apps ready yet. Past failures of Apple to deliver announced API's have given many developers a "wait and see" attitude. I say Apple owes nothing to firms who are lazy or have no faith, and there exists a need to promote those who are actively developing Rhapsody apps. This new support will encourage those who have not yet embraced Rhapsody to get onboard the Yellow Box Express.
In all of this discussion, the thing to remember is that corporations are a single entity only in the eyes of the Internal Revenue Service. Even though we use phrases that include "Apple this..." and "Apple Marketing that...", we are really referring to a group of intelligent people, hopefully acting in concert. Because of this, I have faith that some of them might stumble over this article and thus change their minds about how they should market Rhapsody!
|
|