Skip to content

genexuslabs/DissectingAngularArchitecture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This repository has the objective of providing an overview of the architecture of the code generated by the GeneXus Angular generator.

Design Decisions

Architecture

Angular High Level Architecture

Current Power of the Generator

The Angular generator is a front-end generator. The generated objects run on the browser and communicate with the back-end on the server to get and send information.

The back-end is not generated by the Angular generator; instead, it is generated by one of the existing GeneXus generators, such as the Java, .Net or .NetCore generator.

Generated Source Code

Every GeneXus object is generated in a separate directory, where all the sources are grouped. This is under the \mobile\Angular<main>\src\apps folder.

Generated Code Structure

For each panel, a component (the fundamental building block of Angular applications) is generated, which consists of three sources:

  • *.component.html

is the layout of the panel. It is an Angular template that represents the layout of UI. It is mainly HTML 5 referencing webcomponents from the open source library of controls, and it adds elements and attributes that Angular interprets to perform the bindings with the data model and the specified UI events.

  • *.component.ts

is the particular logic of the panel. It is a TypeScript program. Events are generated here, and the state that is bound to the UI is manipulated here.

  • *.sercvice.ts : is the layer responsible for interacting with the server. It is a Typescript program where communication with the server is generated. Here, the structures are also generated with the data model that the panel will use.

Exploring a Sample

In order to see the kind of code GeneXus is generating in this repository you have the full source code of an application.

The application basically is a "Light" CRM with Contacts, Companies and Meetings.

LightCRM

The backend services are hosted in AWS and the Angular generated code you can download and explore locally or here directly on github.

You can run the Angular code locally just by cloning this repository and after:

cd LightCRMSample npm install ng serve -o

Understanding the code generated

Understanding the generated code is quite simple, for each panel in Genexus you will have at least 3 files generated as mentioned above. There are several cases where we are generating components for different parts of one panel, for example if you have a Tab then we are generating a component for each tab page. Or if you have a Work With and Entity with several sections we are generating 3 files for each section, always respecting the separation of concerns in terms of UI, behavior and data access.

For example take a look WorkWithCompany is composed of several sections:

  1. A master with a list of the Companies, so we have
  2. A detail for each company that is called when a Company is selected
  3. The Detail of a company has a General section and a Contacts section to show all the information of a company, so GeneXus generates the General section and the contacts section:

Extensibility Scenarios

Using GeneXus Extensibility constructions

Mixing Generated and Manually written code

You can add your hand written code with the GeneXus generated code, actually you can say in some moment that some given object in Genexus is not generated by GeneXus any more by using the NO Generate property in GeneXus.

By Changing the Angular Generator

You can modify the Generator according to your needs! Obviously you need to merge future generator updates, but you get control over the "machine" that creates software.

The Angular generator is a Template-Based generator built on traditional generation technologies such as ASTs and string templates.

Starting from a high level metadata, the generator applies succesive transforms to acheive a metadata tree generable with a templating engine.

About

This repository explain the architecture and source code generated by the GeneXus Angular Generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •