27. Mai 2010 

4D is my tool of choice for creating company apps. No real contender concerning level of integration, options to scale, Mac and Windows with one source, … around anywhere yet.

Simple & Lazy

One advantage is being lazy. Being lazy while coding, being lazy while using, being lazy while adminstrating and being lazy while teaching how to use your company's app.

Nobody can be lazy without simplicity. More simple means more work in first place, conceptual work way long before coding.

The conceptual work invested pays twice at least:

  • simpler user-interface
  • simpler code underneath

I'm sort of feeling like mockup and wireframing is directly heading into complexity, not simplicity.

I'm not going to invent simple user-interfaces myself. I'm borrowing from those best at that, like Apple. Google is good at simplicity too, but with a technicians taste.

Partitioning the screen

There is a difference concerning data-lists and data-input. I'm concentrating on data-lists here.

Main windows are organized into 4 sections nowadays. On MacOS I call that the iTunes-interface. On Windows this is the Explorer-view, sort of because it's nearly hidden under complexity, clutter and ugliness.


That's what it looks like, when run:

  • search-field in the toparea,
  • main navigation on the left hand side,
  • main content area and
  • action-buttons below the main area.


The 4D form is simple, the objectcount is low:

  • 1 hierarchical list,
  • 1 listbox,
  • 11 buttons plus 2 DRAG WINDOW buttons,
  • 1 search-variable and
  • 2 display variables (green)
  • 1 static text, visible when search-variable is empty
  • 4 graphics (2 gray 1 black bar, 1 searchoval.
  • 1 splitter between hierarchical list and listbox
  • Number of formpages: 1.
  • Number of global methods: 1.
  • Number of scripts: 1 per object and those scripts only call the one global method.
Thats it. You mean the red rectangle? Yep unvisible by default, indicating formsize, developer tool only.

Stumbling stones

15 years ago, 4D struggled to get onto the windows platform. That worked finally. These days myself is struggling with the least common denominator which 4D, the company, is preferring to serve Windows and MacOS identically. That's poor choices – identically is bad for both platforms! I feel like being fixed to Windows XP and Jaguar on the userinterface-side of solution building – both a decade old UIs. Let's take the

Unified window

In V11 we don't have unified windows. Unified windows look that much better than brushed metal ever did. Brushed metal was introduced with iTunes 1 in 2001 and changed to better looking with every version of OSX and iTunes, starting with Panther (10.3). This picture is from NetNewsWire SnowLeopard, but you can look at any other modern app even the Finder. I'm not sure if and how V12 will serve any better.


It's of no use, creating the main window-components like the red, yellow, green-buttons top left myself. Neither is waiting for 4D – Panther-like tabs are new to V11, finally.


Help myself: faking a unified window with graphics. My graphic is vertically the same size as the true unified. Less height to compensate for the window titlebar makes the fake more obvious.

It's not that bad and much better than waiting for Xmas and easter falling on the same weekend.

Switching main content

No problem for list-forms. Switching on the fly even worked for array-based listboxes in V2004, even faster with selection-based ones in V11.

Switching the main content area without too many formpages is described and animated here. Window still displayed as window-title and tools area, not unified at all.

If I only could switch subforms on the fly, even input-forms would fit into that 4-area-scheme. AFAIK about V12 those new subforms are heading into that direction, sort of.


Clean coding

Sometime this century I changed my 4D-programming habits. That startet with text-only no strings ever, even for 1-char texts. Exception: string fields.

No integers anywhere, only longints. Good grief if only Selection to array would accept ([table]integerField;$longintArray).

No coding in object-methods nor inside form-methods. Only allowed code line is calling a global method like this
DBZ_Navigator ("FormMethod").

I can't omit global variables until local variables would display inside forms. That won't happen soon :-) So no life of global variables outside of the global method serving that form. If I need the global variables-content some other place: ask that global method for the content:
DBZ_Navigator ("Service_ModeGet";->$varContent)

For those global methods I'm down to 3 parameters:

  1. text-message what to do
  2. pointer to the object where to do and a
  3. longint as ID (record, arrayline, …)
Every parameter is optional. No parameter means the method is called from a menu or by hitting the run-botton on top of the methodwindow, which starts the process, another instance of the process or brings the already running process to the front.

Simple and lazy - not a bad combination at all

4D Themen: Berichte in Arbeit