Professional Documents
Culture Documents
Previous meeting
Introduced SDF and Stratego Gave some simple examples of grammar definition and code generation using the above
Created two of the same very simple applications for Android and iOS
Purpose: Get a feel of what language constructs are needed in the DSL to be able to create some basic apps Some findings:
Smartphone apps are usually centered around the user interface, and navigation between screens Central classes are Activity (Android); UIApplicationDelegate, UIViewController (iOS)
Activity (1)
Usually, this corresponds to a full screen window that is shown to the user
public class MainActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); }
Activity (2)
For example, showDetailInfo might be declared as an onClick property for a button in the XML layout file
Activity (3)
UIViewController (1)
An instance of this class handles a UIView object, which can be thought of as the screen
@implementation MyViewController
- (void)loadView { CGRect bounds = [[UIScreen mainScreen] bounds]; self.view = [[UIView alloc] initWithFrame: bounds]; }
@end
UIViewController (2)
pushViewController popViewController
UIApplicationDelegate
Entry point of the application (cf. In Java it is an Activity, defined in a manifest file) application:didFinishLaunching
Start defining grammar for user interface Define a little bit of grammar implement the code generation for both Android and iOS
UI will be difficult to generate code for want to start early Layout predefined, possibility to set exact position values for UI components?