Ask Reuben

Starting With Genero Studio

How do I start using Genero Studio? 

How should I configure Genero Studio?

Where is the make file in Genero Studio? 

How can I change XXX in Genero Studio?

I have tried a few times to write an article on Starting with Genero Studio similar to the other “Starting …” Ask-Reuben articles I have written.  It is a difficult article to write as everyone approaches Genero Studio from a different direction and what is important for one Genero developer might not be as important as another Genero developer. 

Genero Studio also has a lot of functionality.  There is a lot I don’t cover, all I can say is be curious when using Genero Studio.  Look at the options in Preferences, look at the various topmenu options, look in the different Window-Views.  

The approach I have taken is to list a number of statements and then write a paragraph or more about that statement.  When you are evaluating and implementing Genero Studio, keep these statements in the back of your mind.  Hopefully there is a nugget or two of information that you benefit from.

What is Genero Studio?

As per the entry in the Genero Studio documentation

Genero Enterprise provides an integrated development environment that you can use for the creation of applications to deploy to desktop, web, cloud, and mobile clients.

It is an Integrated Development Environment (IDE) that we Four Js have provided for you to develop Genero applications.  There is no additional cost over and above your existing development and run-time licenses.   We provide it because we believe you will be more effective and productive than if you were using vi at the command line in a terminal emulator.

GST = Genero Studio,  it is not a tax!

The three letter acronym “GST” has come to be the short code or term used to refer to Genero Studio.  In a number of countries, GST is also the abbreviation for a goods and services tax, what you may refer to as VAT or Sales Tax!.  Fortunately the context in which it is used it is rare to mistake the two different meanings of GST.

Also note that “GSTSVR”  / “gstsvr”  is the equivalent abbreviation for the Genero Studio Server component.

What are the different Genero Studio packages?  What do I need to download?

When you come to download Genero Studio you will see references to “Genero Studio (GST)” and “Genero Suite Server (Studio Server + All server components)”.

The answer depends if you plan on doing local or remote development.  You will always download Genero Studio (GST) onto the machine (PC) where the developer will be sitting and editing code.  You may also need to download the Genero Suite Server onto the machine (Server) where the compiler and runner will sit if that is different from the developers PC.

In a typical Windows PC for the developer and a Linux back-end Server development environment, then you will be installing Genero Studio for Windows onto the developers Windows PC, and you will be installing Genero Suite Server onto your development Linux server.

It is not compulsory to use every Genero Studio module

Genero Studio has many modules, don’t feel compelled to use very module.  You can still

In fact it is often better to structure your implementation strategy into many smaller steps rather than taking one giant step.  Get comfortable using the Code Editor with your Genero source files, and compiling, running, and debugging using the Graphical debugger ,  before expanding your usage of Genero Studio into Form Designer, Report Writer, BAM etc.

Be prepared to fit your development environment around Genero Studio, it is not always possible for Genero Studio to fit around you.

In the early days of Genero Studio, I would hear developers say I am not prepared to use Genero Studio as it does not do X.  Developing in a graphical IDE has many benefits and this attitude meant that the developer missed out on the many benefits of Genero Studio because of this one weakness.

Do a proper analysis of the strengths and weaknesses, the pros and the cons of Genero Studio, and ask yourself is this one weakness more important than the many benefits that I am missing out on.  Then ask yourself (work with your local support contact) , how can I modify what I do in my development environment to reduce this perceived weakness?  I am doing all this configuration via Build Rules, User Actions, Configurations, Preferences to fit Genero Studio to what I do, for this perceived weakness can I turn it around and modify what I do to fit within Genero Studio?

You won’t be installing Genero Studio on a customer site – Plan to wean yourself off the packages incorporated into Genero Studio?

Whenever in a support case, I see the environment variable FGLDIR set to a value similar to “opt/fourjs/gstsrv/fgl”, my senses are heightened.  This tells me two things …

  • you may have installed the Genero Studio Server component on a production site
  • you don’t have a plan for installing maintenance releases

For an introduction to Genero Studio, it is useful having the fgl, gas packages etc installed at the same time as Genero Studio is installed.  The evaluator can then start compiling and running Genero programs straight away without facing the added complexities of installing fgl, gas packages etc separately.  However when it comes to a production site, you are not going to install Genero Studio or Genero Studio Server on the production site, you are going to have to install seperate fgl, gas packages etc.  So it is a skill you are going to need, how to download and install seperate fgl, gas, etc packages, and then how to configure your development and production environments to use these packages.

