Hello World: Windows Mobile vs Symbian vs Android vs Iphone

First Symbian, than Windows Mobile, than the Iphone, now the Google Android platform... the mobile development world is really on movement.

These are all great platforms, each of them with their pros and cons (as usual).

What about if you have to develop the classic "Hello World" application on each of this platforms?

With Symbian it will be something like this:

// HelloWorld.cpp
//
// Copyright (c) 2000 Symbian Ltd. All rights reserved.
#include "CommonFramework.h"
// do the example
LOCAL_C void doExampleL()
{
_LIT(KHelloWorldText,"Hello world!\n");
console->Printf(KHelloWorldText);
}

You will also need an mmp (HelloWorld.mmp) file which contains:


// HelloWorld.mmp
//
// Copyright (c) 2000 Symbian Ltd. All rights reserved.
//
// using relative paths for sourcepath and user includes
//
TARGET HelloWorld.exe
TARGETTYPE exe
UID 0
//
SOURCEPATH .
SOURCE HelloWorld.cpp
//
USERINCLUDE .
USERINCLUDE ..\CommonFramework
SYSTEMINCLUDE Epoc32include
//
LIBRARY euser.lib

And finally a bld.inf file


// BLD.INF
// Component description file
//
// Copyright (c) 2000 Symbian Ltd. All rights reserved.
PRJ_MMPFILES
//only one project
HelloWorld.mmp

With the Iphone SDK:

You've to start by creating an XCode project named helloworld. You won’t need to touch the main.m or main.h files, only the helloworldAppDelegate.m and helloworld.AppDeleage.h files.

The header file:

    1 //
    2 //  helloworldAppDelegate.h
    3 //  helloworld
    4 //
    5 //
    6 //
    7
    8 #import <UIKit/UIKit.h>
    9
   10 @class MyView;
   11
   12 @interface helloworldAppDelegate : NSObject {
   13     UIWindow *window;
   14     MyView *contentView;
   15     // Levi: Define textView object
   16     UITextView  *textView;
   17 }
   18
   19 @property (nonatomic, retain) UIWindow *window;
   20 @property (nonatomic, retain) MyView *contentView;
   21 // Levi: Declare textView as a property
   22 @property (nonatomic, retain) UITextView *textView;
   23
   24 @end
   25

The helloworldAppDelegate.m:

    1 //
    2 //  helloworldAppDelegate.m
    3 //  helloworld
    4 //
    5 //  
    6 //
    7
    8 #import "helloworldAppDelegate.h"
    9 #import "MyView.h"
   10
   11 @implementation helloworldAppDelegate
   12 
   13 @synthesize window;
   14 @synthesize contentView;
   15 // Levi: Tell the compiler to synthesize relevant accessors
   16 @synthesize textView;
   17
   18 - (void)applicationDidFinishLaunching:(UIApplication *)application {
   19     // Create window
   20     self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
   21
   22     // Set up content view
   23     self.contentView = [[[MyView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease];
   24     [window addSubview:contentView];
   25
   26     // Levi: Create the text view.
   27     self.textView = [[[UITextView alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)] autorelease];
   28     [textView setEditable:YES];
   29     [textView setText:@"Hello World"];
   30
   31     // Levi: Add a text view to the content view.
   32     [contentView addSubview:textView];
   33
   34     // Show window
   35     [window makeKeyAndVisible];
   36 }
   37
   38 - (void)dealloc {
   39     // Levi: Release the textView
   40     [textView release];
   41     [contentView release];
   42     [window release];
   43     [super dealloc];
   44 }
   45
   46 @end
   47

With Google Android it will be:

package com.android.hello;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       TextView tv = new TextView(this);
       tv.setText("Hello World");
       setContentView(tv);
   }
}

And with Windows Mobile? It will be:

using System;
using System.Windows.Forms;

public class HelloWorld {

    public static void Main() {

        MessageBox.Show( "Hello World!" );
    }
}

Who is the winner?? :)

