SlideShare une entreprise Scribd logo
1  sur  89
Copyright © 2012 Job and Esther Technologies, Inc.
(1) INTRODUCTION
Industry overview
Cross platform development
Introduction to Eqela
Eqela syntax / language features
Copyright © 2012 Job and Esther Technologies, Inc.
Our world
(.. And all platforms come in various versions)
Copyright © 2012 Job and Esther Technologies, Inc.
From an application development perspective ..
While targeting only the most popular
target platforms, a developer will need to
work with 10-20 different operating system
platforms/versions, at least 3-5 different
programming languages, each with
different API libraries.
Copyright © 2012 Job and Esther Technologies, Inc.
Big problem in the industry
All software developers need to
deal with this one way or the
other
Copyright © 2012 Job and Esther Technologies, Inc.
HOW?
Copyright © 2012 Job and Esther Technologies, Inc.
Usual solutions
(1) Work only on one platform
(2) Create the same application several
times (once per platform)
(3) Do “cross platform development”
Copyright © 2012 Job and Esther Technologies, Inc.
Traditional ways to do cross platform development
(1) The “scripted” approach
(Adobe Air / Flex, Appcelerator, Corona, RhoMobile, ..)
(2) The “bytecode” approach
(MoSync, Mono)
(3) The “C++” approach
(Marmalade, Qt, WxWidgets, Unity)
(4) The “embed a web browser” approach
(PhoneGap)
(5) HTML5
Copyright © 2012 Job and Esther Technologies, Inc.
Five different cross
platform development
approaches
Copyright © 2012 Job and Esther Technologies, Inc.
#1: The “scripted” approach
Source code
In a scripting
language
Development
tool
Unmodified
Source code
+
Interpreter /
Virtual machine
For iOS
Unmodified
Source code
+
Interpreter /
Virtual machine
For Android
Run in
browser
Android
application
iOS
application
(JavaScript,(JavaScript,
Lua, Ruby, ..)Lua, Ruby, ..)
(Adobe Air / Flex, Appcelerator, Corona, RhoMobile, ..)
Runtime /
Virtual
machine
Copyright © 2012 Job and Esther Technologies, Inc.
The “scripted” approach: Architecture
Operating system
Language interpreter / runtime
APIs and libraries Application code
Copyright © 2012 Job and Esther Technologies, Inc.
The “scripted” approach: Architecture
Operating system
Language interpreter / runtime
APIs and libraries Application code Makes application
Installers much bigger
Increases memory
usage
Reduces runtime
Performance
Due to this approach being very popular, many consider
cross platform development to be slow, high in memory use,
and producing bigger installers.
Applications can only
Access selected
Parts of the native API
Copyright © 2012 Job and Esther Technologies, Inc.
#2: The “bytecode” approach
Source
code
Bytecode
Compiler
Android
application
Run in
browser
Class
Library
(MoSync, Mono)
iOS
application
Windows
Phone
application
Very similar to the “scripted” approach,
with the added bytecode compilation step.
Bytecode
Development
Tool
Runtime /
Virtual
machine
Copyright © 2012 Job and Esther Technologies, Inc.
The “bytecode” approach: Architecture
Operating system
Bytecode interpreter / runtime
APIs and libraries Application code Makes application
Installers much bigger
Increases memory
usage
Reduces runtime
Performance
Due to its similarity with the “interpreted” approach, the
benefits and disadvantages are very similar
Applications can only
Access selected
Parts of the native API
Copyright © 2012 Job and Esther Technologies, Inc.
#3: The “C++” approach
Source code
In a specific
Language
SDK /
compiler
Run in
browser
Android
application
iOS
application
(C++)(C++)
Cross
Platform
Class library
In the specific
language
(C++)(C++)
(Marmalade, Qt, WxWidgets, Unity)
BlackBerry
application
Windows
Phone
application
+ Truly native (100%)
+ High performance
- Limited platform support
(not really cross platform)
Copyright © 2012 Job and Esther Technologies, Inc.
#4: The “embed a web browser” approach
Source
Code in
HTML, CSS,
JavaScript
The
tool
Libraries C source code
That opens a
Browser and
Displays the
program
Java source code
That opens a
Browser and
Displays the
program
Android
SDK
Android
application
iOS
SDK
iOS
application
Run in
browser
(PhoneGap, AppGyver)
- Very poor performance
- Suitable for only “web-style” apps
- Limited access to platform APIs
- Application source code can be easily retrieved
+ Easy way to convert existing websites to
“native apps”
Copyright © 2012 Job and Esther Technologies, Inc.
#5: HTML5
+ Commonly known skillset (HTML, CSS, JavaScript)
+ Very popular, many Internet resources available
- Unfinished standard
- Fragmented, non-compatible implementations
- Extremely poor performance on mobile
- The language is poorly suited for large programs
- Applications are inherently “open source”
Copyright © 2012 Job and Esther Technologies, Inc.
Common issues
Large installer size
Excessive memory use
Low performance
Limited API access
Copyright © 2012 Job and Esther Technologies, Inc.
Cross platform development tool ..
.. Based on programming language conversion
technology
Copyright © 2012 Job and Esther Technologies, Inc.
Eqela video
http://www.youtube.com/watch?v=WcWf7SXGBv0
Copyright © 2012 Job and Esther Technologies, Inc.
How it works
Source
Code
(Eqela)
Eqela
Compiler
Libraries C
source
code
Java
source
code
Javascript
code
Android
SDK
Android
application
iOS
SDK
iOS
application
Run in
browser
Copyright © 2012 Job and Esther Technologies, Inc.
The technical benefits ..
Small installer size
Optimal memory use
Native performance
No API access limitations
Copyright © 2012 Job and Esther Technologies, Inc.
How it works: A sample application
class Main : LayerWidget
{
public void initialize() {
base.initialize();
add(LabelWidget.instance().set_text(“Hello World”));
}
}
Main.eq
Eqela
Compiler
LayerWidget,
LabelWidget
Main.java,
LayerWidget.java,
LabelWidget.java
Android
SDK
Android
application
Copyright © 2012 Job and Esther Technologies, Inc.
100% native
Main.eq
Eqela
Compiler
LayerWidget,
LabelWidget
Main.java,
LayerWidget.java,
LabelWidget.java
Android
SDK
Android
application
Only native code → “100% native”
No virtual machine added
No interpreter added
Copyright © 2012 Job and Esther Technologies, Inc.
Main.eq → Main.java
class Main : LayerWidget
{
public void initialize() {
base.initialize();
add(LabelWidget.instance().set_text(“Hello World”));
}
}
package mk.test;
public class Main extends eq.gui.LayerWidget
{
@Override
public void initialize() {
super.initialize();
((eq.gui.ContainerWidget)this).add(((eq.gui.Widget)eq.widget.LabelWidge
t.eq_widget_LabelWidget_instance().set_text(eq.api.StringStatic.eq_api_
StringStatic_for_strptr("Hello world"))));
}
public Main() {
}
}
(EQELA)
(JAVA)
Copyright © 2012 Job and Esther Technologies, Inc.
Eqela is many things ..
Copyright © 2012 Job and Esther Technologies, Inc.
Eqela is ..
(1) A modern, object oriented
programming language
Powerful, object oriented, easy to
use, efficient to program
Designed to fit the needs of the
different target platforms
Part of the C syntax family
Instantly familiar to anyone with
experience in C, C++, Java, C#,
JavaScript
Copyright © 2012 Job and Esther Technologies, Inc.
Eqela is ..
(2) An advanced compiler /
programming language translator
Converts the source programming
language (Eqela) to other languages
(Java, C#, C, JavaScript, ..)
Generates project files / directories
be used by the development tools of
the various target platforms
Pulls in libraries to link with the
application
Copyright © 2012 Job and Esther Technologies, Inc.
Eqela is ..
(3) An application framework
A cross-platform API that works
across programming languages
All common functionalities, such as
file I/O, networking, threading, data
structures, ..
Same API on any language and
operating system
Copyright © 2012 Job and Esther Technologies, Inc.
Eqela is ..
(4) A cross platform graphical
user interface (GUI) API
A rich set of user interface
components and controls
A powerful graphics rendering API for
development of custom controls
Works the same way across all
platforms (mobile, desktop, web)
Copyright © 2012 Job and Esther Technologies, Inc.
Eqela is ..
(5) A development tool / environment
Copyright © 2012 Job and Esther Technologies, Inc.
Eqela is ..
Programming language
Compiler
Application framework
GUI toolkit
Development tool / environment
Copyright © 2012 Job and Esther Technologies, Inc.
How can it be used?
Copyright © 2012 Job and Esther Technologies, Inc.
ONLINE / WEB DOWNLOAD / INSTALL
EQELA LIVE
Target Android / HMTL5
Free of charge
No installation required
EQELA “FULL VERSION”
All supported platforms
Payment per platform
Installed per workstation
The different editions
Copyright © 2012 Job and Esther Technologies, Inc.
Supported platforms
Android, BlackBerry 10, BlackBerry 5/6/7, HTML5,
Apple iOS, J2ME, Linux, Mac OS X, Symbian,
Windows, Windows Phone
Copyright © 2012 Job and Esther Technologies, Inc.
Source files and modules
Eqela source file extension: “.eq”
Generally file is named after the class, eg. “Main.eq”
for class “Main” (convention only, not enforced)
Usually one class per file (also convention)
Directory name names the module and acts as the
“application id”
Copyright © 2012 Job and Esther Technologies, Inc.
The Eqela syntax
Belongs to the “C” syntax family:
C, C++, Objective-C, Java, C#, PHP, ..
Copyright © 2012 Job and Esther Technologies, Inc.
Eqela syntax / language features
Copyright © 2012 Job and Esther Technologies, Inc.
Eqela is a fully object oriented,
class based programming
language
Copyright © 2012 Job and Esther Technologies, Inc.
Class declarations
[modifiers] class [classname] : [basetypes]
{
[implementation]
}
public class MySampleClass : SuperClass
{
public void do_something() {
// more code here
}
}
The base class and interfaces may be mixed in the [basetypes]
section of the class declaration in any order.
Copyright © 2012 Job and Esther Technologies, Inc.
Class declarations

Class declarations can include these components:
1.Modifiers: public, private (default) or fundamental.

public – the class will be exported in the module's API

private – the class is only available for use internally
within the module

fundamental – the class will not have any base class
2.The class name, by convention in CamelCase
3.The base class (superclass) and a comma-separated list of
interfaces implemented by the class may be mixed in the
[basetypes] section of the class declaration in any order.
4.The class body surrounded by braces, { }.
Copyright © 2012 Job and Esther Technologies, Inc.
Automatic base classing
class MyClass
{
// field, constructor, and
// method declarations
}
class MyClass : Object
{
// field, constructor, and
// method declarations
}
=
fundamental class MyClass
{
// field, constructor, and
// method declarations
}
!=
Copyright © 2012 Job and Esther Technologies, Inc.
There can be no program
without a class
(no standalone functions)
Copyright © 2012 Job and Esther Technologies, Inc.
Comments
// This is a valid comment
/* This is also a valid comment */
/* This
* comment
* spans
* multiple
* lines.
*/
Comments are described in a way familiar with
many languages, using either the "//" notation or
the "/*" .. "*/" method.
Copyright © 2012 Job and Esther Technologies, Inc.
Data types
Different kinds of data types:
Primitive types
Object types
(Strings)
Copyright © 2012 Job and Esther Technologies, Inc.
Primitive types
● Built in to the language as basic building blocks, and
cannot be extended by the programmer. Passed by
value in method calls.
● strptr, ptr, void, double, bool, int, long, byte
strptr var_name = “abc”.to_strptr();
ptr var_name = null;
double var_name = 123.45;
bool var_name = true;
int var_name = 100000;
long var_name = 100000;
byte var_name = 100;
void //refers to no data type at all
Copyright © 2012 Job and Esther Technologies, Inc.
Object types
Objects = Instances of classes
Passed by reference in method calls
class MyClass
{
public int method() {
return(10);
}
}
var o = new MyClass();
Copyright © 2012 Job and Esther Technologies, Inc.
Strings
String literal = "This is a string literal";
var str = "Another string literal";
if(str is String) {
; // This is true
}
Eqela API provides a “String” class that offers a
string implementation as an object (object type).
String literals are automatically assigned as
instances of the “String” object, not as “strptr”
variables.
Copyright © 2012 Job and Esther Technologies, Inc.
String operations
// assignment
var str1 = "String 1";
// concatenation
var str2 = str1.append(" + More stuff");
// console output
Log.message(str2); // prints out "String 1 + More stuff"
// comparison
if(str1.equals(str2)) {
; // not true
}
// comparison with a literal
if("String 1".equals(str1)) {
; // true
}
Copyright © 2012 Job and Esther Technologies, Inc.
Constructing strings
var sb = StringBuffer.create().
sb.append("First");
sb.append_c(' ');
sb.append("Second");
Log.message(sb.to_string()); // prints "First Second"
Normal String objects are immutable
StringBuffer class is provided as part of the API
to efficiently construct strings
Copyright © 2012 Job and Esther Technologies, Inc.
Class constructor
What is a “constructor”?
Copyright © 2012 Job and Esther Technologies, Inc.

A method with the same name as the class name

Has no return type

A class can only have one constructor function, and the
constructor is not allowed to have any parameters.
public MyClass
{
public MyClass() {
; // implementation
}
}
Class constructor
Copyright © 2012 Job and Esther Technologies, Inc.
Supplying object parameters upon creation
public MyClass
{
private int variable = 0;
public MyClass() {
}
public static MyClass create(int value) {
var v = new MyClass();
v.variable = value;
return(v);
}
}
var o = MyClass.create(10);
(1) By using static creation methods
Copyright © 2012 Job and Esther Technologies, Inc.
public MyClass
{
property int variable = 0;
public MyClass() {
}
}
var o = new MyClass().set_variable(10);
Supplying object parameters upon creation
(2) By using properties
Copyright © 2012 Job and Esther Technologies, Inc.
Class destructor
What is a “destructor”?
Copyright © 2012 Job and Esther Technologies, Inc.
public MyClass
{
~Myclass() {
; // actions here
}
}
As is usual in all modern languages with
automatic memory management, it is highly
discouraged to use destructors in Eqela
applications. Generally the only well-known
acceptable use for a destructor is to deallocate
resources allocated manually.
Class destructor
Copyright © 2012 Job and Esther Technologies, Inc.
Member variables
[modifiers] [type] [variablename] = [initializer];
class MyClass
{
int number = 10;
public static MyClass second;
private MyClass third = null;
}
Modifiers : "private", "public", "static"
Initializer is optional
Copyright © 2012 Job and Esther Technologies, Inc.
Declaring methods
public int SomeMethod(int int_value, bool bool_value) {
// method body
return(10);
}
modifiers return
type
method
name
parameter
list
If the return type is NOT void, the method must
end in a “return” line
Copyright © 2012 Job and Esther Technologies, Inc.
Virtual methods and overriding
class BaseClass
{
public virtual void hello() {
Log.message("hello 1");
}
}
class DerivedClass : BaseClass
{
public override void hello() {
Log.message("Hello enhanced!");
}
}
If a method is declared with modifier "virtual", it becomes
a virtual function.
To override a method in a subclass, it should be declared
using the "override" modifier
Copyright © 2012 Job and Esther Technologies, Inc.
Method hiding
Eqela does NOT allow method hiding
If a method is declared in a base class, and it is not virtual, no
method of the same name may be declared in any of the
subclasses, even if the parameters would differ.
Copyright © 2012 Job and Esther Technologies, Inc.
Static methods
class MyClass
{
public static void hello() {
Log.message("MyClass hello");
}
}
class SecondClass
{
public void method() {
var mc = new MyClass();
mc.hello(); // not right
MyClass.hello(); // the correct way
}
}
Called by the name of the class they are
associated with, not through an object instance
Copyright © 2012 Job and Esther Technologies, Inc.
Abstract methods
What is an “abstract method”?
Copyright © 2012 Job and Esther Technologies, Inc.
 Methods that have a method signature but no
implementation
 Declared using the modifier "abstract“
 If no "abstract" modifier is present, but method body is missing,
the "abstract" keyword is automatically assumed
 No "override" keyword is required to override abstract methods
interface MyInterface
{
public void first_method();
public abstract void second_method();
}
Abstract methods
Copyright © 2012 Job and Esther Technologies, Inc.
What is an interface?
Copyright © 2012 Job and Esther Technologies, Inc.
Interface
interface MyInterface
{
public void method1();
public int method2();
}
A group of related methods with empty bodies
Defines a standard and public way of specifying
the behavior of the class (defines a contract)
Declared using the interface keyword
Copyright © 2012 Job and Esther Technologies, Inc.
Interfaces

To use an interface, you must implement that interface in
a class

Implementing an interface

Implement multiple interfaces
class MyClass : MyInterface
{
// class body
}
class MyClass : MyInterface, MyOtherInterface
{
// class body
}
Copyright © 2012 Job and Esther Technologies, Inc.
Prerequisites
In Eqela, an interface may not "inherit" another
interface, but it may instead have "prerequisites",
through which roughly the same functionality is
achieved
Copyright © 2012 Job and Esther Technologies, Inc.
Multiple inheritance
Multiple inheritance is not allowed – but
implementing multiple interfaces IS allowed
Copyright © 2012 Job and Esther Technologies, Inc.
Legal interface usage
interface First
{
public void method1();
}
interface Second : First
{
public void method2();
}
class MyClass : Second, First
{
public void method1() {
}
public void method2() {
}
}
Copyright © 2012 Job and Esther Technologies, Inc.
Illegal interface usage
interface First
{
public void method1();
}
interface Second : First
{
public void method2();
}
class MyClass : Second
{
public void method1() {
}
public void method2() {
}
}
Copyright © 2012 Job and Esther Technologies, Inc.
Other language features ..
Copyright © 2012 Job and Esther Technologies, Inc.
Operators and expressions
Group Operator
Unary -, !, ++, --
Logical binary ||, &&
Comparative binary ==, !=, <, <=, >, >=, is
Operative binary +, -, *, /, %
int a = 10 + 5;
int b = a / 10;
If(a == 15 || b == 7) {
}
if(a == 15 && b == 7) {
}
if(a != b) {
}
Copyright © 2012 Job and Esther Technologies, Inc.
Type casting
What is the meaning of “type casting”?
Copyright © 2012 Job and Esther Technologies, Inc.
Type casting
Static type casting
One data type can be cast into another in a fairly liberal
manner by using the "(typename)" notation.
(Fast but may lead to runtime errors)
Dynamic type casting
Uses the “as” operator to cast one data type to another.
(Slightly slower than static type casting, due to extra checking involved, but a much safer
way)
double n = 100.43;
int ni = (int)n;
var x = new MyClass();
var y = (MyOtherClass)x;
var x = new MyClass();
var y = x as MyOtherClass; // will be null if not a subclass of MyOtherClass
Copyright © 2012 Job and Esther Technologies, Inc.
Control structures
If .. Else
While
Do .. While
For
Foreach
Switch
Copyright © 2012 Job and Esther Technologies, Inc.
If .. Else
if(condition) {
; // execute if condition is true
}
else {
; // execute if condition is false
}
Copyright © 2012 Job and Esther Technologies, Inc.
While
while(condition) {
; // execute while condition is true
}
while(condition) {
if(want_to_stop) {
break;
}
continue;
; // will not reach here
}
While blocks can be interrupted
with the "break" statement or
restarted with the "continue"
statement
Copyright © 2012 Job and Esther Technologies, Inc.
Do .. While
do
{
; // execute here
}
while(condition);
Copyright © 2012 Job and Esther Technologies, Inc.
For
for(initializer; condition; execute_after) {
; // actions here
}
Copyright © 2012 Job and Esther Technologies, Inc.
Foreach
foreach(var variablename in collection) {
; // actions here
}
foreach(String variablename in collection) {
; // actions here
}
The data type of the loop
variable may be dynamically
assigned as above ("var"), or
it can be explicitly set by the
user.
Copyright © 2012 Job and Esther Technologies, Inc.
Switch
switch(expression) {
case value1: {
; // statements
}
case value2: {
; // statements
}
default: {
; // statements
}
}
•All "case" blocks must be
enclosed in curly braces "{"
and "}".
•Only one "case" statement is
allowed per block.
•No break statements are
required to terminate the case
blocks.
Copyright © 2012 Job and Esther Technologies, Inc.
Properties
class MyClass
{
property int myproperty;
}
class MyClass
{
int myproperty;
public MyClass set_myproperty(int v) {
myproperty = v;
return(this);
}
public int get_myproperty() {
return(myproperty);
}
}
Copyright © 2012 Job and Esther Technologies, Inc.
class MyClass
{
property int myproperty;
}
class AnotherClass
{
public void method() {
MyClass cl = new MyClass().set_myproperty(10);
}
}
Using properties
Copyright © 2012 Job and Esther Technologies, Inc.
Default parameters
public void my_method(int n = 0) {
// (method implementation code here)
}
obj.my_method(10);
obj.my_method();
Automatically supply parameter values where
no parameters are given
Copyright © 2012 Job and Esther Technologies, Inc.
Embedding other languages
Copyright © 2012 Job and Esther Technologies, Inc.
Embedding code
The dictionary definition of “embed” is to make
something an integral part of
In Eqela programming language, “embedding” refers
to adding other programming languages into blocks
within the Eqela code
Copyright © 2012 Job and Esther Technologies, Inc.
Embed: Syntax
embed “(language name)” {{{
// code in other language
}}}
Languages: c, c++, objc, java, js, cs, ..
int n;
embed “c” {{{
char* str = “Hello World”;
n = strlen(str);
}}}
Log.message(“Length = %d”.printf().add(n));
Copyright © 2012 Job and Esther Technologies, Inc.
Embed: Example
class Main
{
embed "c" {{{
#include <stdio.h>
}}}
public static void print() {
embed "c" {{{
printf("Hello worldn");
}}}
embed "java" {{{
System.out.println("Hello world");
}}}
}
embed "c" {{{
int main(int c, char** v) {
hello_Main_print();
return(0);
}
}}}
embed "java" {{{
public static void main(String[] args) {
hello_Main_print();
}
}}}
}
Copyright © 2012 Job and Esther Technologies, Inc.
Thank you

Contenu connexe

Tendances

Sling models by Justin Edelson
Sling models by Justin Edelson Sling models by Justin Edelson
Sling models by Justin Edelson
AEM HUB
 
Runtime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya RathoreRuntime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya Rathore
Esha Yadav
 
Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]
Palak Sanghani
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
Dr. Jan Köhnlein
 