So my advice is, when you first evaluate Genero Studio, use the packages supplied with Genero Studio.  Once you start configuring it for your development environment, do not use the packages supplied within Genero Studio.  Learn how to download, install and configure the individual fgl, gas packages etc.

Plan your configurations for past, present, and future

In your development, expect to have a minimum of three Genero versions for each individual package in use at any one point in time.

  1. You will have the current version you are developing and deploying on.
  2. You need to have previous versions so that if a support case is raised by your users, you can test using the version they are using.  They may also be raising a behaviour change between a current and previous version which you need to be able to look at.
  3. When we supply a new version, wether maintenance or major release, you are going to want to have a seperate environment where you can evaluate that new version.  Similarly your next release may be built using that new  version.

Another reason I avoid using the fgl, gas, gre etc package supplied within Genero Studio (or Genero Studio Server) is the naming convention of the Studio packages does not lend itself to multiple versions. If you use the package supplied with Studio which may end up with opt/fourjs/gstsrv/fgl, where are you going to install and what name are you going to give to a fgl maintenance release?  Hence my preference to install products separately in their own directory that includes the version as part of the name e.g. /opt/fourjs/fgl/X.YY.ZZ

In support cases, give the individual product versions

Too often in support cases, we will ask for a version and get given a single GST version.  That does not tell us the individual FGL, GBC, GAS, GDC versions.  Only if the issue is with Genero Studio version itself will we be interested in the GST version.

So please remember to give FGL, GAS, GRE, GBC, GDC etc version as appropriate.  If you can give us those individual product versions it reassures us that you have a good understanding of the Genero architecture and how the various components fit together.

There is more to life than configurations for Desktop, Web, and Mobile

In the Genero Configuration Management Dialog you will see that for each configuration, you can specify

  • different FGL versions
  • different Environment Sets
  • different Display Options.  Within Display Options you can specify different clients (GDC, GMA, GMI)

By using the dropdown in the bottom right corner, you can quickly switch between configurations. The default setup switches between different front-end clients.

In your command line environment you probably have scripts that set environment variables for different development environments.  You will probably have configurations equivalents of each of the options in those scripts.

The key is to be able to build and run an application, then change configuration in bottom right corner, and then build and run the same application using one or more …

  • different FGL version
  • different value of environment variables e.g. LANG to test different internationalizations, different database environment variables to switch between databases.
  • to a different front-end, switch from using GDC to a browser.

You will typically end up with a number of different configurations over and above the default configurations supplied.

There is not one right strategy for .4pw files

Genero Studio uses the concept of a project to manage source files.  Project information is stored in a .4pw file which if you open in a text editor you will see is XML (useful to know if you decide to generate  your .4pw from existing information).

The .4pw includes information about what source files are in what Genero application or libraries. Your command line environment probably has that information buried away in make files.  When a Genero  application/library is built, the 4pw determines what files are compiled and linked, and where the compiled objects are placed (the target directory).   Creating your 4pw is taking that information from your make file and putting it in a different format.

Don’t assume that how the demo and sample applications are arranged in the .4pw that that is how you must arrange your .4pw files.

  • you might have sources for all applications in one directory, you might have source for each application in its own directory.
  • you might put compiled objects in same directory as source files, you might place compiled objects in a seperate directory.

You may choose to keep those arrangements or you might choose to change them.  Certainly the modern way is to keep source files and compiled objects seperate,  group common files into libraries for re-use between Genero applications, and to have a directory structure for the different applications in your system.  Have a look at the documentation generator and how it expects sources to be arranged.  Moving to Genero Studio could be the incentive to change structure.

Also with .4pw files you might have …

  • one .4pw file encompassing all your Genero applications
  • every Genero application in its own .4pw file
  • or somewhere in between, if your application is in seperate functional modules you may have each module and its applications in their own .4pw file

I have previously written an Ask-Reuben article on the use of External Projects.

Any Proof of Concept should  include some different strategies for how to arrange your .4pw files, and should consider placing source files in directories that suit the documentation generator.

Studio does not compile or run within the Studio executable

One of the misconceptions of Genero Studio is that it compiles and runs Genero applications.  It doesn’t, it executes fglcomp, fglform, fglink, fglrun etc. commands just as if you had typed them in at the command line or executed a makefile.