Technorati Tags:

Print | posted on Wednesday, September 24, 2008 9:14 PM

Comments on this post

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
hi,

nice, though one would argue about number of files needed,
iPhone is cocoa so your WMobile sample can be fitted into single "main.m" autogenerated file:

#import

int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}

@interface HelloWorldAppDelegate : NSObject {
UIWindow *window;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end

@implementation HelloWorldAppDelegate
@synthesize window;

- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window makeKeyAndVisible];
UIAlertView *alert = [[UIAlertView new] initWithTitle: @"Message" message:@"Hello World!" delegate: nil cancelButtonTitle: @"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
- (void)dealloc {
[window release];
[super dealloc];
}
@end


regards,
Peter
Left by Peter Blazejewicz on Sep 25, 2008 4:09 AM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
Thanks Peter...
Left by Stefano Demiliani on Sep 25, 2008 2:31 PM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
Well, since the latest symbian phones has python built in, the symbian version becomes


print "Hello, World!"

- so now who is the winner ;-)
Left by erta on Oct 16, 2008 2:29 AM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
Print the entire Python code or it will be difficult to say who is the winner :)
Left by Stefano Demiliani on Oct 16, 2008 8:51 AM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
but the entire Phyton code is:

print "Hello, World!"

hehe
Left by souojor on Oct 27, 2008 12:13 AM

# Mr

Requesting Gravatar...
You didn't put any comments with the Windows Mobile one. Bias if ever I saw it.
Left by Jimbo on Dec 05, 2008 3:07 PM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
Python does install on WinMo too, so the "print 'Hello, World!' works on that too!! Now, who's the winner?
Left by James Kally on Dec 08, 2008 1:51 PM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Left by samira on Jun 03, 2009 1:50 PM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
as you see windows mobile is the best solution
for time to market
Left by yaron on Jul 15, 2009 10:02 AM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
The winner is the one people use. And Windows Mobile is on the bottom of that list, by far.
Left by Michael Campbell on Jan 13, 2010 2:58 PM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
Here is the Hello World using Qt:

#include < QApplication >
#include < QLabel >

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel label("Hello world!");
label.show();
return app.exec();
}


Note that Symbian's current application and UI framework will soon be replaced by Qt. Symbian ^4 will be the first Symbian version using Qt. Symbian ^4 will be released in the end of this year.
Left by miksuh on Apr 11, 2010 11:03 PM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
I wanted to make sure that this site don't think there is some tags in my comment, that's why i added two extra spaces to both #include-lines. Remove those before compiling.
Left by miksuh on Apr 11, 2010 11:22 PM

# replica jewelry

Requesting Gravatar...

Note that Symbian's current application and UI framework will soon be replaced by Qt. Symbian ^4 will be the first Symbian version using Qt.
Left by replica jewelry on Apr 29, 2010 5:21 AM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
mobile development world is really on movement.

These are all great platforms, each of them with their pros and cons (as usual).

What about if you have to devel DELTA laptop adapter
Left by wholesale laptop adapter on May 23, 2010 2:45 PM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
The whole idea of these mobile phone operating systems like Windows Mobile, Symbian and Android, made by software companies, is to accelerate time to market and reduce development costs. Silicon makers also tailor their chips for these OSs based on their capabilities/features, so it’s easier for phone manufacturers to develop devices with these popular OSs.
Left by revues des casinos en ligne on May 29, 2010 10:01 AM

# low priced jordans

Requesting Gravatar...
based on
Left by low priced jordans on Jul 08, 2011 9:43 AM

# re: Hello World: Windows Mobile vs Symbian vs Android vs Iphone

Requesting Gravatar...
I wrote a short tutorial demonstrating a simple hello world application for windows 7 mobile. Hope its helpful to users tek1.org/how-to-write-a-simple-hello-world-prog...
Left by slipfriction on Jan 29, 2012 11:16 AM

Your comment:

 (will show your gravatar)
 
Please add 6 and 1 and type the answer here: