Ask Reuben

200th Article

How do I find an Ask-Reuben article?

This is the 200th Ask-Reuben article.  I quite often see support cases where I have the answer already in the form of an Ask-Reuben article.  The question is how can the end-user find that article in amongst the 200 and counting articles.  There are two techniques I use to search …

  1. Goto the Ask-Reuben archive page https://4js.com/ask-reuben/ask-reuben-archives/, press Control-F and see if any titles might match what you are after.
  2. The better approach, goto Google, and type in

site:https://4js.com/ask-reuben search-expression

If you have not seen it before, using site: in a Google search limits the results to descendants of that URL, so “site:https://4js.com/ask-reuben” restricts the search to Ask-Reuben articles!  Other useful Google search tips which I hope you would all be familiar with include the use of

    • quotes – a search on “DISPLAY ARRAY” is different than a search on DISPLAY ARRAY
    • minus – exclude terms e.g. array -“input array” -“display array”
    • or – search for either expression e.g. input | construct | menu

For this 200th article I thought I’d also take the liberty to throw in a collection of different questions on varying topics with some interesting answers to challenge you.  Any opinion is my own.


Do you have any favourite Ask-Reuben articles?

One of the first ones I wrote, I still see screenshots coming through that IMHO would benefit from using the style listed here to align column headings with the data.  If I had my way, that would be the default setting.

This article also needed management approval for its title!  (I don’t claim credit for the title).

I also enjoyed the trilogy in 4 parts (1, 2, 3, 4) on coding for when things go wrong.  I had variants of these in the system I used to look after and when I get on systems that don’t have them, I wonder how they cope.

fgl_zoom and Excel are ones I get positive feedback from users on.


I find it difficult to attract Genero developers.  What more can I do?

I was at a customer site and the senior manager asked such a question and I replied by doing the following search

site:company-name.com genero

and then followed it up with

company-name genero

If you do this you will probably have 0 pages in the results for the first search !!!, and then the second search will return more including LinkedIn pages of your employees who publicise their Genero skills.

My point to this manager was that we know they are a billion dollar plus revenue listed company using an ERP system written in Informix-4gl and then Genero.  That system has been the backbone of their operations for the last 30+ years , but the world does not know that.

So first thing you can do is publicise your own successes using Genero.  This will have a positive flow-on effect.  For instance we don’t have a Wikipedia page.  No Wikipedia page means we can’t get Informix-4gl and Genero results combined so as to enter the Tiobe Index.  Interestingly we did recently pass the notability test for Github, hence you see .4gl files in Github showing as Genero Language.


Do I have too many lines of code?

Probably!

Over the years Four Js has added syntax to Genero that will allow you to cut down on the number of lines of code you have.

  • UNBUFFERED means you can remove unnecessary DISPLAY statements, see here for more
  • The ability to hide/show fields, to enable/disable fields and actions etc means that instead of having a seperate dialog or form for every combination, you can have a single dialog, a single form, and use the various ui.Form and ui.Dialog methods to hide/show, enable/disable as desired.
  • Generic code such as that using base.SqlHandle, ui.Dialog , means you can write library functions such as value_exists(table_name, column_name, value) returns boolean, fgl_zoom , combobox_populate that mean you can write one or a handful of lines of code rather than large repeated code blocks.
  • Don’t fight the front-end.  For example the following code pattern which is how Informix-4gl programs would emphasise the current field is unnecessary in Genero.  If you still have those lines, they could’ve been removed 20 years ago, and your developers need not have been typing them in all this time.
     BEFORE FIELD field-name
         DISPLAY BY NAME rec.field-name ATTRIBTUES(REVERSE)

     AFTER FIELD field-name
         DISPLAY BY NAME rec.field_name ATTRIBUTES(NORMAL)
  • I would also extend my comment about avoid fighting the front-end to .4st files. Less is best. For example if you hard-coded some colors in a .4st, what happens to those colors in a dark mode?

A good exercise to do is to group your programs into categories.  Chances are you will find programs that are

  • Maintenance of a single database table
    • A variation/extension to then maintain two or more tables that have parent-child relationship in the same program.
  • Transaction Entry that will be the most used programs in your suite.
  • Programs that have the same pattern at the beginning to enter criteria that are then used
    • to start batch processes
    • generate reports
    • start enquiry programs

Based on these categories, you don’t need a system of hundreds of unique programs.  You probably have less than 10 unique programs.  What is the difference between Debtor Maintenance and Creditor Maintenance?, the database table read and written to, the business rules that apply for each column.  Is this reflected in your code or is there code (for example a MENU with Query, Add, Update, Delete, …) duplicated in both programs?


I don’t like what is in an upgrade, can you please change it back?

Prior to an upgrade, we run Early Access Programs.  This is the place where you can test any changes we have made and you can provide feedback before the change is officially incorporated into a release.

