iPhonical
Model Driven Software Development for the iPhone
The iPhonical project provides a rapid prototyping development process as well as an Eclipse-Plugin (based on Xtext) that offers a simple Domain Specific Language (iPhonical DSL) for describing iPhone applications. The created models based on this DSL are the input for an openArchitectureWare code generator which creates various ObjectiveC artifacts in order to accelerate iPhone development and improve the quality of the ObjectiveC code by replacing a lot of glue code with generated code.
Generated artifacts are things like:
- Entity classes (Domain Objects)
- optionally Object Relational Mapper for SQLite3 (DAO Layer)
- Transformation - from and to JSON format
- View Controllers with basic outlet attributes
- Simple NIB Files corresponding to the view controllers
- JSR-311 HTTP/JSON Rest based Web Services (iPhone Client and Server using JBoss RESTEasy)
These things are generated in a layered architectural style that should reduce the need to manipulate any generated code. Using Categories and Subclasses should be all that's needed to program the (manual) rest of the application.
The generated code has dependencies to the following open source projects which provide some excellent APIs to use (see links for more info):
- FMDatabase
- JSON-Framework
- JBoss RESTEasy
Getting started
see here
- Right now it is beneficial if you are experienced with XText and openArchitectureWare development until further information/tutorials are provided. Anyway you can try the example an you can adapt the scripts to your own purposes.
Usage examples for iphonical DSL:
iphonicalModel iDriveLog {
...
entity Car {
String name;
String number;
Integer km;
JourneyEntry * journeys;
};
entity JourneyEntry {
Location startLocation;
Location endLocation;
String comment;
Integer startKm;
Integer endKm;
Car car;
Driver driver;
Reason reason;
};
entity CarDataResponse {
String creationDate;
Car car;
Location location;
JourneyEntry journey;
Driver driver;
};
viewController Root {
ui Label myLabel;
ui Textfield myTextfield;
action myAction;
};
restService iDriveLogService "/idrivelogservice" {
baseUrl "http://localhost:8080/iDriveLogRESTWebServices";
get data "/data" response:CarDataResponse;
};
}Usage examples for generated code:
//Persistence and JSON Marshalling
NSLog(@"Opened database ... ");
[db open];
[db setShouldCacheStatements:YES];
[db beginTransaction];
// Create and Save car
CarDAO *carDAO = [[CarDAO alloc] initWithDBManager:db];
NSLog(@"CarDAO initialized ...");
Car *car = [[Car alloc] init];
car.km = [[NSNumber alloc] initWithInt:10];
car.name = @"BMW 7er";
car.number = @"KA-IT 310";
car = [carDAO save:car];
NSLog(@"Saved Cars! %@ with idnr: %i", car, car.idnr);
car = [carDAO findCarByIdnr:car.idnr];
NSLog(@"Found Car! %@ with idnr: %i", car, car.idnr);
NSLog(@"To JSON: %@",[car asJSON]);
NSLog(@"From JSON: %@", [[car initWithJSON:[car asJSON]] name]);
[db commit];
[db close];
...
// WebService usage example
- (int ) webservicecall {
CarDataResponse *response = [IDriveLogService getData];
NSLog(@"Marshalled: %@", [response asJSON]);
return 0;
}There is also a Google Group for iPhonical: http://groups.google.de/group/iphonical
If you have any questions about the project you can contact me under: wolfgang.frank AT arconsis.com