absurd APIs

Bug #592225 reported by Miika Komu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HIPL
New
Medium
Unassigned

Bug Description

DB: There are functions with a dozen parameters, some have even more.
It makes you laugh and cry at the same time...

MK: any way to shorten the manual inspection time?

Revision history for this message
Andrius Bentkus (toxedvirus) wrote :

Some references might to functions with dozens of parameters would help to understand the problem and would enable us to discuss it.

Revision history for this message
Diego Biurrun (diego-biurrun) wrote :

Just check out some of the header files, highlights are:

lib/core/builder.h
lib/core/hashtree.h
firewall/esp_prot_api.h
firewall/user_ipsec_sadb.h (hip_sadb_add() has 19 params!!)
hipd/keymat.h
hipd/user_ipsec_hipd_msg.h
hipd/user_ipsec_sadb_api.h

These are just the public functions, there are some really scary static ones as well...

Revision history for this message
Miika Komu (miika-iki) wrote :

What's the cut off point of having too many parameters? Multiple parameters could be input as a single structure which embeds all of the parameters. When adding more parameters, this would also cause less changes in the rest of the code.

Revision history for this message
Tobias Heer (heer) wrote :

A word of caution: Grouping parameters in structs only makes sense if these parameters are strongly related. Otherwise the function APIs will have less parameters but the same or higher complexity because absurd structs are used instead.

Sensible grouping, however, will definitely simplify things. Whoever addresses this problem should put some effort into selecting a very good grouping and good naming for it. Discussions here or on the list won't hurt.

Changed in hipl:
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.