Tendances (17)

ITU - MDD - EMF
ITU - MDD - EMFITU - MDD - EMF
ITU - MDD - EMF
 
Sling models by Justin Edelson
Sling models by Justin Edelson Sling models by Justin Edelson
Sling models by Justin Edelson
 
Apache Sling Generic Validation Framework
Apache Sling Generic Validation FrameworkApache Sling Generic Validation Framework
Apache Sling Generic Validation Framework
 
Introduction to Sightly
Introduction to SightlyIntroduction to Sightly
Introduction to Sightly
 
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkEclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
 
Runtime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya RathoreRuntime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya Rathore
 
Eclipse World 2007: Fundamentals of the Eclipse Modeling Framework
Eclipse World 2007: Fundamentals of the Eclipse Modeling FrameworkEclipse World 2007: Fundamentals of the Eclipse Modeling Framework
Eclipse World 2007: Fundamentals of the Eclipse Modeling Framework
 
Executable UML and SysML Workshop
Executable UML and SysML WorkshopExecutable UML and SysML Workshop
Executable UML and SysML Workshop
 
React advance
React advanceReact advance
React advance
 
Applet and graphics programming
Applet and graphics programmingApplet and graphics programming
Applet and graphics programming
 
When Sightly Meets Slice by Tomasz Niedźwiedź
When Sightly Meets Slice by Tomasz NiedźwiedźWhen Sightly Meets Slice by Tomasz Niedźwiedź
When Sightly Meets Slice by Tomasz Niedźwiedź
 
Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]
 
Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java Programming
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
 
