ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / Managing 3-tier architecture
  • Overview
  • How can it be implemented?
  • Handling the different layers
  • WLanguage functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
The development in "3-tier" architecture is simplified.
What is the 3-tier?
The 3-tier architecture is designed to separate the 3 layers of an application: GUI, processes and data.
An application will include 3 independent layers:
  • presentation layer,
  • application (or process) layer,
  • data layer (which manages data access).
Specific functions (APIs in standard languages, advanced WLanguage functions) allow these 3 layers to communicate between themselves.
The reason for separating the layers is to make the layers independent in order to simplify the maintenance and future upgrades of the application (change of database system, transfer from a graphic environment to another one, ...).
This ensures better security because the access to the database is authorized by the Application layer only.
It also optimizes teamwork and multi-target development.
How can it be implemented?
The dialog between the different layers is performed via classes or structures that are automatically generated by WINDEV, WEBDEV and WINDEV Mobile.
1. You choose the data sources (data files or queries you want handle in 3-tier).
The different data files and queries are created in the data model editor and in the query editor.
2. WINDEV, WEBDEV and WINDEV Mobile automatically build the class diagram corresponding to the classes and structures that will be generated.
To do so, go to the "Analysis" tab, "Analysis" group, expand "Generation" and select "Generate the UML diagram corresponding to the analysis".
You also have the ability to create, in the UML editor, a class diagram corresponding to the analysis:
  • Click in the quick access buttons.
  • The new element window appears: click "Architecture", and then "UML".
  • The wizard for creating a UML diagram starts.
  • In the wizard, select "Class diagrams (reverse analysis, 3-Tier, ...)" and go to the next step.
  • Select "Build the class diagram corresponding to the database and to the queries ( 3-Tier architecture)".
  • Validate.
  • In the window that is displayed, choose the type of code to generate (procedural or object) and validate
3. The classes and structures are generated in WLanguage.
On the "Project" tab, in the "Other actions" group, expand "UML modeling" and select "Generate code". The sets of procedures and/or the classes are automatically generated.
4. You can provided "added-value" by developing your own methods in these classes.
The synchronization between the classes and the diagram is performed in real-time.
You can also modify the analysis and synchronize the UML diagram with the analysis.
5. These classes or structures allow the "Application" layer and the "Presentation" layer to communicate with each other.

Handling the different layers

  • For the "Data" layer:
    The standard functions for accessing the data can be handled: read, write, queries, transactions, ...
  • For the "Application" layer:
    Specific WLanguage functions can be used: FileToMemory and MemoryToFile. These functions are used to fill the members of the class from the items found in the corresponding data files (and conversely).
  • For the "Presentation" layer:
    The generated classes can be handled directly, no need to worry about the structure of the database.
  • For the communication between layers:
    Depending on the communication protocol between the 2 layers (component, Web service, HTTP, WEBDEV site, ...), the classes can be serialized in XML or in binary format (Serialize and Deserialize).

WLanguage functions

The following WLanguage functions support 3-tier architecture:
DeserializeDeserializes a buffer or a character string containing the data from a class, structure, array (including an associative array), queue, stack, list or advanced variable, as well as their subelements.
FileToMemoryAutomatically initializes the values of the members found in a class or in a structure with the values of the items of the current file record.
MemoryToFileAutomatically initializes the memory value of the items for the current file record with the values of the members of a class or structure.
SerializeTransforms the following elements into a specific format:
  • a structure (and its subelements),
  • a class (and its subelements),
  • an array (including the associative arrays),
  • a queue,
  • a stack,
  • a list.
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 01/23/2023

Send a report | Local help