<s>
The	O
fragile	B-Error_Name
binary	I-Error_Name
interface	I-Error_Name
problem	I-Error_Name
or	O
FBI	O
is	O
a	O
shortcoming	O
of	O
certain	O
object-oriented	B-Language
programming	I-Language
language	I-Language
compilers	B-Language
,	O
in	O
which	O
internal	O
changes	O
to	O
an	O
underlying	O
class	O
library	O
can	O
cause	O
descendant	O
libraries	B-Library
or	O
programs	B-Application
to	O
cease	O
working	O
.	O
</s>
<s>
This	O
problem	O
is	O
more	O
often	O
called	O
the	O
fragile	B-Application
base	I-Application
class	I-Application
problem	I-Application
or	O
FBC	O
;	O
however	O
,	O
that	O
term	O
has	O
a	O
wider	O
sense	O
.	O
</s>
<s>
The	O
problem	O
occurs	O
due	O
to	O
a	O
"	O
shortcut	O
"	O
used	O
with	O
compilers	B-Language
for	O
many	O
common	O
object-oriented	B-Language
(	O
OO	O
)	O
languages	O
,	O
a	O
design	O
feature	O
that	O
was	O
kept	O
when	O
OO	O
languages	O
were	O
evolving	O
from	O
earlier	O
non-OO	O
structured	B-Language
programming	I-Language
languages	O
such	O
as	O
C	B-Language
and	O
Pascal	B-Application
.	O
</s>
<s>
In	O
these	O
languages	O
there	O
were	O
no	O
objects	O
in	O
the	O
modern	O
sense	O
,	O
but	O
there	O
was	O
a	O
similar	O
construct	O
known	O
as	O
a	O
record	O
(	O
or	O
"	O
struct	O
"	O
in	O
C	B-Language
)	O
that	O
held	O
a	O
variety	O
of	O
related	O
information	O
in	O
one	O
piece	O
of	O
memory	O
.	O
</s>
<s>
The	O
parts	O
within	O
a	O
particular	O
record	O
were	O
accessed	O
by	O
keeping	O
track	O
of	O
the	O
starting	O
location	O
of	O
the	O
record	O
,	O
and	O
knowing	O
the	O
offset	B-General_Concept
from	O
that	O
starting	O
point	O
to	O
the	O
part	O
in	O
question	O
.	O
</s>
<s>
For	O
instance	O
a	O
"	O
person	O
"	O
record	O
might	O
have	O
a	O
first	O
name	O
,	O
last	O
name	O
and	O
middle	O
initial	O
,	O
to	O
access	O
the	O
initial	O
the	O
programmer	O
writes	O
thisPerson.middleInitial	O
which	O
the	O
compiler	B-Language
turns	O
into	O
something	O
like	O
a	O
=	O
location(thisPerson )	O
+	O
offset(middleInitial )	O
.	O
</s>
<s>
When	O
object-oriented	B-Language
language	I-Language
compilers	B-Language
were	O
first	O
being	O
developed	O
,	O
much	O
of	O
the	O
existing	O
compiler	B-Language
technology	O
was	O
used	O
,	O
and	O
objects	O
were	O
built	O
on	O
top	O
of	O
the	O
record	O
concept	O
.	O
</s>
<s>
In	O
these	O
languages	O
the	O
objects	O
were	O
referred	O
to	O
by	O
their	O
starting	O
point	O
,	O
and	O
their	O
public	O
data	O
,	O
known	O
as	O
"	O
fields	O
"	O
,	O
were	O
accessed	O
through	O
the	O
known	O
offset	B-General_Concept
.	O
</s>
<s>
In	O
effect	O
the	O
only	O
change	O
was	O
to	O
add	O
another	O
field	O
to	O
the	O
record	O
,	O
which	O
is	O
set	O
to	O
point	O
to	O
an	O
immutable	O
virtual	B-Language
method	I-Language
table	I-Language
for	O
each	O
class	O
,	O
such	O
that	O
the	O
record	O
describes	O
both	O
its	O
data	O
and	O
methods	O
(	O
functions	O
)	O
.	O
</s>
<s>
When	O
compiled	B-Language
,	O
the	O
offsets	B-General_Concept
are	O
used	O
to	O
access	O
both	O
the	O
data	O
and	O
the	O
code	O
(	O
via	O
the	O
virtual	B-Language
method	I-Language
table	I-Language
)	O
.	O
</s>
<s>
This	O
leads	O
to	O
a	O
problem	O
in	O
larger	O
programs	B-Application
when	O
they	O
are	O
constructed	O
from	O
libraries	B-Library
.	O
</s>
<s>
If	O
the	O
author	O
of	O
the	O
library	O
changes	O
the	O
size	O
or	O
layout	O
of	O
the	O
public	O
fields	O
within	O
the	O
object	O
,	O
the	O
offsets	B-General_Concept
are	O
now	O
invalid	O
and	O
the	O
program	O
will	O
no	O
longer	O
work	O
.	O
</s>
<s>
Although	O
changes	O
in	O
implementation	O
may	O
be	O
expected	O
to	O
cause	O
problems	O
,	O
the	O
insidious	O
thing	O
about	O
FBI	O
is	O
that	O
nothing	O
really	O
changed	O
,	O
only	O
the	O
layout	O
of	O
the	O
object	O
that	O
is	O
hidden	O
in	O
a	O
compiled	B-Language
library	O
.	O
</s>
<s>
Worse	O
,	O
the	O
programmer	O
has	O
little	O
or	O
no	O
control	O
over	O
the	O
resulting	O
layout	O
generated	O
by	O
the	O
compiler	B-Language
,	O
making	O
this	O
problem	O
almost	O
completely	O
hidden	O
from	O
view	O
.	O
</s>
<s>
In	O
complex	O
object-oriented	B-Language
programs	B-Application
or	O
libraries	B-Library
the	O
highest-level	O
classes	O
may	O
be	O
inheriting	O
from	O
tens	O
of	O
classes	O
.	O
</s>
<s>
One	O
solution	O
to	O
the	O
fragile	B-Error_Name
binary	I-Error_Name
interface	I-Error_Name
problem	I-Error_Name
is	O
to	O
write	O
a	O
language	O
that	O
knows	O
the	O
problem	O
exists	O
,	O
and	O
does	O
not	O
let	O
it	O
happen	O
in	O
the	O
first	O
place	O
.	O
</s>
<s>
Most	O
custom-written	O
OO	O
languages	O
,	O
as	O
opposed	O
to	O
those	O
evolved	O
from	O
earlier	O
languages	O
,	O
construct	O
all	O
of	O
their	O
offset	B-General_Concept
tables	O
at	O
load	O
time	O
.	O
</s>
<s>
Other	O
OO	O
languages	O
,	O
like	O
Self	B-Operating_System
,	O
construct	O
everything	O
at	O
runtime	O
by	O
copying	O
and	O
modifying	O
the	O
objects	O
found	O
in	O
the	O
libraries	B-Library
,	O
and	O
therefore	O
do	O
not	O
really	O
have	O
a	O
base	O
class	O
that	O
can	O
be	O
fragile	O
.	O
</s>
<s>
Some	O
languages	O
,	O
like	O
Java	B-Language
,	O
have	O
extensive	O
documentation	O
on	O
what	O
changes	O
are	O
safe	O
to	O
make	O
without	O
causing	O
FBI	O
problems	O
.	O
</s>
<s>
Another	O
solution	O
is	O
to	O
write	O
out	O
an	O
intermediate	O
file	O
listing	O
the	O
offsets	B-General_Concept
and	O
other	O
information	O
from	O
the	O
compile	B-Language
stage	O
,	O
known	O
as	O
meta-data	O
.	O
</s>
<s>
However	O
,	O
the	O
market	O
has	O
selected	O
programming	O
languages	O
such	O
as	O
C++	B-Language
that	O
are	O
indeed	O
"	O
position	O
dependent	O
"	O
and	O
therefore	O
exhibit	O
FBI	O
.	O
</s>
<s>
One	O
puts	O
the	O
burden	O
on	O
the	O
library	O
author	O
by	O
having	O
them	O
insert	O
a	O
number	O
of	O
"	O
placeholder	O
"	O
objects	O
in	O
case	O
they	O
need	O
to	O
add	O
additional	O
functionality	O
in	O
the	O
future	O
(	O
this	O
can	O
be	O
seen	O
in	O
the	O
structs	O
used	O
in	O
the	O
DirectX	B-Application
library	O
)	O
.	O
</s>
<s>
Objective-C	B-Language
2.0	O
provides	O
non-fragile	O
instance	O
variables	O
by	O
having	O
an	O
extra	O
level	O
of	O
indirection	O
for	O
instance	O
variable	O
access	O
.	O
</s>
<s>
Another	O
partial	O
solution	O
is	O
to	O
use	O
the	O
Bridge	B-Language
pattern	I-Language
,	O
sometimes	O
known	O
as	O
"	O
Pimpl	O
"	O
(	O
"	O
Pointer	O
to	O
implementation	O
"	O
)	O
.	O
</s>
<s>
The	O
Qt	B-Language
framework	I-Language
is	O
an	O
example	O
of	O
such	O
an	O
implementation	O
.	O
</s>
<s>
However	O
,	O
this	O
does	O
not	O
avoid	O
other	O
breaking	O
changes	O
such	O
as	O
introducing	O
virtual	B-Application
methods	I-Application
to	O
a	O
class	O
that	O
has	O
none	O
,	O
or	O
changing	O
the	O
inheritance	O
graph	O
.	O
</s>
<s>
In	O
the	O
original	O
version	O
of	O
Objective-C	B-Language
,	O
the	O
library	O
format	O
allowed	O
for	O
multiple	O
versions	O
of	O
one	O
library	O
and	O
included	O
some	O
functionality	O
for	O
selecting	O
the	O
proper	O
library	O
when	O
called	O
.	O
</s>
<s>
However	O
this	O
was	O
not	O
always	O
needed	O
because	O
the	O
offsets	B-General_Concept
were	O
only	O
needed	O
for	O
fields	O
,	O
since	O
methods	O
offsets	B-General_Concept
were	O
collected	O
at	O
runtime	O
and	O
could	O
not	O
cause	O
FBI	O
.	O
</s>
<s>
Since	O
methods	O
tend	O
to	O
change	O
more	O
often	O
than	O
fields	O
,	O
ObjC	B-Language
had	O
few	O
FBI	O
problems	O
in	O
the	O
first	O
place	O
,	O
and	O
those	O
it	O
did	O
could	O
be	O
corrected	O
with	O
the	O
versioning	O
system	O
.	O
</s>
<s>
Objective-C	B-Language
2.0	O
added	O
a	O
"	O
modern	O
runtime	O
"	O
which	O
solved	O
the	O
FBI	O
problem	O
for	O
fields	O
as	O
well	O
.	O
</s>
<s>
Additionally	O
,	O
the	O
TOM	O
language	O
uses	O
runtime	O
collected	O
offsets	B-General_Concept
for	O
everything	O
,	O
making	O
FBI	O
impossible	O
.	O
</s>
<s>
Using	O
static	O
instead	O
of	O
dynamic	O
libraries	B-Library
where	O
possible	O
is	O
another	O
solution	O
,	O
as	O
the	O
library	O
then	O
cannot	O
be	O
modified	O
without	O
also	O
recompiling	O
the	O
application	O
and	O
updating	O
the	O
offsets	B-General_Concept
it	O
uses	O
.	O
</s>
<s>
However	O
static	O
libraries	B-Library
have	O
serious	O
problems	O
of	O
their	O
own	O
,	O
such	O
as	O
a	O
larger	O
binary	O
and	O
the	O
inability	O
to	O
use	O
newer	O
versions	O
of	O
the	O
library	O
"	O
automatically	O
"	O
as	O
they	O
are	O
introduced	O
.	O
</s>
<s>
In	O
these	O
languages	O
the	O
problem	O
is	O
lessened	O
by	O
enforcing	O
single	O
inheritance	O
(	O
as	O
this	O
reduces	O
the	O
complexity	O
of	O
the	O
inheritance	O
tree	O
)	O
,	O
and	O
by	O
the	O
use	O
of	O
interfaces	B-Application
instead	O
of	O
base	O
classes	O
with	O
virtual	B-Application
functions	I-Application
,	O
as	O
interfaces	B-Application
themselves	O
do	O
not	O
contain	O
code	O
,	O
only	O
a	O
guarantee	O
that	O
each	O
method	O
signature	O
the	O
interface	O
declares	O
will	O
be	O
supported	O
by	O
every	O
object	O
that	O
implements	O
the	O
interface	O
.	O
</s>
<s>
The	O
whole	O
problem	O
collapses	O
if	O
the	O
source	O
code	O
of	O
the	O
libraries	B-Library
is	O
available	O
.	O
</s>