2011 10-24-initiatives-tracker-launch-v1.0
2011 10-24-initiatives-tracker-launch-v1.02011 10-24-initiatives-tracker-launch-v1.0
2011 10-24-initiatives-tracker-launch-v1.0
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
 
Enhancing operator effectiveness with Symbol Factory
Enhancing operator effectiveness with Symbol FactoryEnhancing operator effectiveness with Symbol Factory
Enhancing operator effectiveness with Symbol Factory
 

Similaire à Introduction to Eqela development

Cross-Platform Development using Angulr JS in Visual Studio
Cross-Platform Development using Angulr JS in Visual StudioCross-Platform Development using Angulr JS in Visual Studio
Cross-Platform Development using Angulr JS in Visual Studio
Mizanur Sarker
 

Similaire à Introduction to Eqela development (20)

Optimized Cross Platform Development
Optimized Cross Platform DevelopmentOptimized Cross Platform Development
Optimized Cross Platform Development
 
Code and Conquer with Globe Labs, October 27, 2012
Code and Conquer with Globe Labs, October 27, 2012Code and Conquer with Globe Labs, October 27, 2012
Code and Conquer with Globe Labs, October 27, 2012
 
Codename one
Codename oneCodename one
Codename one
 
Creating Great Apps with MOTODEV Studio for Android
Creating Great Apps with MOTODEV Studio for AndroidCreating Great Apps with MOTODEV Studio for Android
Creating Great Apps with MOTODEV Studio for Android
 