The concept of Build Rules allows you to view and change those commands that are executed when you compile and execute a command.  I certainly encourage you to view the Build Rules configuration dialog and understand what commands are being executed.  Your existing makefile will have similar sets of rules and commands defined inside them, and in configuring Genero Studio you may decide to configure Build Rules to closely match what your makefile did.

Use User Actions to avoid leaving Genero Studio

If you find that you are exiting Genero Studio to do something, you can investigate creating User Actions so that task can be executed from within Genero Studio.  You can define these actions and then have them be executed from toolbars, menu items, keyboard accelerators, or right-clicking on project node or files.

Some of the User Actions I have include …

  • Open GAS Logs : $(open) "$(FGLASDIR)/appdata/log/httpdispatch/$(yyyymmdd)"
  • Build rdd :  fglcomp --build-rdd $(FileDir)/$(FileName)
  • Run Demo in GDC : /bin/sh -c "cd $FGLDIR/demo && fglrun demo"
  • Run Demo in Browser : open -a "Google Chrome" "http:localhost:6394/ua/r/gwc-demo"

I can then execute these from within Studio and not have to leave Studio.

Are preferences for your organisation or your developers?

Preferences allow you to configure Genero Studio to suit you individually.  They are arranged in a Tree structure and I can’t say much more than goto Tools->Preferences and look through the tree.

If you have multiple developers you are going to want some of these preference values to be same between developers.  You are going to want some standards and you are going to want your developers to conform to these standards.

Preferences are stored in the user.conf file, this is an XML file in the directory specified by GSTUSERDIR.  If you investigate this directory you will see other files with the extension “.conf”.

Outside of Genero Studio you may end up doing things like cross-checking developers .conf files that they have the same value for certain settings.  Not all settings but settings such as InsertSpacesForTab, TabSize.

(One tip if you start reading these .conf files, they are written when Genero Studio exits.  So if you do anything with these files, exit Studio then read them.  If you modify them then do this before starting Genero Studio)

There is some functionality where Studio has considered that there maybe multiple developers.  For example Templates can be exported and imported between developers.

Genero Studio does not break rules of Operating Systems

Genero Studio does not do any magic, whatever it does it confirms to the rules of Operating Systems.  It doesn’t do any compilation, or execution of applications within the Genero Studio executable, it is using fglcomp, fglrun  as if they had been keyed in at the command line.

So whenever you are puzzled by what is occurring, take a step back, try and determine what command is being executed in what environment from what directory.  Often you will find that you don’t have an environment variable configured correctly and it is case of understanding where it is set and what is value is.

gsmake for automation

The gsmake command can be used to build Genero applications using your Genero Studio configurations from the command line.  So for cron jobs, daily builds, full recompilations, CI/CD type activities, compiling a Genero application without any human input required, your solution is probably going to  include use of the command gsmake.

Local v Remote (Mount) v Remote (Sync)

A key decision with Genero Studio setup is Local or Remote development, and then with Remote, use mount points or synchronize directories.

I find the key question with the question of Local and Remote is, can the developer work on the beach or in an airplane.  In   that scenario they only have their PC and won’t have access to a development server or a big database.    If your Genero application is dependent on a number of scripts, tools etc on the development server then it is not a good candidate to run locally on a developer PC’s as you then have to have those scripts, tools on their PC.   If your application runs independently then it is a good candidate for a local setup.

The other key question when considering this setup is where are

  • my source files
  • my compiled object files
  • fglcomp
  • fglrun

If they can all be on the same PC, that is you can check out source files to your PC, compile and run them on the PC, then a local setup is possible.  Developer can run and test the application on their PC, and when they are done, check-in their amended source files back to the source repository.

If you need fglcomp, fglrun to be executing on your development server then you need a remote setup.  With remote there is then a further decision, Mount Points, or Synchronization.  They way I think of these two is determined by where do you check out your source files to.  With synchronization, you check out the source files to a local directory on your PC, and then the synchronization copies them to the remote server before the compilation step.  With mount points, the source files are on the remote server, and you are mapping a network drive to edit them from your PC.  In both cases, fglcomp is executing on the remote server on a file on the remote server, and fglrun is executing on the remote server on compiled objects on the remote server.

per vs 4fd

.4fd is the file extension for form files maintained in the Form Designer.  See my thoughts in this Ask-Reuben article per vs 4fd.

Bold is what you have changed.

The Properties View is used in a number of places in Genero Studio.  It allows you to view and edit property values and provides a suitable wizard for entering a property value.

