Probl´ ematique
The use of mobile devices, such as smartphones, tablets, and phablets, is rapidly increasing, leading to a significant expansion in the mobile application market Companies are launching new applications daily to meet the growing demand for mobile devices and the evolving needs of users.
Mobile applications are typically developed for multiple operating systems, including Android, iOS, and Windows Phone It is crucial to create separate versions for each platform due to the distinct requirements in interface programming, libraries, and programming languages.
In the software development industry, there is a significant demand for efficient development processes Creating complex software within tight deadlines and limited budgets poses a considerable challenge This situation is also prevalent in mobile application development, where the rising popularity of mobile devices intensifies competition among application companies.
Certainly, the company that can rapidly produce and efficiently allocate resources for application development across various mobile devices and platforms stands to gain the most benefits.
Applications are provided separately for different platforms, yet their functionalities remain consistent across each one This leads to code redundancy By minimizing repetition in development, it is possible to reduce both time and budget significantly.
Les chercheurs tentaient d’´etudier des approches qui peuvent r´esoudre des probl´e- matiques sur :
– L’´evitement de r´ep´etition de code avec une structure g´en´eralis´ee pour la r´educ- tion du temps de d´eveloppement.
– La probabilit´e de baisser d’erreur ou faciliter de la correction.
– Le changement dans le code Il est moins compliqu´e de modifier si des fonction- nalit´es sont chang´ees.
The ability to write functionalities across various programming languages allows developers to call them once, significantly reducing development time For instance, defining an entity in Java, Objective-C, or C# can be accomplished by writing it once in a domain-specific language, which then generates the necessary versions for each language.
The software development process typically begins with gathering requirements, followed by analyzing these requests to design the product After the design phase, the implementation of the software takes place Similarly, for mobile applications, developers must ensure that the implementation supports various platforms If the design is not well-conceived, it can lead to a significant gap between requirements and implementation, resulting in economic challenges.
Motivation et objectif
Model-driven engineering (MDE) is an innovative approach for mobile application development that replaces traditional design methods with model-based design This shift simplifies the development process and reduces the gap between requirements and implementation Utilizing tools like UML (Unified Modeling Language) allows for a clear representation of the application's concept, making it easy to identify and correct errors by revisiting and modifying models The core idea of MDE is that application development is guided by models, making it highly compatible with modern development practices.
Cross-platform development enables the creation of mobile applications for various operating systems, significantly reducing development time and resources The code is automatically generated from models defined by the developer, ensuring that the generated application code is comparable to manually written code This approach leads to fewer issues and greater satisfaction with user requests.
This internship aims to explore the concept of model-driven engineering and its benefits for mobile application development To achieve this, I will study existing research on the subject, analyze various works, and provide a comparative assessment that highlights the strengths and weaknesses of this approach.
Plan du document
This report consists of five chapters that examine the model-driven engineering approach for mobile application development The first chapter outlines the problem statement, motivation, and objectives of the internship topic The second chapter reviews relevant literature and existing works, including descriptions of the model-driven engineering approach In the third chapter, a solution for implementing this approach in mobile application development is proposed The fourth chapter details the implementation of the proposed solution and its experimentation Finally, the fifth chapter provides an analysis of the work, conclusions, and future perspectives.
This chapter presents a bibliographic review of existing research aimed at facilitating mobile application development and discusses Model-Driven Engineering (MDE) as an alternative software development approach It begins by exploring techniques that enable faster and easier mobile application development Next, it introduces the MDE approach, highlighting its advantages for software development Finally, the chapter concludes with a discussion of the tools associated with this methodology.
Quelques Frameworks pour le d´ eveloppement des applications mobiles
Adobe AIR
Since 2011, Adobe AIR has emerged as the second-tier platform for developing applications on Google's Android mobile devices and the primary platform to receive official support for creating applications for the Blackberry Playbook.
Adobe AIR was initially created to enable runtime functionality on Microsoft Windows and Apple OS X environments This technology allows developers to build applications using Adobe's tools that can operate seamlessly across these operating systems without the need for modifications.
As Adobe AIR gains popularity in web application development, Apple introduces new technology for controlling devices independently of the mouse and keyboard on products like the iPhone and iPad In response, Adobe enhances Adobe AIR to support this new touchscreen technology for mobile devices Consequently, Adobe AIR emerges as the top choice for development on this innovative platform, working closely with mobile devices and tablets from Google Android and RIM.
Adobe AIR on mobile devices is optimized to use fewer resources compared to its PC counterpart This efficiency allows developers to focus on creating applications without worrying about resource limitations.
Adobe AIR offers flexibility in development by allowing the use of ActionScript 3 and the Adobe Flex framework, or alternatively, HTML, CSS, and JavaScript All these methods are supported by Adobe tools such as Adobe Flash Professional CS5, Adobe Flash Builder 4.5, and Adobe Dreamweaver CS5 Developers should have a solid understanding of object-oriented programming (OOP) to effectively utilize these technologies.
Cependant Adobe AIR est d´evelopp´e pour la technologie de web, il a besoin de l’Internet afin d’acc´eder `a l’application comme le site web g´en´eral.
jQuery Mobile Framwork
jQuery Mobile simplifies the creation of mobile websites, allowing developers to focus less on user interface design Additionally, it enables the development of mobile applications that can be integrated with PhoneGap, making them suitable for submission to both the Apple App Store and Android.
Les avantages de jQuery Mobile : – Une fois de la r´ealisation, il est possible de fonctionner sur tous les plateforme des appareils tels que iOS, Android, BlackBerry, Windows Phone etc.
Collaborating with the PhoneGap framework enables us to easily develop applications without the need to learn system-specific languages, such as Objective-C for iOS or Java for Android.
It can be used with the PHP programming language and the MySQL database, with no significant differences in programming between PHP and MySQL in general.
– Il y a beaucoup de beaux th`emes `a choisir Nous ne devons pas perdre de temps
` a ´ecrire CSS ou Javascript pour les interfaces, il permet aux d´eveloppeurs de travailler plus rapidement.
jQuery Mobile has its weaknesses when it comes to developing websites and applications for mobile devices While it offers capabilities for creating mobile-friendly interfaces, it may require the use of specific languages that cater to local needs Although it effectively functions as a website and displays well on smartphones, there are applications that do not need complex features Therefore, while jQuery Mobile can be a good choice for developers, it may not always be the best option for every mobile application.
Figure 2.2:Le jQuery Mobile Framwork
PhoneGap
PhoneGap is a cross-platform framework that wraps code created with HTML, CSS, and JavaScript into applications for various platforms However, it is not suitable for applications with extensive functionalities, as it lacks support for certain features Consequently, applications generated by PhoneGap do not utilize the native language of the target platform.
MD2
The MD2 Framework implements the concept of automatic transformation to generate source code from model development This capability enables multiple transformations to produce code for various target platforms The advantages of this approach include not only cross-platform compatibility but also rapid development cycles, thanks to its reusable properties and traceability features.
MD2's application development process consists of three phases First, the developer outlines the application using a textual model Second, a code generator for each supported platform converts this model into the respective platform's source code, including essential structural elements like project files Currently, code generators for Android and iOS are available In the final phase, the developer compiles the generated source code.
The MD2 language is structured within the Model-View-Controller (MVC) framework An application’s architecture is divided into three components: the model, the view, and the controller In generated applications, the controller operates on an event-driven system that manages user actions as well as internal or peripheral events Developers define actions within the model, which are executed in response to specific events.
IDM :Ing´ enierie Dirig´ ee par les Mod` eles pour le d´ eveloppement des logiciels 7
La d´ efinition de l’IDM
Model Driven Engineering (MDE), also known as Model Driven Development (MDD), is a software engineering discipline that generates all or part of a software application from models To facilitate this process, it is essential to provide flexible and reliable tools for the automatic management of these models, as well as dedicated languages for their transformations The primary goal of MDE is to automate software development by offering tools and languages for effective transformation.
L’id´ ee et l’objectif de l’IDM
A model is defined as an abstraction of a system, serving as a crucial tool for answering questions about the modeled system.
A model serves as a simplified representation of a system's concept, enabling stakeholders to easily and accurately grasp its essence This clarity aids developers in ensuring that the system meets the precise needs of the user.
Model-Driven Engineering (MDE) enhances software development by utilizing models to separately express the concerns of users and designers The core concept involves interpreting user requirements into models, which serve as the primary source for the development process Subsequently, these models undergo machine transformations, embodying the idea of model transformations The ultimate goal is to operationalize these models for generating executable code.
To formalize and transform models, IDM offers tools and languages designed for model transformation and formalization These are referred to as modeling languages and transformation languages, which will be discussed in further detail later.
Les approches de l’IDM
In the previous section, we introduced the concept and idea of IDM To better understand its principles, we will outline the key software development approaches based on IDM.
2.2.3.1 Mod`ele-Integrated Computing (MIC)
The Model-Driven Engineering (MDE) approach was introduced in the mid-1990s, initially designed for the development of complex embedded systems Similar to the principles of the Integrated Development Model (IDM), the MDE framework emphasizes the central role of models in the application development process It offers technologies for the specification and utilization of Domain-Specific Modeling Languages (DSMLs), along with tools for metaprogramming, as well as techniques for model verification and transformation.
The architecture of MIC is structured into three levels: the Meta level, which offers meta-modeling languages, meta-models, meta-modeling environments, and meta-generators to create domain-specific tools for use in the Model-Integrated Program Synthesis (MIPS) level.
The MIPS level comprises domain-specific modeling languages and toolchains designed for the construction and analysis of models, as well as the synthesis of applications.
– Le niveau Application repr´esente les applications logicielles adaptables Dans ce niveau, les programmes ex´ecutables sont sp´ecifi´es en termes de composition de plateformes (CORBA, etc.)
2.2.3.2 Les usines logicielles (Software Factories)
The concept of software factories revolves around tailoring specific characteristics for software development This includes the specialization of software vendors and developers within development teams, the use of domain-specific software engineering tools such as languages, assistants, and transformers, and the reuse of off-the-shelf software components Visual Studio Net 2005 was designed with these principles in mind, offering a generic and extensible environment that can be initially configured for a predefined set of application domains.
2.2.3.3 L’approche MDA : Model-Driven Architecture
The Model-Driven Architecture (MDA) approach, proposed by the Object Management Group (OMG) in 2000, emphasizes the separation of a system's functional specifications from the details of its implementation on a specific platform This means that models are specified independently of the platform, allowing for greater flexibility and adaptability in system design.
A Platform Independent Model (PIM) is utilized to express system functionalities before defining the specific platform used, while a Platform Specific Model (PSM) focuses on the characteristics of a particular platform The Model-Driven Architecture (MDA) approach facilitates the deployment of the same PIM across multiple platforms through the transformation to PSM, enabling greater flexibility and efficiency in system design.
L’architecture de MDA est standardis´ee en 4 niveaux :
– M0 – Le monde r´eel ou CIM est un niveau des fonctionnalit´es du syst`eme ou des exigences des utilisateurs.
The M1 model outlines formalized and structured requirements, specifically represented by the PIM (Platform Independent Model) and PSM (Platform Specific Model), which collectively illustrate the system's architecture.
– M2 – Le m´eta-mod`ele est un mod`ele de mod`eles C’est un langage utilis´e pour d´ecrire des mod`eles Par exemple UML, XML.
– M3 – Le m´eta-m´etamod`ele permet de d´ecrire un mod`ele de m´eta-mod`eles Selon l’OMG, le MOF est un exemple de description de m´eta-mod`eles.
Transformations between CIM, PIM, and PSM are frequently automated using various tools These transformations are conducted with tools that may vary in their compatibility with the OMG standard known as QVT.
La transformation de mod` ele
The IDM community, as defined by Bézivin (2004), emphasizes that model transformation involves generating one or more target models from one or more source models A key objective of IDM is to operationalize models through transformations, making transformation the core of IDM This concept is effectively illustrated in the MDA approach.
The MDA approach requires the initial creation of a platform-independent model (PIM), which is then refined into one or more platform-specific models (PSM) The transformation process serves as an intermediary, defining the transformation rules between the PIM and PSM.
The transformation of entities from the source model involves two key steps The first step identifies the correspondences between the concepts of the source and target models at the meta-model level, establishing a transformation function applicable to all instances of the source meta-model The second step applies this transformation to automatically generate the target model through a program known as a transformation or execution engine.
Les outils de l’IDM
Dans cette partie est la pr´esentation des outils qui permet de m´eta-mod´elisation dans lesquels la transformation de mod`eles revient `a l’ex´ecution d’un m´eta-programme.
Il existe maintenant de nombreux des outils de m´eta-mod´elisation Ces qui sont pr´esent´es suivants, sont quelques exemples souvent utilis´es.
Kermeta is a meta-modeling workshop developed by the Triskell team at IRISA, available as an Eclipse plugin It integrates a combination of metadata (EMOF) and the Action Semantics meta-model, now part of the UML 2.0 Superstructure Kermeta serves as a common denominator for various languages in the IDM landscape It comprises a meta-meta-model (an extension of EMOF) alongside a language for defining actions on meta-models These actions can be utilized for tasks such as validating model consistency with OCL constraints or performing model transformations A meta-model can be defined in Kermeta in three different ways.
The article discusses three methods for working with UML models: using a graphical model editor, employing a tree-based editor that associates instances of Kermeta's meta-element with XMI representation, and writing a Kermeta program that aligns with the meta-model definition.
MetaEdit+ allows for the explicit definition of a metamodel while simultaneously enabling the programming of all necessary tools at the same level This includes everything from graphical editors to code generators, as well as model transformations.
The Eclipse Modeling Framework (EMF) was developed to simplify the loading, manipulation, and storage of models within the Eclipse environment As a part of the Eclipse Modeling Framework family, EMF serves as a modeling and code generation platform that facilitates the creation of tools and applications based on structured models Not limited to a specific meta-model, EMF can manage various types of models and is based on a meta-model description standard known as "Ecore." This standard is a subset of the MOF (Meta-Object Facility) Essential standard, which is itself a subset of MOF2 EMF comprises several plugins that enhance its functionality.
– Le m´eta-mod`ele Ecore qui est un canevas de classes pour d´ecrire les mod`eles EMF et manipuler les r´ef´erentiels de mod`eles.
– EMF.Edit qui est un canevas de classes pour le d´eveloppement d’´editeurs de mod`eles EMF.
– Le mod`ele de g´en´eration GenModel qui permet de personnaliser la g´en´eration Java.
– JavaEmitterTemplate qui est un moteur de template g´en´erique.
– JavaMerge qui est un outil de fusion de code Java.
Int´ erˆ et de l’approche d’ing´ enierie dirig´ ee par les mod` eles pour le d´ eveloppement
pour le d´ eveloppement des applications mobiles
As the mobile application market continues to expand, companies are seeking ways to enhance the mobile app development process The goal is to create high-quality mobile applications within the shortest possible development time to meet market growth and increasing user demand One of the main challenges causing delays in app development is the need to support multiple mobile platforms Applications that can cater to various platforms tend to have better marketability However, developing a mobile app for different platforms requires individual design adaptations to accommodate the unique libraries of each platform, resulting in developers spending considerable time on the project.
Researchers are focused on enhancing the mobile application development process by creating applications that function seamlessly across multiple platforms This approach is known as cross-platform development, aiming to streamline the development effort while ensuring compatibility and efficiency.
Numerous development tools have been created to facilitate the development of mobile applications for major platforms such as Apple iOS, Google Android, Windows Phone, and RIM BlackBerry.
Cross-platform approaches face fundamental operational limitations in web environments Most are implemented using web application languages, which differ from native applications, resulting in a lack of features and performance issues.
Studying model-driven engineering (MDE) for mobile application development is a compelling choice MDE promotes traceability and code reusability, making it easier to generate code for applications with similar functionalities Additionally, as mobile development often involves supporting multiple platforms, MDE facilitates the generation of platform-specific code Furthermore, if errors arise within the application, developers can efficiently detect and correct them by reviewing the models used in the development process.
Another key feature of the model is its clear and easily understandable presentation of system functions It effectively minimizes the gap and distortion between the final product and customer requirements.
Les avantages mentionn´es ci-dessus aideraient `a r´esoudre le probl`eme de temps utilis´e et l’´economique dans le d´eveloppement des applications mobiles aussi bien.
This chapter provides an overview of model-driven engineering (MDE) and its existing contributions to enhancing mobile application development The next step involves identifying suitable ideas and tools to effectively plan the implementation of the MDE approach for mobile applications This will be discussed in the following chapter.
This section of the report outlines the proposed solution for implementing a model-driven engineering approach based on theoretical study It presents the techniques and tools utilized in this process.
M´ ethodologie et technique de l’approche MDA
M´ ethodologie de l’approche MDA
Le MDA a mis en ´evidence l’int´erˆet de s´eparer les sp´ecifications fonctionnelles d’une application de son impl´ementation sur une plateforme donn´ee.
To leverage the business benefits of this approach and address the challenges of mobile application development, the Product Information Management (PIM) system must adapt to platform changes and be reusable across multiple platforms The implications of this requirement are significant.
Models are now considered essential assets in the development process, rather than being overlooked afterward Modifying the Product Information Model (PIM) directly impacts the functionality of the delivered system.
Code generation is becoming increasingly important as the manual transformation from PIM to PSMs is costly and prone to errors In contrast, automated mapping of PSM can significantly reduce the costs associated with transitioning to a new platform or upgrading existing systems.
The MDA approach involves first creating a platform-independent model (PIM), which is then refined into one or more platform-specific models (PSM) The transformation serves as an intermediary, defining the transformation rules between the PIM and the PSM The diagram below illustrates the MDA process.
Figure 3.1: Le principe de processus de MDA
First, we consider the CIM (Computation Independent Model), which focuses on user requirements and serves as a model of the specifications Next, we move to the analysis and design model, known as the PIM (Platform Independent Model), which is defined using a specification language, which can be either textual or graphical This model is independent of execution platforms and will subsequently be transformed into the PIM.
The Platform Specific Model (PSM) is derived from the Platform Independent Model (PIM) A single PIM can be transformed into multiple PSMs tailored for various platforms through model transformation mechanisms.
Techniques disponibles de l’approche MDA
The Model-Driven Architecture (MDA) offers a comprehensive range of technologies for developing software based on its framework The illustration below depicts the technologies available at each level of this approach according to the standards.
Figure 3.2:L’hi´erarchie de mod`eles de MDA
Voici en r´esum´e une liste des normes importe quel expert de OMG devrait savoir :
M´eta-mod´elisation : – UML Infrastructure :qui est `a la base de la sp´ecification MOF.
– Meta Object Facility (MOF) : qui est la langue `a l’aide de laquelle une m´eta-mod`ele est d´efini.
Mod´elisation : – UML Superstructure :Unified Modeling Language(UML) est un langage de mod´elisation `a usage g´en´eral, d´efini par l’interm´ediaire du MOF.
– System Modeling Language (SysML) Profile :un profil UML pour l’ing´enierie des syst`emes.
– Modeling and Analysis of Real Time Embedded Systems (MARTE) Profil
Transformations : – Object Constraint Language (OCL) : permet de d´efinir la formelle de contraintes sur des ´el´ements d’un mod`ele.
– Query View Transformation Language (QVT) : permet de d´efinir un mod`ele `a transformations.
– MOF Models to Text (MOFM2T) Transformation Langue :permet la d´efinition de mod`ele au texte transformation.
Figure 3.3 illustrates a comprehensive map of various potential flows involved in modeling and transformation that can be followed during the definition of an MDA process.
Tout d’abord on doit choisir le langage de mod´elisation qu’on souhaite d’exploiter.Cela peut ˆetre UML, SysML, MARTE ou tout autre langage de mod´elisation d´efini par
Figure 3.3:Le plan du flux de MDA
Ref.[17] le MOF ou la grammaire d’une DSL peut correspondre `a un m´eta-mod`ele ´equivalent, comme il arrive dans Xtext.
The MOFM2T (MOF Models to Text Transformation Language) can be utilized to generate valuable documentation, code, and textual artifacts from an input model.
Pour notre solution, on va prendre le DSL comme le langage de mod´elisation et appliquer le mod`ele au texte transformations (MOFM2T) afin de g´en´erer le code.
Solution propos´ ee
M´ eta-mod´ elisation
A model is an abstract representation of reality, designed to schematically illustrate specific concepts within a program, facilitating a better understanding of how the architecture operates To grasp the contents and the information a model is meant to convey, it is essential to agree on the definition of its content This process is central to the concept of meta-modeling.
There are several meta-modeling techniques discussed in the MDA approach in Chapters 2 and 3 Dedicated meta-models can be created to meet specific needs, known as Domain Specific Languages (DSL) As DSLs become more widely used, the development of new meta-models is expected to be better understood and more frequent The steps to develop a meta-model include defining the concepts to be modeled and determining the best way to represent them, typically through MOF or EMF diagrams.
Our primary goal is to develop a code generator for mobile applications using a model-driven engineering approach, with the mobile application serving as the domain for the domain-specific language (DSL).
3.2.1.1 Conception de la m´eta-mod´elisation
Once we have defined our language domain, we must choose a syntax that encompasses all components of that domain This specific type of language is known as a Domain Specific Language (DSL) Finally, we will create a transformation grammar capable of converting a file written in this textual syntax into an appropriate instance of our domain model The process of transforming the CIM to the PIM is illustrated in Figure 3.5.
Figure 3.5: L’´etape de r´ealisation de PIM
For the development of Domain-Specific Languages (DSL), Eclipse Xtext is utilized Xtext provides the tools to create and use textual DSLs within a Model Driven Development (MDD) environment The domain language is defined in a meta-model, while its textual syntax is described in a xtext grammar file Additionally, Xtext can derive the language grammar from our language meta-model.
G´ en´ erateur de code
Before obtaining the complete code, we first work with the PSM To generate the PSM model, we apply the Object Management Group (OMG) principle known as Model to Text Transformation Language (M2T) M2T focuses on generating textual code from models, and we have chosen Acceleo as our development tool.
3.2.2.1 Conception pour le d´eveloppement du g´en´erateur de code
To design and implement the code generator, it is essential to first establish the transformation rules for the generator This foundational step is crucial for ensuring effective code generation.
Acceleo is natively based on EMF, ensuring direct compatibility with tools developed within this framework, such as Xtext Its advantages include seamless integration with Eclipse, along with robust development features like debugging, tracking, and tracing Additionally, Acceleo offers convenient manipulation of generated code, supports the construction of native generators, and adheres to the MOF standard specified by OMG for Model to Text (M2T) transformations.
Figure 3.6:L’´etape de r´ealisation de g´en´erateur
The transformation rule for the PSM model specified for the Android platform is defined, serving as the code generator Subsequently, the developer processes the PIM model through the code generator to produce the target platform code.
To implement the generator on the Android platform, it's essential to first acquire knowledge about this platform This foundational understanding will be detailed in the following section.
Android is an open-source platform developed by Google Inc that encompasses an operating system, middleware, and applications designed for use on mobile devices, including smartphones.
To write code for Android applications, it's essential to manage files and multiple subdirectories within the main project directory Each directory is designated for a specific function, making it crucial to understand how this structure operates effectively.
Figure 3.7: Les r´epertoires et fichiers n´ecessaires de l’application Android
Figure 3.7 illustrates the files within an Android application project The "src" folder, derived from the term "Source Code," contains the source code we have created, written in Java files, where we will explore the names of class attributes and methods.
The term "gen" refers to Generated Java Files, which are automatically created during the project setup, such as the R.java file This file contains text and interface elements brought into the project by the Android plugin Essentially, it serves as a pointer to the drawable, layout, and values directories within the project.
The term "res" is derived from the English word "resource" and is used to store files that are utilized in conjunction with projects, such as images It is organized into five directories: drawable-hdpi, drawable-ldpi, drawable-mdpi, layout, and values.
The AndroidManifest.xml file is structured in XML format, serving as a crucial component that stores essential properties and configuration parameters for an application It includes vital information such as the application's function names, code version, and permissions required for accessing the app.
The responsibility of this project is to develop code generators based on model-driven engineering approaches These generators should be capable of creating source code for mobile applications from Platform-Independent Models (PIM) The generated code must be compilable into native applications for mobile device platforms The expected outcome is that the generated code can be utilized with minimal modifications.
This chapter introduces a solution for mobile application development, aiming to address the challenges associated with this process To validate this hypothesis, we will implement the proposed solution and conduct experiments to assess its effectiveness.
Impl´ ementation et Exp´ erimentation
This chapter presents our work, detailing the implementation of the proposed solution and the experimentation conducted to evaluate our project product Finally, we showcase the results and provide an assessment of the outcomes.
Impl´ ementation de la solution
Impl´ ementation de langage d´ edi´ e : DSL
Our Domain-Specific Language (DSL) is designed around three main components: Model, View, and Control This structure facilitates code transformation for specified platforms, allowing for seamless code modifications Additionally, it supports easier adjustments to the model in response to changing requirements Figure 4.1 illustrates the architecture of our DSL.
Figure 4.1:Le concept de DSL
The application serves as the foundation of our framework, encompassing the essential components of View, Model, and Control The primary object holds all fundamental information related to the application Each project must include precisely one primary object, which can reside within any arbitrary controller.
Model est le premier ´el´ement dans l’arbre est le Model Dans la partie de model, le structure des attributs et des valeurs des param`etres sont d´ecrits.
Ces attributs seront d´efinissent le type, le nom et la description d’entit´e Le type des attributs peut ˆetre String , Integer , Float , Boolen ou Array.
View est le deuxi`eme ´el´ement Les ´el´ements de la partie de View sont la mise en page (Layouts) et des composants d’interface (Widget).
For layouts, we now define only two types: table layout and linear layout Each layout type requires specific parameters, such as size, dimensions, margins, orientation, gravity, and columns.
Pour les widget , on a d´efinit le widget de base pour les applications mobiles comme TextView, Button, Label, ImageView, TextInput, RadioButton.
TextView and Label are used to display text for users A TextView is defined by the keyword TextView followed by its name, with its properties enclosed in parentheses Similarly, a Label is indicated by the keyword Label, following the same structure for definition.
Botton allows users to trigger actions linked to key events To define a button, use the keyword "Botton" followed by its name, along with a default definition.
ImageView sert `a afficher l’image aux utilisateurs Il est indiqu´e par le mot-cl´e
ImageView suivi son nom et le chemin o`u se trouve l’image Et dans le parenth`ese se compose ses description.
TextInput est un champ pour mettre des entr´ees de l’utilisateur, indiqu´e par le mot-cl´e TextInput suivi son nom et ses descriptions dans la parenth`ese.
RadioButton sert `a d´efinir le choix, il peut y avoir plusieurs choix comme une liste des choix La valeur est true et false
Control is the final component of our DSL, designed to define application actions It connects View elements and Model data through designated actions within the control A control class can encompass multiple actions, with each action described in the form of a code fragment Currently, actions can be defined using basic events such as onTouch and onLeftSwipe.
The article discusses the integration of elements from the View and Model components, utilizing functions like onRightSwipe It includes images illustrating key sections of the Control code, demonstrating how these elements interact and are mapped within the application.
Pour les actions qui se pr´esentent dans notre DSL, il y 9 actions La forme pour d´ecrire ces actions sont d´efinies dans l’ActionDef.
InvokeActivityAction is a function used to call other defined actions The definition of InvokeActivityAction begins with the keyword "invoke," followed by the name of the action you wish to call.
The GoToURLAction is utilized when an application requires internet access, defined by the keyword "goto" followed by the target website's URL The SetIntent action facilitates the transfer of information between classes within an application, initiated with the keyword "setIntent." When the information originates from an interface element, such as TextInput, the definition must include the element's View name followed by the target class name Similarly, the GetIntent action allows for the transformation of information between classes, focusing on the receiver side of the process.
GetIntent commenácant par le mot-cl´e getIntent suivi par le Widget qui va repr´esenter l’information envoy´e par exemple le TextView,l’ImageViwer.
– DrawLine : cette action permet de faire le graphique de d´esigner un line Sa d´efinition commenácant par le mot-cl´e drawline et puis la coordonn´e `a partir et d’extr´emit´e.
The DrawRectangle action is used to create a square graphic, defined by the keyword "drawrectangle" followed by the coordinates for the left, top, right, and bottom edges of the rectangle Similarly, the DrawTable action facilitates the creation of a square spreadsheet graphic After the keyword "drawtable," users must specify the display location of the spreadsheet, its size in square units, the border color, and the border thickness.
MappingTask connects the View elements with the Model data through a defined action It begins with the keyword "map," followed by the name of the View element that will serve as the presenter Subsequently, it specifies the corresponding attribute element defined in the Model.
– ShowScreen: C’est l’action qui soutient la fonction de l’affichage de l’interface.
Sa d´efinition commence avec le mot-cl´e showScreen suivi par le nom de l’interface.
After creating the Domain-Specific Language (DSL) for our domain, we need to export our language as a plugin to facilitate modeling and transforming Platform-Specific Models (PSM) Once the plugin is ready, we import the MobileAppDSL plugin into our Eclipse IDE.
Impl´ ementation de g´ en´ erateur de code
For the development of a code generator for mobile applications using model-driven engineering, defining the transformation rules is crucial, as they are key to generating target platform code from the Platform Independent Model (PIM) Once the developer has modeled the PIM, which serves as the input for code generation, they must process this model through the code generator.
To develop the code generator, we can utilize Acceleo, a tool designed for defining model-to-text transformations, specifically for converting a Domain-Specific Language (DSL) into an Android application.
After installing Acceleo on the Eclipse editor, create an Acceleo project and select the meta-model of your DSL, which we have named MDAmobileDsl, from the list Next, create the module where the transformation will be described As shown in Figure 4.2, the module is positioned at the center of the architecture.
The modules will serve as the generation chain for the purpose of code generation This chain must be designed and described according to the corresponding target platform design Figure 4.3 illustrates the transformation concept for the Android platform.
Figure 4.3:Le concept de la transformation pour la plateforme Android
Un module correspond `a un fichier mlt Selon le concept de la plateforme
Android 3.7, le g´en´erateur doit ˆetre capable de g´en´erer le fichier n´ecessaire pour que l’application puisse fonctionner Au d´ebut de l’ex´ecution du mod`ele de g´en´erateur, le module Main qui est le module principal de mod`ele de g´en´erateur, faire l’appel sur des autres modules On va pr´esenter maintenant chaque module du mod`ele de g´en´erateur de code pour l’application d’Android.
The generateManifest module is responsible for creating the AndroidManifest.xml file based on the definitions provided in the generateManifestFile template This template extracts information from the application defined in the PIM model section.
The generateView module is responsible for creating the layout directory and the associated files within it This generation process involves producing an XML file that encompasses both layouts and widgets It utilizes the generateLayoutProp template, located in the generateLayout.mtl file, to define layout properties based on DSL Additionally, it calls the generateWidget template from the generateWidget.mtl file to generate the XML for widget properties A layout can contain multiple widgets, and the templates are called accordingly.
Le boucle va s’arrˆeter lorsqu’il n’y a plus des layouts et des widgets d´efinies `a partir de DSL.
The generateResource module is designed to create the values directory and the corresponding files within it Resource values defined in the PIM model section will be transformed into XML format files, such as 'res/values/gen-strings.xml' and 'res/values/gen-bools.xml', based on the attribute type.
The generateActivity module is designed to create the src directory and java files Each class within the PIM model corresponds to a single java file Actions are generated under the defined event method The eventcode template is invoked when the EventDef definition in the Control section of the model matches the parameters in the template Similarly, the actionCode template waits for the definition in the ActionDef of the PIM model.
Under the Acceleo project, we established the model directory to house the PIM model, which serves as the input model, and the output directory to store the generated code.
Application de la m´ ethode propos´ ee
Processus de d´ eveloppement
To test our DSL, we aim to create two PIM models for the mobile application within the Acceleo project for Android The following steps outline the development process of a mobile application using our code generator.
– Sur le projet Acceleo androidGen , faites un clique `a droit sur le dossier de model – Choisissez Nouveau Fichier.
– Cr´eez un fichier nomm´e nomDeFichier.mda – Ecrire le code selon la syntaxe de notre DSL.
Ensuite on passe le mod`ele PIM `a travers le g´en´erateur comme les ´etapes suivants. – Sur le projet Acceleo androidGen, faites un clique `a droit sur le projet.
– Compl´etez la configuration de l’ex´ecution comme la figure4.4 – Cliquez Run , vous obtenirez le r´esultat dans le r´epertoire out comme la figure4.5
Application 1 : Une application simple
For the initial generator test, we are creating a very simple application The features of this application are straightforward Here is the concept of the simple application.
Figure 4.4:La configuration de l’ex´ecution d’Acceleo
Figure 4.5: La location du code g´en´er´e
Cette application se compose deux pages Ce sont le Main page et Secode page.
La conception d’interface est repr´esent´e dans le tableur4.1et4.2 Les fonctionnalit´es de l’application sont comme les suivants :
– La page Main – Un label doit ˆetre capable d’afficher le nom de l’application.
A text input field is available for users to enter their name When the user clicks the "Show" button, the entered name must be passed to the Second page.
– Un bouton Next peut amener l’utilisateur `a la page Second.
– La page Second– Un label doit ˆetre capable d’afficher le nom de l’application.
– Un label affiche le nom d’entr´e `a partir du text input de la page Main.
– Un Image Viewer doit ˆetre capable de repr´esenter un image.
– Un bouton Seach peut amener l’utilisateur au site web http ://www.google.com
Une fois on a d´ecrit l’application, on transforme des exigences `a un mod`ele PIM par le langage DSL Le mod`ele PIM est pr´esent´e dans l’annexeA.
Apr`es avoir mod´elis´e un mod`ele PIM correspondant `a la conception, on fait passer le mod`ele `a travers le g´en´erateur de code et obtient le r´esultat suivant :
Table 4.1: La comparaison d’interface de Main
Pour le page Main au niveau de fonctionnalit´e, notre g´en´erateur est capable de g´en´er´e le code qui peut faire l’application fonctionnant comme tous les concepts cibles.
Table 4.2: La comparaison d’interface de Second
The same applies to the Second page When comparing the application functions based on design and those based on generated code, they are identical.
According to the defined concept of a simple application, our code generator is capable of generating code for Android applications We can conclude that it can generate functions as follows:
We conducted tests on various UI components, including Linear Layout, Label, Text Input, Button, and Image Viewer The code generator produced well-structured XML code that functions effectively for all tested elements, comparable to manually written code Additionally, we examined the Control section, focusing on java files that drive application actions, confirming that the generated code successfully operates the application.
Application 2 : Une application de jeu Sudoku
In the second generator test, we develop a more complex application: a Sudoku game First, we will introduce the concept of the game.
Les fonctionnalit´es de l’application sont d´ecompos´ees en deux parties.
– Joueur : – Jour au jeu – Choisir le niveau du jeu.
– Syst`eme : – D´esigner le tableur.
– Donner les chiffres pour l’´etat initial.
– V´erifier les chiffres entrant par le joueur selon les r`egles du jeu.
Une fois on a d´ecrit l’application, on transforme des exigences `a un mod`ele PIM par le langage DSL Le mod`ele PIM est pr´esent´e dans l’annexeB.
After designing the Sudoku game application, we create a Platform-Independent Model (PIM) based on that design Subsequently, we transfer this model to the code generator, yielding the final results.
Table 4.3: La comparaison d’interface de Main
La page Main est l’interface principale de l’application Selon la conception cette page se compose les boutons qui relient `a l’interface du jeu Game , le manuel Help
Le code g´en´er´e peut donner le r´esultat correspondant `a la conception.
Table 4.4: La comparaison d’interface de Help
The Help page serves as the main interface of the application, appearing when a player clicks on Help from the Main page It features a textbox that displays a description of the game, with game information defined in an XML file located in the value directory as a string Additionally, the Close button allows users to return to the Main page.
Table 4.5: La comparaison d’interface de level
La page Level est l’interface qui va afficher lorsqu’un utilisateur clique sur le bouton
Play Il se compose les boutons qui vont envoyer les chiffre `a la classe Game On a 4 ensembles de chiffres qui distinguent des diff´erences niveaux du jeu.
Table 4.6:La comparaison d’interface de Game
La page Game est la plus importante parmi les interfaces de cette application Il se compose plusieur l’action `a g´en´er´es.
The game grid is the primary component, and it must be designed using the drawRectangle and drawLine functions This can be accomplished through the code generator.
The initial data is provided based on the selected level in the Level class Unfortunately, the generator is unable to perform this task because the DSL lacks support for this function.
Verify the numbers entered by the player according to the game rules The code generator cannot implement this function as it is integral to the game's logic Defining the model is challenging due to the complexity of creating the function to support it in the DSL It is essential to carefully design the structure.
DSL Et afin de faire cela, il faut avoir la bonne connaissance de programmation sur le d´eveloppement des applications mobiles.
The implementation of the Sudoku game application is more complex than what the generator can provide in terms of functionality Logic plays a crucial role in the game's application To design the supported DSL and model transformation for this functionality, a deep understanding and advanced level of Android application development is essential.
Evaluation
In conclusion, our study on model-driven engineering approaches highlights their effectiveness in mobile application development, particularly for Android platform applications.
Dans cette partie, on souhaite de donner l’analyse sur le r´esultat de notre travail comme la suit :
After thorough research, it is evident that among various model-driven engineering approaches, the Model Driven Architecture (MDA) is the most suitable for mobile application development The MDA is standardized by the Object Management Group (OMG), providing a clear methodology for implementation based on established standards Additionally, there are numerous techniques within the MDA framework for effective modeling and model transformation.
We have developed a dedicated domain-specific language (DSL) for modeling mobile applications, which is segmented into three main components: interface design, resources, and application actions This structure facilitates easy implementation and revision of the model whenever developers need to make modifications However, the DSL has limited coverage within its domain due to the extensive range of functionalities in mobile application development and our experience level In other words, while the mobile applications domain encompasses numerous features, our DSL currently offers only a few essential functions Additionally, there remains a significant variety of layout types and widgets for the interface that are yet to be addressed.
In the development of code generators, it is unfortunate that they can currently only be created for the Android platform However, the methodology for developing code generators for other platforms such as iOS, Blackberry, and Windows Phone remains similar It is essential to possess knowledge of each platform's concepts, structures, and functionalities to ensure effective development.
However, it is possible to generate the coding for an Android application from a PIM model without modifications for simple applications, while modifications are necessary for more complex applications like a SUDOKU game The development of a game is inherently more complicated than other types of applications, requiring additional logic to be integrated into the code generated by our generator.
This chapter presents the conclusion of our study on the model-driven engineering approach for mobile application development It includes an analysis of the work conducted and concludes with future perspectives on the topic.
Conclusion
The objective of this internship is to explore model-driven engineering (MDE) approaches to enhance the speed at which developers create mobile applications We investigated the benefits of MDE and concluded that Model Driven Architecture (MDA) is particularly suited for mobile application development Consequently, we proposed a solution that utilizes the MDA approach for the efficient development of mobile applications.
We are developing a Domain Specific Language (DSL) that serves as a meta-model for mobile application development using the Xtext framework Our DSL is structured into three main components The first component focuses on defining the application's interface, including layout arrangements and interface widgets The second component is designed to establish application control, enabling the definition of necessary actions for the application's functionality.
The third part is designed to define variable models within the application, establishing resources that will be utilized The outcome of this stage is a dedicated language tailored for the mobile application domain, presented as a plugin for the Eclipse editor This language enables developers to create a platform-independent model (PIM) using the mda file format.
Une fois qu’on a le langage d´edi´e, l’´etape suivant est de d´efinir le mod`ele sp´ecifique
The Platform-Specific Model (PSM) must define the transformation grammar for various platforms; however, due to time constraints and limited experience in mobile development, we can only define the PSM for the Android platform Acceleo has been selected as the tool for this phase, and we have described the grammar in accordance with the structure of the Android platform The outcome of this phase is a code generator for the Android mobile application.
After the developer models the PIM using our DSL, they must transfer the model to our generator to obtain the coding for the mobile application for each platform.
Perspective
Although we have successfully developed a code generator based on the model, following the principles of model-driven engineering, there is still work to be done to enhance and complete the process.
The mobile application domain is vast, and our current DSL does not cover all areas To model more complex mobile applications, we need to provide additional elements, particularly regarding the interface (View), which requires more layouts and widgets Furthermore, we must incorporate elements that define additional functions for actions For example, in game applications, it is crucial to establish the game logic; unfortunately, we currently lack support for this functionality Improving this aspect is essential for future development.
For the development of the code generator, we utilized the M2T technique implemented by the Acceleo tool We focused solely on creating the code generator for the mobile platform However, it would be beneficial to also develop generators for other platforms such as iOS, Blackberry, and Windows Phone.
Mod` ele PIM de l’application simple avec DSL
Mod` ele PIM de l’application de jeu Sudoku avec DSL
[1] Benoˆıt Combemale Ing´enierie dirig´ee par les mod`eles (idm)– ´Etat de l’art 2008. URLhttps://hal.archives-ouvertes.fr/hal-00371565/document.
[2] Mohamed Talea Dehbi, Rachid and Abderahim Tragha A model driven methodo- logy approach for e-learning platform development Inter Journal of Information and Education Technology 3.1, pages 10–15, 2013.
[3] R´edouane Lbath Diaw, Samba and Bernard Coulette ´Etat de l’art sur le d´evelop- pement logiciel dirig´e par les mod`eles 2008.
[4] Tim A Majchrzak Heitk¨otter, Henning and Herbert Kuchen Cross-platform model- driven development of mobile applications with md2.Proceedings of the 28th Annual ACM Symposium on Applied Computing ACM, 2013.
[5] Marco Brambilla Effective cross-platform mobile application develop- ment February 2014 URL http://www.modeldrivenstar.org/2014/02/ effective-cross-platform-mobile-app-development.html.
Juha-Pekka Tolvanen and Steven Kelly discuss the concept of Metaedit+, which focuses on defining and utilizing integrated domain-specific modeling languages Their work was presented at the 24th ACM SIGPLAN conference companion on object-oriented programming systems, languages, and applications in 2009 This research highlights the significance of tailored modeling languages in enhancing software development processes.
[7] The Eclipse Foundation Eclipse modeling framework 2014 URL http://www. eclipse.org/emf.
[8] The Eclipse Foundation Xtext 2014 URL http://www.eclipse.org/xtext/.
[9] The Eclipse Foundation Xtend 2014 URL http://www.eclipse.org/xtend/.
[10] Adobe Systems Incorporated Phonegap 2014 URLhttp://phonegap.com/.
[11] Adobe Systems Incorporated Adobe air 2014 URL http://www.adobe.com/ products/air.html.