SpringPeople Introduction to iOS Apps Development
SpringPeople Introduction to iOS Apps DevelopmentSpringPeople Introduction to iOS Apps Development
SpringPeople Introduction to iOS Apps Development
 
Ide
IdeIde
Ide
 
Developing a Modern Mobile App Strategy
Developing a Modern Mobile App StrategyDeveloping a Modern Mobile App Strategy
Developing a Modern Mobile App Strategy
 
Cross platform mobile app development tools review
Cross platform mobile app development tools reviewCross platform mobile app development tools review
Cross platform mobile app development tools review
 
Cross-Platform Development using Angulr JS in Visual Studio
Cross-Platform Development using Angulr JS in Visual StudioCross-Platform Development using Angulr JS in Visual Studio
Cross-Platform Development using Angulr JS in Visual Studio
 
Cross Platform Mobile Technologies
Cross Platform Mobile TechnologiesCross Platform Mobile Technologies
Cross Platform Mobile Technologies
 
Ignite Talk: Want to Know How to Control a Cloud-Based App from Your Wrist?
Ignite Talk: Want to Know How to Control a Cloud-Based App from Your Wrist?Ignite Talk: Want to Know How to Control a Cloud-Based App from Your Wrist?
Ignite Talk: Want to Know How to Control a Cloud-Based App from Your Wrist?
 