It has an interesting User Interface in that if the label on the left hand side of the property view is bold then this means the value has been altered from the default.  If the label is not bold then the value shown on the right hand side is the default/inherited used when nothing is explicitly specified.  There is a button in the right hand side called the reset button that can be used to delete the value you have entered and use the default value.

So when looking at property values, look for the the properties that have a bold label.  These are the values you (or any other developer) have explicitly changed.

vi doesn’t make sense with a mouse in your hand.

The Code Editor in Genero Studio has a vi mode .  What I have observed is that with vi fans, when they finally start using Genero Studio they think they will use the vi mode.  More often than not, they will realise that in a GUI environment, vi is unnatural.    They may switch to vi mode for the odd sequence of commands but most of the time they will be using the GUI code editor.

The first error is the only one guaranteed to make sense

When using Code Editor, all the compilation errors are output in the Document Errors view.  You can click on these lines in the Document Errors view and Studio will take you to the line in the open source file.

Work your way top to bottom.  You may think there is a lot of errors but if you fix the first one, the rest may disappear, particular if the error was a missing quote or missing END.

Diff Views

The Diff tool provides a graphical view of the differences between files.  It allows you to

The diff views also have a few options for how to view.  Side by side, above/below, green for code added, red for code removed etc

Learn how to attach debugger to a running program.

The Graphical Debugger is similar to debuggers you will find in other IDE’s with the ability to add breakpoints, step line by line, view variable values etc.

Deep down the graphical debugger is implementing the same debugger as at the command line, the actions in the GUI debugger map to a command you could use with the command-line debugger.  However instead of typing print to look at one variable at a time, the GUI Debugger is doing that for you and updating the variables displayed in the IDE as you step through line by line.

What most people don’t realise is that the debugger in Genero Studio can be used to attach to a running program, both locally and remotely.  You don’t have to be in a position to compile a program in order to debug it.  You can attach to a running program, stop it, interrogate variables, and then step through line by line.  You don’t even have to have the source, although it is more useful to know that if you are at line 123 of foo.4gl, just what line 123 of foo.4gl is.  Hence using  FGLSOURCEPATH to point at some source.

As I said at the end of this Ask-Reuben on debugging, try out debugging by attaching to a running program.  Also note the importance of the ignoreDebuggerEvent FGLPROFILE entry.

Running Multiple Programs – answer “No” to “Applications are currently running.  Do you want to stop them?”

The early versions of Genero Studio only allowed you to run one program at a time.  With a properly configured Genero Studio you can run multiple programs at a time.  This can be different programs like web service server or client, or it might be the same program with different configurations.

When you change configurations, if you get the “Applications are currently running.  Do you want to stop them?” dialog, just answer No.  A handy exercise to show power of Genero is to run the same program to different clients (GDC, Web, Mobile) by repeating the steps of

  • right-click Execute
  • change configuration
  • answer No to the prompt

My Business Diagram is too complex

As per this Ask-Reuben article, most business diagrams have the ability to set a filter.  Most diagrams look good when you first see them in a presentation or on a Hello World type program.  Then in the real world, where you are measuring in the 100’s and 1000’s you can end up with diagrams with 100’s and 1000’s of objects.  Look for a filter to reduce the diagram to something that is more comprehendable.

BAM can be configured a lot

The Business Application Modeler is a graphical tool for generating applications.  There is a lot of configuration that can be done within BAM.  Don’t look at the application and the code generated by BAM and feel that this application, how it looks, the functionality it has, is what you have to have.

Within the BAM Template Developer Guide and what you can change in files such as build.rules, creatables.conf, file-types.xml, settings.agconf , Studio does allow you to have control what the developers user interface is and what files are generated.

If you have a code generator already, it maybe possible to incorporate the usage of that generator into Genero Studio.

Also for those that looked at BAM a long time ago, the concept of POINT and BLOCK is in the process of being superseded by the concept of Code Event.  You click on a property in the business diagram, type in a small snippet of code, and that will be generated into the right place in the 4gl code.

Take Genero Studio for a test drive

The Genero Evaluation Program allows you to download Genero Studio to your PC, edit, compile and run programs locally.  So take it for a test drive, editing, compiling, executing, debugging small  Genero applications on your PC away from your development environment.

Don’t be afraid to ask your local support contact for assistance in making sure you see all of Genero Studio and what it offers.