Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is interface bloat?

Can someone explain to me what interface bloat in OOP is (preferably with an example).

like image 703
Aly Avatar asked Nov 30 '22 11:11

Aly


2 Answers

G'day,

Assuming you mean API and not GUI, for me I/F bloat can happen in several ways.

  1. An API just keeps getting extended and extended with new functions without any form of segregation so you finish up with a monolithic header file that becomes hard to use.
  2. The functions declared in an existing API keep getting new parameters added to their signatures so you have to keep upgrading and your existing applications are not backwards compatible.
  3. Functions in an existing API keep getting overloaded with very similar variants which can lead to difficulty selecting the relevant function to be used.

To help with this you can:

  1. Separate out the API into a series of headers and libraries so you can more easily control what parts you actually need. Any internal dependencies should be resolved automatically by the vendor so the user doesn't have to find out the dependencies by trial and error, e.g. that I need to include header file wibble.h when I only wanted to use the functions in the API declared in the shozbot.h header file.
  2. Make upgrades to the API backwards compatible by introducing overloading where applicable. But you should group the overloaded functions into categpories, e.g. if new set of overloaded functions are added to an existing API, say our_api.h, to adapt it to a new technology, say SOA, then they are provided separately in their own header file our_api_soa.h in addition to the existing header our_api.h.

HTH

like image 179
Rob Wells Avatar answered Dec 04 '22 12:12

Rob Wells


Think of an OO language where all methods are defined in Object, even though they are only meaningful for some subclasses. That would be the most extreme example.

like image 44
akuhn Avatar answered Dec 04 '22 11:12

akuhn