JQuery Mobile vs Appcelerator Titanium vs Sencha Touch
JQuery Mobile vs Appcelerator Titanium vs Sencha TouchJQuery Mobile vs Appcelerator Titanium vs Sencha Touch
JQuery Mobile vs Appcelerator Titanium vs Sencha Touch
 
Top iOS App Development Tools That You Can Consider.pdf
Top iOS App Development Tools That You Can Consider.pdfTop iOS App Development Tools That You Can Consider.pdf
Top iOS App Development Tools That You Can Consider.pdf
 
iOS application development
iOS application developmentiOS application development
iOS application development
 
How Do I Pick the Best Platform for an iOS App?
How Do I Pick the Best Platform for an iOS App?How Do I Pick the Best Platform for an iOS App?
How Do I Pick the Best Platform for an iOS App?
 
Starting mobile development
Starting mobile developmentStarting mobile development
Starting mobile development
 
Android Web app
Android Web app Android Web app
Android Web app
 
Telerik app builder
Telerik app builderTelerik app builder
Telerik app builder
 
Android Development: Approach for Agile Teams
Android Development: Approach for Agile TeamsAndroid Development: Approach for Agile Teams
Android Development: Approach for Agile Teams
 
EGL Conference 2011 - EGL Overview
EGL Conference 2011 - EGL OverviewEGL Conference 2011 - EGL Overview
EGL Conference 2011 - EGL Overview
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