At the time of writing, Genero 4.00 was released 24 months ago.  An Early Access Program ran for 6 months prior to that.  If you are just now upgrading to 4.xx and are adversely impacted by a change, the appropriate time for you to provide feedback was 2.5 years ago.   If you choose not to commit some resource to an Early Access Program and take the release as you find it months and years later, then you are running the risk that there is a change you don’t like in the release.

I should add we try to avoid such changes but sometimes it is necessary to take 1 step back to go 2 steps forward.  The feedback in the Early Access Programs will tell us if that 1 step backwards is too painful, and help make sure that we provide a suitable path forwards.


What does it mean to split user interface and business logic?

Ask yourself the question, can the business rules in my maintenance program be reused if the data was uploaded via a Web Service.  The following code …

FUNCTION fieldname_valid() RETURNS BOOLEAN
   IF value < 0 THEN
      ERROR "Value must be greater than zero"
      RETURN FALSE
   END IF
END FUNCTION

... cannot be resused by a Web Service due to the presence of the User Interface code in the form of the ERROR statement.  This function would be better coded as ...

FUNCTION fieldname_valid() RETURNS (BOOLEAN, STRING)
   IF value < 0 THEN
      RETURN FALSE,  "Value must be greater than zero"
   END IF
   RETURN TRUE, ""
END FUNCTION

... and it is upto the calling program (GUI program, a Web Service) to interpret the TRUE/FALSE and deal with the error text.

This coding style was flavour of the month about 20-30 years ago, those that have adhered to that style since then have been able to move forward faster than those who haven't.


What is an unseen danger to my companies success?

Dependency on key individuals.  Something I have seen occur a couple of times recently, a key individual has retired and taken a lot of corporate and product knowledge with them.

On the support desk I am seeing some questions where the person asking the question does not know the answer or does not know why something is the way it is.  The retired person they have succeeded would have known the answer.  It can sometimes feel that we are training this replacement for free via support channels rather than a full handover having occurred from the key individual before they retired.


What skillset do you think is lacking amongst Genero developers?

I don't know if I would describe it as a skill but having the confidence,  ability, and systems in place to apply changes to many source files at once.  This typically involves source control, scripting changes, and having the ability to revert the change if it does not work out.

As an example ...

  • adding an additional parameter to a function call
  • adding an attribute to all widgets of a certain type
  • replacing ERROR, MESSAGE with a function call
  • replacing code with a pre-processor macro, as used here.

Are you able to check out all your sources, apply such a change to multiple source files, build all, run your QA tests, and commit your sources?

Sometimes developers are scared of applying this level of change.


What does it mean "Nothings makes a geeks propellor spin faster than an isolated reproducible problem" ?

This is one of my favourite sayings as it applies to all developers.  If you tell a developer there is something wrong with their code and produce a small example program that illustrates this wrong behaviour, you are going to get their attention very quick.  They will more often than not, drop what they are doing and look at this challenge to their reputation!

Having an isolated reproducible example also allows quick verification that the fix solves the issue.


What does it mean for the "Holes in the swiss cheese to lineup"

The swiss cheese model comes from engineering disciplines and from studies of accidents that showed that many factors had to occur in order for the accident to occur.  The accident did not have one cause but several contributory causes, and if one cause did not occur the accident did not occur.

I see it occur with software.  For a bug to occur in production code, many factors have to occur in combination for the error to occur and the difficult thing is identify them.

Small test programs typically don't have all these factors in place or test every combination of them.

From the support desk we normally find acceptance of bugs due to many holes requiring to line up, after all we are software developers like you are.  It is the bug that does not have many holes to line up that leave us scratching our head as to what was missed.


What is a single stream of source?

It is an expression I use to discuss ISV's behaviour when it comes to maintaining similar products for many customers.

If an ISV has a single stream of source then differing behaviour for individual customers is achieved via flags, system variables, preferences.  The same 4gl source code is used by all customers.

These ISV's are able to react quicker and adapt to new syntax and functionality quicker than ISV's who do the opposite in that each customer has their own seperate 4gl source code.  For ISV's with multiple streams of source, any new syntax and functionality has to be repeated for each customer.


How many people read your articles?

Less than this guy! Reuben The Bulldog: Ask-Reuben


Why are there not many Genero questions in Stack Overflow?

If someone asks a Genero question in Stack Overflow that means they have not found the answer in

Our support model does not lend itself to developers asking questions in places like Stack Overflow as to do so implies an inability to find the answer in one of the above places first.


You like to give lots of links in your answers, why?

I try and use links to our documentation where possible as our documentation should be your primary source of information.  I like to think my style is similar to 538 (more from reading the sadly discontinued sports section rather than the political section)

I am also a great believer in the saying

Give a man a fish, you have fed him for a day.

Teach a man to fish, you have fed him for a lifetime.

By providing the link I like to think I am teaching you how to fish, rather than feeding you.