Copyright © 2012 Job and Esther Technologies, Inc.(1) INTRODUCTIONIndustry overviewCross platform developmentIntroduction ...
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 m...
Copyright © 2012 Job and Esther Technologies, Inc.Big problem in the industryAll software developers need todeal with this...
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 applicat...
Copyright © 2012 Job and Esther Technologies, Inc.Traditional ways to do cross platform development(1) The “scripted” appr...
Copyright © 2012 Job and Esther Technologies, Inc.Five different crossplatform developmentapproaches
Copyright © 2012 Job and Esther Technologies, Inc.#1: The “scripted” approachSource codeIn a scriptinglanguageDevelopmentt...
Copyright © 2012 Job and Esther Technologies, Inc.The “scripted” approach: ArchitectureOperating systemLanguage interprete...
Copyright © 2012 Job and Esther Technologies, Inc.The “scripted” approach: ArchitectureOperating systemLanguage interprete...
Copyright © 2012 Job and Esther Technologies, Inc.#2: The “bytecode” approachSourcecodeBytecodeCompilerAndroidapplicationR...
Copyright © 2012 Job and Esther Technologies, Inc.The “bytecode” approach: ArchitectureOperating systemBytecode interprete...
Copyright © 2012 Job and Esther Technologies, Inc.#3: The “C++” approachSource codeIn a specificLanguageSDK /compilerRun i...
Copyright © 2012 Job and Esther Technologies, Inc.#4: The “embed a web browser” approachSourceCode inHTML, CSS,JavaScriptT...
Copyright © 2012 Job and Esther Technologies, Inc.#5: HTML5+ Commonly known skillset (HTML, CSS, JavaScript)+ Very popular...
Copyright © 2012 Job and Esther Technologies, Inc.Common issuesLarge installer sizeExcessive memory useLow performanceLimi...
Copyright © 2012 Job and Esther Technologies, Inc.Cross platform development tool .... Based on programming language conve...
Copyright © 2012 Job and Esther Technologies, Inc.Eqela videohttp://www.youtube.com/watch?v=WcWf7SXGBv0
Copyright © 2012 Job and Esther Technologies, Inc.How it worksSourceCode(Eqela)EqelaCompilerLibraries CsourcecodeJavasourc...
Copyright © 2012 Job and Esther Technologies, Inc.The technical benefits ..Small installer sizeOptimal memory useNative pe...
Copyright © 2012 Job and Esther Technologies, Inc.How it works: A sample applicationclass Main : LayerWidget{public void i...
Copyright © 2012 Job and Esther Technologies, Inc.100% nativeMain.eqEqelaCompilerLayerWidget,LabelWidgetMain.java,LayerWid...
Copyright © 2012 Job and Esther Technologies, Inc.Main.eq → Main.javaclass Main : LayerWidget{public void initialize() {ba...
Copyright © 2012 Job and Esther Technologies, Inc.Eqela is many things ..
Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..(1) A modern, object orientedprogramming languagePowerful, ob...
Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..(2) An advanced compiler /programming language translatorConv...
Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..(3) An application frameworkA cross-platform API that worksac...
Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..(4) A cross platform graphicaluser interface (GUI) APIA rich ...
Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..(5) A development tool / environment
Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..Programming languageCompilerApplication frameworkGUI toolkitD...
Copyright © 2012 Job and Esther Technologies, Inc.How can it be used?
Copyright © 2012 Job and Esther Technologies, Inc.ONLINE / WEB DOWNLOAD / INSTALLEQELA LIVETarget Android / HMTL5Free of c...
Copyright © 2012 Job and Esther Technologies, Inc.Supported platformsAndroid, BlackBerry 10, BlackBerry 5/6/7, HTML5,Apple...
Copyright © 2012 Job and Esther Technologies, Inc.Source files and modulesEqela source file extension: “.eq”Generally file...
Copyright © 2012 Job and Esther Technologies, Inc.The Eqela syntaxBelongs to the “C” syntax family:C, C++, Objective-C, Ja...
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 programminglanguage
Copyright © 2012 Job and Esther Technologies, Inc.Class declarations[modifiers] class [classname] : [basetypes]{[implement...
Copyright © 2012 Job and Esther Technologies, Inc.Class declarationsClass declarations can include these components:1.Mod...
Copyright © 2012 Job and Esther Technologies, Inc.Automatic base classingclass MyClass{// field, constructor, and// method...
Copyright © 2012 Job and Esther Technologies, Inc.There can be no programwithout a class(no standalone functions)
Copyright © 2012 Job and Esther Technologies, Inc.Comments// This is a valid comment/* This is also a valid comment *//* T...
Copyright © 2012 Job and Esther Technologies, Inc.Data typesDifferent kinds of data types:Primitive typesObject types(Stri...
Copyright © 2012 Job and Esther Technologies, Inc.Primitive types● Built in to the language as basic building blocks, andc...
Copyright © 2012 Job and Esther Technologies, Inc.Object typesObjects = Instances of classesPassed by reference in method ...
Copyright © 2012 Job and Esther Technologies, Inc.StringsString literal = "This is a string literal";var str = "Another st...
Copyright © 2012 Job and Esther Technologies, Inc.String operations// assignmentvar str1 = "String 1";// concatenationvar ...
Copyright © 2012 Job and Esther Technologies, Inc.Constructing stringsvar sb = StringBuffer.create().sb.append("First");sb...
Copyright © 2012 Job and Esther Technologies, Inc.Class constructorWhat 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 clas...
Copyright © 2012 Job and Esther Technologies, Inc.Supplying object parameters upon creationpublic MyClass{private int vari...
Copyright © 2012 Job and Esther Technologies, Inc.public MyClass{property int variable = 0;public MyClass() {}}var o = new...
Copyright © 2012 Job and Esther Technologies, Inc.Class destructorWhat is a “destructor”?
Copyright © 2012 Job and Esther Technologies, Inc.public MyClass{~Myclass() {; // actions here}}As is usual in all modern ...
Copyright © 2012 Job and Esther Technologies, Inc.Member variables[modifiers] [type] [variablename] = [initializer];class ...
Copyright © 2012 Job and Esther Technologies, Inc.Declaring methodspublic int SomeMethod(int int_value, bool bool_value) {...
Copyright © 2012 Job and Esther Technologies, Inc.Virtual methods and overridingclass BaseClass{public virtual void hello(...
Copyright © 2012 Job and Esther Technologies, Inc.Method hidingEqela does NOT allow method hidingIf a method is declared i...
Copyright © 2012 Job and Esther Technologies, Inc.Static methodsclass MyClass{public static void hello() {Log.message("MyC...
Copyright © 2012 Job and Esther Technologies, Inc.Abstract methodsWhat is an “abstract method”?
Copyright © 2012 Job and Esther Technologies, Inc. Methods that have a method signature but noimplementation Declared us...
Copyright © 2012 Job and Esther Technologies, Inc.What is an interface?
Copyright © 2012 Job and Esther Technologies, Inc.Interfaceinterface MyInterface{public void method1();public int method2(...
Copyright © 2012 Job and Esther Technologies, Inc.InterfacesTo use an interface, you must implement that interface ina cl...
Copyright © 2012 Job and Esther Technologies, Inc.PrerequisitesIn Eqela, an interface may not "inherit" anotherinterface, ...
Copyright © 2012 Job and Esther Technologies, Inc.Multiple inheritanceMultiple inheritance is not allowed – butimplementin...
Copyright © 2012 Job and Esther Technologies, Inc.Legal interface usageinterface First{public void method1();}interface Se...
Copyright © 2012 Job and Esther Technologies, Inc.Illegal interface usageinterface First{public void method1();}interface ...
Copyright © 2012 Job and Esther Technologies, Inc.Other language features ..
Copyright © 2012 Job and Esther Technologies, Inc.Operators and expressionsGroup OperatorUnary -, !, ++, --Logical binary ...
Copyright © 2012 Job and Esther Technologies, Inc.Type castingWhat is the meaning of “type casting”?
Copyright © 2012 Job and Esther Technologies, Inc.Type castingStatic type castingOne data type can be cast into another in...
Copyright © 2012 Job and Esther Technologies, Inc.Control structuresIf .. ElseWhileDo .. WhileForForeachSwitch
Copyright © 2012 Job and Esther Technologies, Inc.If .. Elseif(condition) {; // execute if condition is true}else {; // ex...
Copyright © 2012 Job and Esther Technologies, Inc.Whilewhile(condition) {; // execute while condition is true}while(condit...
Copyright © 2012 Job and Esther Technologies, Inc.Do .. Whiledo{; // execute here}while(condition);
Copyright © 2012 Job and Esther Technologies, Inc.Forfor(initializer; condition; execute_after) {; // actions here}
Copyright © 2012 Job and Esther Technologies, Inc.Foreachforeach(var variablename in collection) {; // actions here}foreac...
Copyright © 2012 Job and Esther Technologies, Inc.Switchswitch(expression) {case value1: {; // statements}case value2: {; ...
Copyright © 2012 Job and Esther Technologies, Inc.Propertiesclass MyClass{property int myproperty;}class MyClass{int mypro...
Copyright © 2012 Job and Esther Technologies, Inc.class MyClass{property int myproperty;}class AnotherClass{public void me...
Copyright © 2012 Job and Esther Technologies, Inc.Default parameterspublic void my_method(int n = 0) {// (method implement...
Copyright © 2012 Job and Esther Technologies, Inc.Embedding other languages
Copyright © 2012 Job and Esther Technologies, Inc.Embedding codeThe dictionary definition of “embed” is to makesomething a...
Copyright © 2012 Job and Esther Technologies, Inc.Embed: Syntaxembed “(language name)” {{{// code in other language}}}Lang...
Copyright © 2012 Job and Esther Technologies, Inc.Embed: Exampleclass Main{embed "c" {{{#include <stdio.h>}}}public static...
Copyright © 2012 Job and Esther Technologies, Inc.Thank you
Introduction to Eqela development
Upcoming SlideShare
Loading in …5
×

Introduction to Eqela development

6,845 views

Published on

Published in: Technology, Education
  • Be the first to comment

Introduction to Eqela development

  1. 1. Copyright © 2012 Job and Esther Technologies, Inc.(1) INTRODUCTIONIndustry overviewCross platform developmentIntroduction to EqelaEqela syntax / language features
  2. 2. Copyright © 2012 Job and Esther Technologies, Inc.Our world(.. And all platforms come in various versions)
  3. 3. Copyright © 2012 Job and Esther Technologies, Inc.From an application development perspective ..While targeting only the most populartarget platforms, a developer will need towork with 10-20 different operating systemplatforms/versions, at least 3-5 differentprogramming languages, each withdifferent API libraries.
  4. 4. Copyright © 2012 Job and Esther Technologies, Inc.Big problem in the industryAll software developers need todeal with this one way or theother
  5. 5. Copyright © 2012 Job and Esther Technologies, Inc.HOW?
  6. 6. Copyright © 2012 Job and Esther Technologies, Inc.Usual solutions(1) Work only on one platform(2) Create the same application severaltimes (once per platform)(3) Do “cross platform development”
  7. 7. 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
  8. 8. Copyright © 2012 Job and Esther Technologies, Inc.Five different crossplatform developmentapproaches
  9. 9. Copyright © 2012 Job and Esther Technologies, Inc.#1: The “scripted” approachSource codeIn a scriptinglanguageDevelopmenttoolUnmodifiedSource code+Interpreter /Virtual machineFor iOSUnmodifiedSource code+Interpreter /Virtual machineFor AndroidRun inbrowserAndroidapplicationiOSapplication(JavaScript,(JavaScript,Lua, Ruby, ..)Lua, Ruby, ..)(Adobe Air / Flex, Appcelerator, Corona, RhoMobile, ..)Runtime /Virtualmachine
  10. 10. Copyright © 2012 Job and Esther Technologies, Inc.The “scripted” approach: ArchitectureOperating systemLanguage interpreter / runtimeAPIs and libraries Application code
  11. 11. Copyright © 2012 Job and Esther Technologies, Inc.The “scripted” approach: ArchitectureOperating systemLanguage interpreter / runtimeAPIs and libraries Application code Makes applicationInstallers much biggerIncreases memoryusageReduces runtimePerformanceDue to this approach being very popular, many considercross platform development to be slow, high in memory use,and producing bigger installers.Applications can onlyAccess selectedParts of the native API
  12. 12. Copyright © 2012 Job and Esther Technologies, Inc.#2: The “bytecode” approachSourcecodeBytecodeCompilerAndroidapplicationRun inbrowserClassLibrary(MoSync, Mono)iOSapplicationWindowsPhoneapplicationVery similar to the “scripted” approach,with the added bytecode compilation step.BytecodeDevelopmentToolRuntime /Virtualmachine
  13. 13. Copyright © 2012 Job and Esther Technologies, Inc.The “bytecode” approach: ArchitectureOperating systemBytecode interpreter / runtimeAPIs and libraries Application code Makes applicationInstallers much biggerIncreases memoryusageReduces runtimePerformanceDue to its similarity with the “interpreted” approach, thebenefits and disadvantages are very similarApplications can onlyAccess selectedParts of the native API
  14. 14. Copyright © 2012 Job and Esther Technologies, Inc.#3: The “C++” approachSource codeIn a specificLanguageSDK /compilerRun inbrowserAndroidapplicationiOSapplication(C++)(C++)CrossPlatformClass libraryIn the specificlanguage(C++)(C++)(Marmalade, Qt, WxWidgets, Unity)BlackBerryapplicationWindowsPhoneapplication+ Truly native (100%)+ High performance- Limited platform support(not really cross platform)
  15. 15. Copyright © 2012 Job and Esther Technologies, Inc.#4: The “embed a web browser” approachSourceCode inHTML, CSS,JavaScriptThetoolLibraries C source codeThat opens aBrowser andDisplays theprogramJava source codeThat opens aBrowser andDisplays theprogramAndroidSDKAndroidapplicationiOSSDKiOSapplicationRun inbrowser(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”
  16. 16. 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”
  17. 17. Copyright © 2012 Job and Esther Technologies, Inc.Common issuesLarge installer sizeExcessive memory useLow performanceLimited API access
  18. 18. Copyright © 2012 Job and Esther Technologies, Inc.Cross platform development tool .... Based on programming language conversiontechnology
  19. 19. Copyright © 2012 Job and Esther Technologies, Inc.Eqela videohttp://www.youtube.com/watch?v=WcWf7SXGBv0
  20. 20. Copyright © 2012 Job and Esther Technologies, Inc.How it worksSourceCode(Eqela)EqelaCompilerLibraries CsourcecodeJavasourcecodeJavascriptcodeAndroidSDKAndroidapplicationiOSSDKiOSapplicationRun inbrowser
  21. 21. Copyright © 2012 Job and Esther Technologies, Inc.The technical benefits ..Small installer sizeOptimal memory useNative performanceNo API access limitations
  22. 22. Copyright © 2012 Job and Esther Technologies, Inc.How it works: A sample applicationclass Main : LayerWidget{public void initialize() {base.initialize();add(LabelWidget.instance().set_text(“Hello World”));}}Main.eqEqelaCompilerLayerWidget,LabelWidgetMain.java,LayerWidget.java,LabelWidget.javaAndroidSDKAndroidapplication
  23. 23. Copyright © 2012 Job and Esther Technologies, Inc.100% nativeMain.eqEqelaCompilerLayerWidget,LabelWidgetMain.java,LayerWidget.java,LabelWidget.javaAndroidSDKAndroidapplicationOnly native code → “100% native”No virtual machine addedNo interpreter added
  24. 24. Copyright © 2012 Job and Esther Technologies, Inc.Main.eq → Main.javaclass Main : LayerWidget{public void initialize() {base.initialize();add(LabelWidget.instance().set_text(“Hello World”));}}package mk.test;public class Main extends eq.gui.LayerWidget{@Overridepublic void initialize() {super.initialize();((eq.gui.ContainerWidget)this).add(((eq.gui.Widget)eq.widget.LabelWidget.eq_widget_LabelWidget_instance().set_text(eq.api.StringStatic.eq_api_StringStatic_for_strptr("Hello world"))));}public Main() {}}(EQELA)(JAVA)
  25. 25. Copyright © 2012 Job and Esther Technologies, Inc.Eqela is many things ..
  26. 26. Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..(1) A modern, object orientedprogramming languagePowerful, object oriented, easy touse, efficient to programDesigned to fit the needs of thedifferent target platformsPart of the C syntax familyInstantly familiar to anyone withexperience in C, C++, Java, C#,JavaScript
  27. 27. Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..(2) An advanced compiler /programming language translatorConverts the source programminglanguage (Eqela) to other languages(Java, C#, C, JavaScript, ..)Generates project files / directoriesbe used by the development tools ofthe various target platformsPulls in libraries to link with theapplication
  28. 28. Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..(3) An application frameworkA cross-platform API that worksacross programming languagesAll common functionalities, such asfile I/O, networking, threading, datastructures, ..Same API on any language andoperating system
  29. 29. Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..(4) A cross platform graphicaluser interface (GUI) APIA rich set of user interfacecomponents and controlsA powerful graphics rendering API fordevelopment of custom controlsWorks the same way across allplatforms (mobile, desktop, web)
  30. 30. Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..(5) A development tool / environment
  31. 31. Copyright © 2012 Job and Esther Technologies, Inc.Eqela is ..Programming languageCompilerApplication frameworkGUI toolkitDevelopment tool / environment
  32. 32. Copyright © 2012 Job and Esther Technologies, Inc.How can it be used?
  33. 33. Copyright © 2012 Job and Esther Technologies, Inc.ONLINE / WEB DOWNLOAD / INSTALLEQELA LIVETarget Android / HMTL5Free of chargeNo installation requiredEQELA “FULL VERSION”All supported platformsPayment per platformInstalled per workstationThe different editions
  34. 34. Copyright © 2012 Job and Esther Technologies, Inc.Supported platformsAndroid, BlackBerry 10, BlackBerry 5/6/7, HTML5,Apple iOS, J2ME, Linux, Mac OS X, Symbian,Windows, Windows Phone
  35. 35. Copyright © 2012 Job and Esther Technologies, Inc.Source files and modulesEqela 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”
  36. 36. Copyright © 2012 Job and Esther Technologies, Inc.The Eqela syntaxBelongs to the “C” syntax family:C, C++, Objective-C, Java, C#, PHP, ..
  37. 37. Copyright © 2012 Job and Esther Technologies, Inc.Eqela syntax / language features
  38. 38. Copyright © 2012 Job and Esther Technologies, Inc.Eqela is a fully object oriented,class based programminglanguage
  39. 39. 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.
  40. 40. 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 modules APIprivate – the class is only available for use internallywithin the modulefundamental – the class will not have any base class2.The class name, by convention in CamelCase3.The base class (superclass) and a comma-separated list ofinterfaces 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, { }.
  41. 41. Copyright © 2012 Job and Esther Technologies, Inc.Automatic base classingclass MyClass{// field, constructor, and// method declarations}class MyClass : Object{// field, constructor, and// method declarations}=fundamental class MyClass{// field, constructor, and// method declarations}!=
  42. 42. Copyright © 2012 Job and Esther Technologies, Inc.There can be no programwithout a class(no standalone functions)
  43. 43. 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 withmany languages, using either the "//" notation orthe "/*" .. "*/" method.
  44. 44. Copyright © 2012 Job and Esther Technologies, Inc.Data typesDifferent kinds of data types:Primitive typesObject types(Strings)
  45. 45. Copyright © 2012 Job and Esther Technologies, Inc.Primitive types● Built in to the language as basic building blocks, andcannot be extended by the programmer. Passed byvalue in method calls.● strptr, ptr, void, double, bool, int, long, bytestrptr 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
  46. 46. Copyright © 2012 Job and Esther Technologies, Inc.Object typesObjects = Instances of classesPassed by reference in method callsclass MyClass{public int method() {return(10);}}var o = new MyClass();
  47. 47. Copyright © 2012 Job and Esther Technologies, Inc.StringsString 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 astring implementation as an object (object type).String literals are automatically assigned asinstances of the “String” object, not as “strptr”variables.
  48. 48. Copyright © 2012 Job and Esther Technologies, Inc.String operations// assignmentvar str1 = "String 1";// concatenationvar str2 = str1.append(" + More stuff");// console outputLog.message(str2); // prints out "String 1 + More stuff"// comparisonif(str1.equals(str2)) {; // not true}// comparison with a literalif("String 1".equals(str1)) {; // true}
  49. 49. Copyright © 2012 Job and Esther Technologies, Inc.Constructing stringsvar sb = StringBuffer.create().sb.append("First");sb.append_c( );sb.append("Second");Log.message(sb.to_string()); // prints "First Second"Normal String objects are immutableStringBuffer class is provided as part of the APIto efficiently construct strings
  50. 50. Copyright © 2012 Job and Esther Technologies, Inc.Class constructorWhat is a “constructor”?
  51. 51. 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 theconstructor is not allowed to have any parameters.public MyClass{public MyClass() {; // implementation}}Class constructor
  52. 52. Copyright © 2012 Job and Esther Technologies, Inc.Supplying object parameters upon creationpublic 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
  53. 53. 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
  54. 54. Copyright © 2012 Job and Esther Technologies, Inc.Class destructorWhat is a “destructor”?
  55. 55. Copyright © 2012 Job and Esther Technologies, Inc.public MyClass{~Myclass() {; // actions here}}As is usual in all modern languages withautomatic memory management, it is highlydiscouraged to use destructors in Eqelaapplications. Generally the only well-knownacceptable use for a destructor is to deallocateresources allocated manually.Class destructor
  56. 56. 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
  57. 57. Copyright © 2012 Job and Esther Technologies, Inc.Declaring methodspublic int SomeMethod(int int_value, bool bool_value) {// method bodyreturn(10);}modifiers returntypemethodnameparameterlistIf the return type is NOT void, the method mustend in a “return” line
  58. 58. Copyright © 2012 Job and Esther Technologies, Inc.Virtual methods and overridingclass 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 becomesa virtual function.To override a method in a subclass, it should be declaredusing the "override" modifier
  59. 59. Copyright © 2012 Job and Esther Technologies, Inc.Method hidingEqela does NOT allow method hidingIf a method is declared in a base class, and it is not virtual, nomethod of the same name may be declared in any of thesubclasses, even if the parameters would differ.
  60. 60. Copyright © 2012 Job and Esther Technologies, Inc.Static methodsclass MyClass{public static void hello() {Log.message("MyClass hello");}}class SecondClass{public void method() {var mc = new MyClass();mc.hello(); // not rightMyClass.hello(); // the correct way}}Called by the name of the class they areassociated with, not through an object instance
  61. 61. Copyright © 2012 Job and Esther Technologies, Inc.Abstract methodsWhat is an “abstract method”?
  62. 62. Copyright © 2012 Job and Esther Technologies, Inc. Methods that have a method signature but noimplementation 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 methodsinterface MyInterface{public void first_method();public abstract void second_method();}Abstract methods
  63. 63. Copyright © 2012 Job and Esther Technologies, Inc.What is an interface?
  64. 64. Copyright © 2012 Job and Esther Technologies, Inc.Interfaceinterface MyInterface{public void method1();public int method2();}A group of related methods with empty bodiesDefines a standard and public way of specifyingthe behavior of the class (defines a contract)Declared using the interface keyword
  65. 65. Copyright © 2012 Job and Esther Technologies, Inc.InterfacesTo use an interface, you must implement that interface ina classImplementing an interfaceImplement multiple interfacesclass MyClass : MyInterface{// class body}class MyClass : MyInterface, MyOtherInterface{// class body}
  66. 66. Copyright © 2012 Job and Esther Technologies, Inc.PrerequisitesIn Eqela, an interface may not "inherit" anotherinterface, but it may instead have "prerequisites",through which roughly the same functionality isachieved
  67. 67. Copyright © 2012 Job and Esther Technologies, Inc.Multiple inheritanceMultiple inheritance is not allowed – butimplementing multiple interfaces IS allowed
  68. 68. Copyright © 2012 Job and Esther Technologies, Inc.Legal interface usageinterface First{public void method1();}interface Second : First{public void method2();}class MyClass : Second, First{public void method1() {}public void method2() {}}
  69. 69. Copyright © 2012 Job and Esther Technologies, Inc.Illegal interface usageinterface First{public void method1();}interface Second : First{public void method2();}class MyClass : Second{public void method1() {}public void method2() {}}
  70. 70. Copyright © 2012 Job and Esther Technologies, Inc.Other language features ..
  71. 71. Copyright © 2012 Job and Esther Technologies, Inc.Operators and expressionsGroup OperatorUnary -, !, ++, --Logical binary ||, &&Comparative binary ==, !=, <, <=, >, >=, isOperative binary +, -, *, /, %int a = 10 + 5;int b = a / 10;If(a == 15 || b == 7) {}if(a == 15 && b == 7) {}if(a != b) {}
  72. 72. Copyright © 2012 Job and Esther Technologies, Inc.Type castingWhat is the meaning of “type casting”?
  73. 73. Copyright © 2012 Job and Esther Technologies, Inc.Type castingStatic type castingOne data type can be cast into another in a fairly liberalmanner by using the "(typename)" notation.(Fast but may lead to runtime errors)Dynamic type castingUses the “as” operator to cast one data type to another.(Slightly slower than static type casting, due to extra checking involved, but a much saferway)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
  74. 74. Copyright © 2012 Job and Esther Technologies, Inc.Control structuresIf .. ElseWhileDo .. WhileForForeachSwitch
  75. 75. Copyright © 2012 Job and Esther Technologies, Inc.If .. Elseif(condition) {; // execute if condition is true}else {; // execute if condition is false}
  76. 76. Copyright © 2012 Job and Esther Technologies, Inc.Whilewhile(condition) {; // execute while condition is true}while(condition) {if(want_to_stop) {break;}continue;; // will not reach here}While blocks can be interruptedwith the "break" statement orrestarted with the "continue"statement
  77. 77. Copyright © 2012 Job and Esther Technologies, Inc.Do .. Whiledo{; // execute here}while(condition);
  78. 78. Copyright © 2012 Job and Esther Technologies, Inc.Forfor(initializer; condition; execute_after) {; // actions here}
  79. 79. Copyright © 2012 Job and Esther Technologies, Inc.Foreachforeach(var variablename in collection) {; // actions here}foreach(String variablename in collection) {; // actions here}The data type of the loopvariable may be dynamicallyassigned as above ("var"), orit can be explicitly set by theuser.
  80. 80. Copyright © 2012 Job and Esther Technologies, Inc.Switchswitch(expression) {case value1: {; // statements}case value2: {; // statements}default: {; // statements}}•All "case" blocks must beenclosed in curly braces "{"and "}".•Only one "case" statement isallowed per block.•No break statements arerequired to terminate the caseblocks.
  81. 81. Copyright © 2012 Job and Esther Technologies, Inc.Propertiesclass MyClass{property int myproperty;}class MyClass{int myproperty;public MyClass set_myproperty(int v) {myproperty = v;return(this);}public int get_myproperty() {return(myproperty);}}
  82. 82. 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
  83. 83. Copyright © 2012 Job and Esther Technologies, Inc.Default parameterspublic void my_method(int n = 0) {// (method implementation code here)}obj.my_method(10);obj.my_method();Automatically supply parameter values whereno parameters are given
  84. 84. Copyright © 2012 Job and Esther Technologies, Inc.Embedding other languages
  85. 85. Copyright © 2012 Job and Esther Technologies, Inc.Embedding codeThe dictionary definition of “embed” is to makesomething an integral part ofIn Eqela programming language, “embedding” refersto adding other programming languages into blockswithin the Eqela code
  86. 86. Copyright © 2012 Job and Esther Technologies, Inc.Embed: Syntaxembed “(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));
  87. 87. Copyright © 2012 Job and Esther Technologies, Inc.Embed: Exampleclass 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();}}}}}
  88. 88. Copyright © 2012 Job and Esther Technologies, Inc.Thank you

×