Introduction to Eqela development

  • 1.
  • 2. Copyright © 2012 Job and Esther Technologies, Inc. (1) INTRODUCTION Industry overview Cross platform development Introduction to Eqela Eqela syntax / language features
  • 3. Copyright © 2012 Job and Esther Technologies, Inc. Our world (.. And all platforms come in various versions)
  • 4. Copyright © 2012 Job and Esther Technologies, Inc. From an application development perspective .. While targeting only the most popular target platforms, a developer will need to work with 10-20 different operating system platforms/versions, at least 3-5 different programming languages, each with different API libraries.
  • 5. Copyright © 2012 Job and Esther Technologies, Inc. Big problem in the industry All software developers need to deal with this one way or the other
  • 6. Copyright © 2012 Job and Esther Technologies, Inc. HOW?
  • 7. Copyright © 2012 Job and Esther Technologies, Inc. Usual solutions (1) Work only on one platform (2) Create the same application several times (once per platform) (3) Do “cross platform development”
  • 8. Copyright © 2012 Job and Esther Technologies, Inc. Traditional ways to do cross platform development (1) The “scripted” approach (Adobe Air / Flex, Appcelerator, Corona, RhoMobile, ..) (2) The “bytecode” approach (MoSync, Mono) (3) The “C++” approach (Marmalade, Qt, WxWidgets, Unity) (4) The “embed a web browser” approach (PhoneGap) (5) HTML5
  • 9. Copyright © 2012 Job and Esther Technologies, Inc. Five different cross platform development approaches
  • 10. Copyright © 2012 Job and Esther Technologies, Inc. #1: The “scripted” approach Source code In a scripting language Development tool Unmodified Source code + Interpreter / Virtual machine For iOS Unmodified Source code + Interpreter / Virtual machine For Android Run in browser Android application iOS application (JavaScript,(JavaScript, Lua, Ruby, ..)Lua, Ruby, ..) (Adobe Air / Flex, Appcelerator, Corona, RhoMobile, ..) Runtime / Virtual machine
  • 11. Copyright © 2012 Job and Esther Technologies, Inc. The “scripted” approach: Architecture Operating system Language interpreter / runtime APIs and libraries Application code
  • 12. Copyright © 2012 Job and Esther Technologies, Inc. The “scripted” approach: Architecture Operating system Language interpreter / runtime APIs and libraries Application code Makes application Installers much bigger Increases memory usage Reduces runtime Performance Due to this approach being very popular, many consider cross platform development to be slow, high in memory use, and producing bigger installers. Applications can only Access selected Parts of the native API
  • 13. Copyright © 2012 Job and Esther Technologies, Inc. #2: The “bytecode” approach Source code Bytecode Compiler Android application Run in browser Class Library (MoSync, Mono) iOS application Windows Phone application Very similar to the “scripted” approach, with the added bytecode compilation step. Bytecode Development Tool Runtime / Virtual machine
  • 14. Copyright © 2012 Job and Esther Technologies, Inc. The “bytecode” approach: Architecture Operating system Bytecode interpreter / runtime APIs and libraries Application code Makes application Installers much bigger Increases memory usage Reduces runtime Performance Due to its similarity with the “interpreted” approach, the benefits and disadvantages are very similar Applications can only Access selected Parts of the native API
  • 15. Copyright © 2012 Job and Esther Technologies, Inc. #3: The “C++” approach Source code In a specific Language SDK / compiler Run in browser Android application iOS application (C++)(C++) Cross Platform Class library In the specific language (C++)(C++) (Marmalade, Qt, WxWidgets, Unity) BlackBerry application Windows Phone application + Truly native (100%) + High performance - Limited platform support (not really cross platform)
  • 16. Copyright © 2012 Job and Esther Technologies, Inc. #4: The “embed a web browser” approach Source Code in HTML, CSS, JavaScript The tool Libraries C source code That opens a Browser and Displays the program Java source code That opens a Browser and Displays the program Android SDK Android application iOS SDK iOS application Run in browser (PhoneGap, AppGyver) - Very poor performance - Suitable for only “web-style” apps - Limited access to platform APIs - Application source code can be easily retrieved + Easy way to convert existing websites to “native apps”
  • 17. Copyright © 2012 Job and Esther Technologies, Inc. #5: HTML5 + Commonly known skillset (HTML, CSS, JavaScript) + Very popular, many Internet resources available - Unfinished standard - Fragmented, non-compatible implementations - Extremely poor performance on mobile - The language is poorly suited for large programs - Applications are inherently “open source”
  • 18. Copyright © 2012 Job and Esther Technologies, Inc. Common issues Large installer size Excessive memory use Low performance Limited API access
  • 19. Copyright © 2012 Job and Esther Technologies, Inc. Cross platform development tool .. .. Based on programming language conversion technology
  • 20. Copyright © 2012 Job and Esther Technologies, Inc. Eqela video http://www.youtube.com/watch?v=WcWf7SXGBv0
  • 21. Copyright © 2012 Job and Esther Technologies, Inc. How it works Source Code (Eqela) Eqela Compiler Libraries C source code Java source code Javascript code Android SDK Android application iOS SDK iOS application Run in browser
  • 22. Copyright © 2012 Job and Esther Technologies, Inc. The technical benefits .. Small installer size Optimal memory use Native performance No API access limitations
  • 23. Copyright © 2012 Job and Esther Technologies, Inc. How it works: A sample application class Main : LayerWidget { public void initialize() { base.initialize(); add(LabelWidget.instance().set_text(“Hello World”)); } } Main.eq Eqela Compiler LayerWidget, LabelWidget Main.java, LayerWidget.java, LabelWidget.java Android SDK Android application
  • 24. Copyright © 2012 Job and Esther Technologies, Inc. 100% native Main.eq Eqela Compiler LayerWidget, LabelWidget Main.java, LayerWidget.java, LabelWidget.java Android SDK Android application Only native code → “100% native” No virtual machine added No interpreter added
  • 25. Copyright © 2012 Job and Esther Technologies, Inc. Main.eq → Main.java class Main : LayerWidget { public void initialize() { base.initialize(); add(LabelWidget.instance().set_text(“Hello World”)); } } package mk.test; public class Main extends eq.gui.LayerWidget { @Override public void initialize() { super.initialize(); ((eq.gui.ContainerWidget)this).add(((eq.gui.Widget)eq.widget.LabelWidge t.eq_widget_LabelWidget_instance().set_text(eq.api.StringStatic.eq_api_ StringStatic_for_strptr("Hello world")))); } public Main() { } } (EQELA) (JAVA)
  • 26. Copyright © 2012 Job and Esther Technologies, Inc. Eqela is many things ..
  • 27. Copyright © 2012 Job and Esther Technologies, Inc. Eqela is .. (1) A modern, object oriented programming language Powerful, object oriented, easy to use, efficient to program Designed to fit the needs of the different target platforms Part of the C syntax family Instantly familiar to anyone with experience in C, C++, Java, C#, JavaScript
  • 28. Copyright © 2012 Job and Esther Technologies, Inc. Eqela is .. (2) An advanced compiler / programming language translator Converts the source programming language (Eqela) to other languages (Java, C#, C, JavaScript, ..) Generates project files / directories be used by the development tools of the various target platforms Pulls in libraries to link with the application
  • 29. Copyright © 2012 Job and Esther Technologies, Inc. Eqela is .. (3) An application framework A cross-platform API that works across programming languages All common functionalities, such as file I/O, networking, threading, data structures, .. Same API on any language and operating system
  • 30. Copyright © 2012 Job and Esther Technologies, Inc. Eqela is .. (4) A cross platform graphical user interface (GUI) API A rich set of user interface components and controls A powerful graphics rendering API for development of custom controls Works the same way across all platforms (mobile, desktop, web)
  • 31. Copyright © 2012 Job and Esther Technologies, Inc. Eqela is .. (5) A development tool / environment
  • 32. Copyright © 2012 Job and Esther Technologies, Inc. Eqela is .. Programming language Compiler Application framework GUI toolkit Development tool / environment
  • 33. Copyright © 2012 Job and Esther Technologies, Inc. How can it be used?
  • 34. Copyright © 2012 Job and Esther Technologies, Inc. ONLINE / WEB DOWNLOAD / INSTALL EQELA LIVE Target Android / HMTL5 Free of charge No installation required EQELA “FULL VERSION” All supported platforms Payment per platform Installed per workstation The different editions
  • 35. Copyright © 2012 Job and Esther Technologies, Inc. Supported platforms Android, BlackBerry 10, BlackBerry 5/6/7, HTML5, Apple iOS, J2ME, Linux, Mac OS X, Symbian, Windows, Windows Phone
  • 36. Copyright © 2012 Job and Esther Technologies, Inc. Source files and modules Eqela source file extension: “.eq” Generally file is named after the class, eg. “Main.eq” for class “Main” (convention only, not enforced) Usually one class per file (also convention) Directory name names the module and acts as the “application id”
  • 37. Copyright © 2012 Job and Esther Technologies, Inc. The Eqela syntax Belongs to the “C” syntax family: C, C++, Objective-C, Java, C#, PHP, ..
  • 38. Copyright © 2012 Job and Esther Technologies, Inc. Eqela syntax / language features
  • 39. Copyright © 2012 Job and Esther Technologies, Inc. Eqela is a fully object oriented, class based programming language
  • 40. Copyright © 2012 Job and Esther Technologies, Inc. Class declarations [modifiers] class [classname] : [basetypes] { [implementation] } public class MySampleClass : SuperClass { public void do_something() { // more code here } } The base class and interfaces may be mixed in the [basetypes] section of the class declaration in any order.
  • 41. Copyright © 2012 Job and Esther Technologies, Inc. Class declarations  Class declarations can include these components: 1.Modifiers: public, private (default) or fundamental.  public – the class will be exported in the module's API  private – the class is only available for use internally within the module  fundamental – the class will not have any base class 2.The class name, by convention in CamelCase 3.The base class (superclass) and a comma-separated list of interfaces implemented by the class may be mixed in the [basetypes] section of the class declaration in any order. 4.The class body surrounded by braces, { }.
  • 42. Copyright © 2012 Job and Esther Technologies, Inc. Automatic base classing class MyClass { // field, constructor, and // method declarations } class MyClass : Object { // field, constructor, and // method declarations } = fundamental class MyClass { // field, constructor, and // method declarations } !=
  • 43. Copyright © 2012 Job and Esther Technologies, Inc. There can be no program without a class (no standalone functions)
  • 44. Copyright © 2012 Job and Esther Technologies, Inc. Comments // This is a valid comment /* This is also a valid comment */ /* This * comment * spans * multiple * lines. */ Comments are described in a way familiar with many languages, using either the "//" notation or the "/*" .. "*/" method.
  • 45. Copyright © 2012 Job and Esther Technologies, Inc. Data types Different kinds of data types: Primitive types Object types (Strings)
  • 46. Copyright © 2012 Job and Esther Technologies, Inc. Primitive types ● Built in to the language as basic building blocks, and cannot be extended by the programmer. Passed by value in method calls. ● strptr, ptr, void, double, bool, int, long, byte strptr var_name = “abc”.to_strptr(); ptr var_name = null; double var_name = 123.45; bool var_name = true; int var_name = 100000; long var_name = 100000; byte var_name = 100; void //refers to no data type at all
  • 47. Copyright © 2012 Job and Esther Technologies, Inc. Object types Objects = Instances of classes Passed by reference in method calls class MyClass { public int method() { return(10); } } var o = new MyClass();
  • 48. Copyright © 2012 Job and Esther Technologies, Inc. Strings String literal = "This is a string literal"; var str = "Another string literal"; if(str is String) { ; // This is true } Eqela API provides a “String” class that offers a string implementation as an object (object type). String literals are automatically assigned as instances of the “String” object, not as “strptr” variables.
  • 49. Copyright © 2012 Job and Esther Technologies, Inc. String operations // assignment var str1 = "String 1"; // concatenation var str2 = str1.append(" + More stuff"); // console output Log.message(str2); // prints out "String 1 + More stuff" // comparison if(str1.equals(str2)) { ; // not true } // comparison with a literal if("String 1".equals(str1)) { ; // true }
  • 50. Copyright © 2012 Job and Esther Technologies, Inc. Constructing strings var sb = StringBuffer.create(). sb.append("First"); sb.append_c(' '); sb.append("Second"); Log.message(sb.to_string()); // prints "First Second" Normal String objects are immutable StringBuffer class is provided as part of the API to efficiently construct strings
  • 51. Copyright © 2012 Job and Esther Technologies, Inc. Class constructor What is a “constructor”?
  • 52. Copyright © 2012 Job and Esther Technologies, Inc.  A method with the same name as the class name  Has no return type  A class can only have one constructor function, and the constructor is not allowed to have any parameters. public MyClass { public MyClass() { ; // implementation } } Class constructor
  • 53. Copyright © 2012 Job and Esther Technologies, Inc. Supplying object parameters upon creation public MyClass { private int variable = 0; public MyClass() { } public static MyClass create(int value) { var v = new MyClass(); v.variable = value; return(v); } } var o = MyClass.create(10); (1) By using static creation methods
  • 54. Copyright © 2012 Job and Esther Technologies, Inc. public MyClass { property int variable = 0; public MyClass() { } } var o = new MyClass().set_variable(10); Supplying object parameters upon creation (2) By using properties
  • 55. Copyright © 2012 Job and Esther Technologies, Inc. Class destructor What is a “destructor”?
  • 56. Copyright © 2012 Job and Esther Technologies, Inc. public MyClass { ~Myclass() { ; // actions here } } As is usual in all modern languages with automatic memory management, it is highly discouraged to use destructors in Eqela applications. Generally the only well-known acceptable use for a destructor is to deallocate resources allocated manually. Class destructor
  • 57. Copyright © 2012 Job and Esther Technologies, Inc. Member variables [modifiers] [type] [variablename] = [initializer]; class MyClass { int number = 10; public static MyClass second; private MyClass third = null; } Modifiers : "private", "public", "static" Initializer is optional
  • 58. Copyright © 2012 Job and Esther Technologies, Inc. Declaring methods public int SomeMethod(int int_value, bool bool_value) { // method body return(10); } modifiers return type method name parameter list If the return type is NOT void, the method must end in a “return” line
  • 59. Copyright © 2012 Job and Esther Technologies, Inc. Virtual methods and overriding class BaseClass { public virtual void hello() { Log.message("hello 1"); } } class DerivedClass : BaseClass { public override void hello() { Log.message("Hello enhanced!"); } } If a method is declared with modifier "virtual", it becomes a virtual function. To override a method in a subclass, it should be declared using the "override" modifier
  • 60. Copyright © 2012 Job and Esther Technologies, Inc. Method hiding Eqela does NOT allow method hiding If a method is declared in a base class, and it is not virtual, no method of the same name may be declared in any of the subclasses, even if the parameters would differ.
  • 61. Copyright © 2012 Job and Esther Technologies, Inc. Static methods class MyClass { public static void hello() { Log.message("MyClass hello"); } } class SecondClass { public void method() { var mc = new MyClass(); mc.hello(); // not right MyClass.hello(); // the correct way } } Called by the name of the class they are associated with, not through an object instance
  • 62. Copyright © 2012 Job and Esther Technologies, Inc. Abstract methods What is an “abstract method”?
  • 63. Copyright © 2012 Job and Esther Technologies, Inc.  Methods that have a method signature but no implementation  Declared using the modifier "abstract“  If no "abstract" modifier is present, but method body is missing, the "abstract" keyword is automatically assumed  No "override" keyword is required to override abstract methods interface MyInterface { public void first_method(); public abstract void second_method(); } Abstract methods
  • 64. Copyright © 2012 Job and Esther Technologies, Inc. What is an interface?
  • 65. Copyright © 2012 Job and Esther Technologies, Inc. Interface interface MyInterface { public void method1(); public int method2(); } A group of related methods with empty bodies Defines a standard and public way of specifying the behavior of the class (defines a contract) Declared using the interface keyword
  • 66. Copyright © 2012 Job and Esther Technologies, Inc. Interfaces  To use an interface, you must implement that interface in a class  Implementing an interface  Implement multiple interfaces class MyClass : MyInterface { // class body } class MyClass : MyInterface, MyOtherInterface { // class body }
  • 67. Copyright © 2012 Job and Esther Technologies, Inc. Prerequisites In Eqela, an interface may not "inherit" another interface, but it may instead have "prerequisites", through which roughly the same functionality is achieved
  • 68. Copyright © 2012 Job and Esther Technologies, Inc. Multiple inheritance Multiple inheritance is not allowed – but implementing multiple interfaces IS allowed
  • 69. Copyright © 2012 Job and Esther Technologies, Inc. Legal interface usage interface First { public void method1(); } interface Second : First { public void method2(); } class MyClass : Second, First { public void method1() { } public void method2() { } }
  • 70. Copyright © 2012 Job and Esther Technologies, Inc. Illegal interface usage interface First { public void method1(); } interface Second : First { public void method2(); } class MyClass : Second { public void method1() { } public void method2() { } }
  • 71. Copyright © 2012 Job and Esther Technologies, Inc. Other language features ..
  • 72. Copyright © 2012 Job and Esther Technologies, Inc. Operators and expressions Group Operator Unary -, !, ++, -- Logical binary ||, && Comparative binary ==, !=, <, <=, >, >=, is Operative binary +, -, *, /, % int a = 10 + 5; int b = a / 10; If(a == 15 || b == 7) { } if(a == 15 && b == 7) { } if(a != b) { }
  • 73. Copyright © 2012 Job and Esther Technologies, Inc. Type casting What is the meaning of “type casting”?
  • 74. Copyright © 2012 Job and Esther Technologies, Inc. Type casting Static type casting One data type can be cast into another in a fairly liberal manner by using the "(typename)" notation. (Fast but may lead to runtime errors) Dynamic type casting Uses the “as” operator to cast one data type to another. (Slightly slower than static type casting, due to extra checking involved, but a much safer way) double n = 100.43; int ni = (int)n; var x = new MyClass(); var y = (MyOtherClass)x; var x = new MyClass(); var y = x as MyOtherClass; // will be null if not a subclass of MyOtherClass
  • 75. Copyright © 2012 Job and Esther Technologies, Inc. Control structures If .. Else While Do .. While For Foreach Switch
  • 76. Copyright © 2012 Job and Esther Technologies, Inc. If .. Else if(condition) { ; // execute if condition is true } else { ; // execute if condition is false }
  • 77. Copyright © 2012 Job and Esther Technologies, Inc. While while(condition) { ; // execute while condition is true } while(condition) { if(want_to_stop) { break; } continue; ; // will not reach here } While blocks can be interrupted with the "break" statement or restarted with the "continue" statement
  • 78. Copyright © 2012 Job and Esther Technologies, Inc. Do .. While do { ; // execute here } while(condition);
  • 79. Copyright © 2012 Job and Esther Technologies, Inc. For for(initializer; condition; execute_after) { ; // actions here }
  • 80. Copyright © 2012 Job and Esther Technologies, Inc. Foreach foreach(var variablename in collection) { ; // actions here } foreach(String variablename in collection) { ; // actions here } The data type of the loop variable may be dynamically assigned as above ("var"), or it can be explicitly set by the user.
  • 81. Copyright © 2012 Job and Esther Technologies, Inc. Switch switch(expression) { case value1: { ; // statements } case value2: { ; // statements } default: { ; // statements } } •All "case" blocks must be enclosed in curly braces "{" and "}". •Only one "case" statement is allowed per block. •No break statements are required to terminate the case blocks.
  • 82. Copyright © 2012 Job and Esther Technologies, Inc. Properties class MyClass { property int myproperty; } class MyClass { int myproperty; public MyClass set_myproperty(int v) { myproperty = v; return(this); } public int get_myproperty() { return(myproperty); } }
  • 83. Copyright © 2012 Job and Esther Technologies, Inc. class MyClass { property int myproperty; } class AnotherClass { public void method() { MyClass cl = new MyClass().set_myproperty(10); } } Using properties
  • 84. Copyright © 2012 Job and Esther Technologies, Inc. Default parameters public void my_method(int n = 0) { // (method implementation code here) } obj.my_method(10); obj.my_method(); Automatically supply parameter values where no parameters are given
  • 85. Copyright © 2012 Job and Esther Technologies, Inc. Embedding other languages
  • 86. Copyright © 2012 Job and Esther Technologies, Inc. Embedding code The dictionary definition of “embed” is to make something an integral part of In Eqela programming language, “embedding” refers to adding other programming languages into blocks within the Eqela code
  • 87. Copyright © 2012 Job and Esther Technologies, Inc. Embed: Syntax embed “(language name)” {{{ // code in other language }}} Languages: c, c++, objc, java, js, cs, .. int n; embed “c” {{{ char* str = “Hello World”; n = strlen(str); }}} Log.message(“Length = %d”.printf().add(n));
  • 88. Copyright © 2012 Job and Esther Technologies, Inc. Embed: Example class Main { embed "c" {{{ #include <stdio.h> }}} public static void print() { embed "c" {{{ printf("Hello worldn"); }}} embed "java" {{{ System.out.println("Hello world"); }}} } embed "c" {{{ int main(int c, char** v) { hello_Main_print(); return(0); } }}} embed "java" {{{ public static void main(String[] args) { hello_Main_print(); } }}} }
  • 89. Copyright © 2012 Job and Esther Technologies, Inc. Thank you