4D v14

Generic programming (without pointers)

Home

 
4D v14
Generic programming (without pointers)

Generic programming (without pointers)    


 

 


In addition to the manipulations explained in the video, you should also note that:

These exercises are set up to show one specific way doing things.

Depending on your own habits and the standards of your company, you may use different ways of organizing, of naming fields and variables, of establishing an order for passing parameters, and so on.
If you feel that another way is more suitable, try it out and compare its advantages and drawbacks. That way you can rely on your own experience.

A method can receive up to 32 parameters (from $1 to $32). However, it is unusual to use more than 7 or 8 parameters.

You should make liberal use of generic programming.

The next section covers the use of pointers, which complements what we will see here.

Generic programming also lets you reduce the length of your code by concentrating a series of functions within the same method where you pass several parameters.
To set up generic programming correctly, here are a few observations:

  • As soon as you write several lines of codes that are similar to previous ones, there is probably a generic solution that you can implement.
  • (Later on) when you hesitate to create a generic method: go ahead and do it, chances are you won't regret it!
  • Not everything can be generic. Sometimes trying to make things too generic may lead to a loss of productivity (code not easy to read, difficult to maintain, takes up too much memory, increased processing time, and so on),

 
 

 
PROPERTIES 

Product: 4D
Theme: Generic programming (without pointers)

 
ARTICLE USAGE

Self-training ( 4D v13)
Self-training ( 4D v14)