ArticleslgStudy

computer science

Fragile binary interface problem

Fragile binary interface problem is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Fragile binary interface problem rather than just read about it. In short: The fragile binary interface problem or FBI is a shortcoming of certain object-oriented programming language compilers, in which internal changes to an underlying class library can cause descendant libraries or programs to cease working. It is an example of software brittleness.

Key takeaways

  • Fragile binary interface problem belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Fragile binary interface problem to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Fragile binary interface problem from memory before moving on to harder problems.

Reference excerpt

The fragile binary interface problem or FBI is a shortcoming of certain object-oriented programming language compilers, in which internal changes to an underlying class library can cause descendant libraries or programs to cease working. It is an example of software brittleness. This problem is more often called the fragile base class problem or FBC; however, that term has a wider sense.

Cause The problem occurs due to a "shortcut" used with compilers for many common object-oriented (OO) languages, a design feature that was kept when OO languages were evolving from earlier non-OO structured programming languages such as C and Pascal. In these languages there were no objects in the modern sense, but there was a similar construct known as a record (or "struct" in C) that held a variety of related information in one piece of memory. The parts within a particular record were accessed by keeping track of the starting location of the record, and knowing the offset from that starting point to the part in question. For instance a "person" record might have a first name, last name and middle initial, to access the initial the programmer writes thisPerson.middleInitial which the compiler turns into something like a = location(thisPerson) + offset(middleInitial). Modern CPUs typically include instructions for this common sort of access. When object-oriented language compilers were first being developed, much of the existing compiler technology was used, and objects were built on top of the record concept. In these languages the objects were referred to by their starting point, and their public data, known as "fields", were accessed through the known offset. In effect the only change was to add another field to the record, which is set to point to an immutable virtual method table for each class, such that the record describes both its data and methods (functions). When compiled, the offsets are used to access both the data and the code (via the virtual method table).

Symptoms This leads to a problem in larger programs when they are constructed from libraries. If the author of the library changes the size or layout of the public fields within the object, the offsets are now invalid and the program will no longer work. This is the FBI problem. Although changes in implementation may be expected to cause problems, the insidious thing about FBI is that nothing really changed, only the layout of the object that is hidden in a compiled library. One might expect that if one changes doSomething to doSomethingElse that it might cause a problem, but in this case one can cause problems without changing doSomething, it can be caused as easily as moving lines of source code around for clarity. Worse, the programmer has little or no control over the resulting layout generated by the compiler, making this problem almost completely hidden from view. In complex object-oriented programs or libraries the highest-level classes may be inheriting from tens of classes. Each of those base classes could be inherited by hundreds of other classes as well. These base classes are fragile because a small change to one of them could cause problems for any class that inherits from it, either directly or from another class that does. This can cause the library to collapse like a house of cards as many classes are damaged by one change to a base class. The problem may not be noticed when the modifications are being written if the inheritance tree is complex. Indeed, the developer modifying the base class is generally unaware of which classes, developed by others, are using it.

Solutions

Languages One solution to the fragile binary interface problem is to write a language that knows the problem exists, and does not let it happen in the first place. Most custom-written OO languages, as opposed to those evolved from earlier languages, construct all of their offset tables at load time. Changes to the layout of the library will be "noticed" at that point. Other OO languages, like Self, construct everything at runtime by copying and modifying the objects found in the libraries, and therefore do not really have a base class that can be fragile. Some languages, like Java, have extensive documentation on what changes are safe to make without causing FBI problems. Another solution is to write out an intermediate file listing the offsets and other information from the compile stage, known as meta-data. The linker then uses this information to correct itself when the library is loaded into an application. Platforms such as .NET do this. However, the market has selected programming languages such as C++ that are indeed "position dependent" and therefore exhibit FBI. In these cases there are still a number of solutions to the problem. One puts the burden on the library author by having them insert a number of "placeholder" objects in case they need to add additional functionality in the future (this can be seen in the structs used in the DirectX library). This solution works well until you run out of these dummies -- and you do not want to add too many because it takes up memory. Objective-C 2.0 provides non-fragile instance variables by having an extra level of indirection for instance variable access. Another partial solution is to use the Bridge pattern, sometimes known as "Pimpl" ("Pointer to implementation"). The Qt framework is an example of such an implementation. Each class defines only one data member, which is a pointer to the structure holding the implementation data. The size of the pointer itself is unlikely to change (for a given platform), so changing the implementation data does not affect the size of the public structure. However, this does not avoid other breaking changes such as introducing virtual methods to a class that has none, or changing the inheritance graph.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Fragile binary interface problem

Start with the simplest possible case. Write down what Fragile binary interface problem claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Fragile binary interface problem before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Fragile binary interface problem ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Fragile binary interface problem

In research
Fragile binary interface problem appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Fragile binary interface problem in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Fragile binary interface problem is common in secondary-school and first-year university syllabi. It links to neighbouring topics Software anomalies, Software bugs, so understanding it makes those chapters shorter.
In everyday life
Look for Fragile binary interface problem outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Fragile binary interface problem” →

How to study Fragile binary interface problem in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Fragile binary interface problem means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Fragile binary interface problem out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Fragile binary interface problem in simple terms?

The fragile binary interface problem or FBI is a shortcoming of certain object-oriented programming language compilers, in which internal changes to an underlying class library can cause descendant libraries or programs to cease working. It is an example of software brittleness.

Why does Fragile binary interface problem matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Fragile binary interface problem?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Fragile binary interface problem.

Tags

  • Software anomalies
  • Software bugs

Keep exploring