0
votes

In our team new programmers does not get access to all the source of our application. As long as they have to access program forms that depend only classes they can access the source, all is ok. When they have to use other classes from units they have only the .dcu, they get the F2051 error when the classes in the dcu change their interface.

Is there a clean way to get both ?

  • possibility to hide part of the source from new programmers
  • avoid the F2051 error when the classes in the "hidden" units change

I searched for a way to compile the Delphi code to a intermediate representation the way to hide the sources but to permit compilation, but I did not find anything.

3
This sounds like a great place to work. Where programmers aren't allowed to see the source code!David Heffernan
the DCU is the intermedaite representation you're looking for. You just have to update all the dcu's in programmers stations after interface changes. You can easily automate that.jachguate
@DavidHeffernan, Dilbert-esquely great place? ^-^Francesca
Why not allow them to see the source, just not commit any changes?Gerry Coll
Not showing new programmers the whole source code and expecting them to do anything other than be lost and confused forever seems dumb to me.Warren P

3 Answers

8
votes

You have to compile the code after the interface changes, and distribute the new .dcu to each programmer that needs to use it without source, and then they need to rebuild their applications. There is absolutely no other way to do it; the compiler requires it if there are changes in the interface.

4
votes

For those "hidden" units, put the .dcu in the source control along with the .pas and make sure they are updated and in sync.
The "authorized" developers will fetch the new .pas, while the underlings will only see and fetch the .dcu.

If you really want to go that route of having 2nd class programmers, you have to do the management work that go with it.

That being said I'm personally more often that not stepping into the VCL source code when chasing a bug and trying to understand what's going on.
And I really don't like not having it (like with some low level Delphi SKU)

1
votes

If you really want to create a stable binary unit that you can share with people you don't trust to read your source code, why don't you put the "secret" bits into a DLL and then load that DLL from the rest of the code.

It's called an "Application Binary Interface", either done natively with plain old pascal procedures exported from a DLL, or with COM Interfaces and a COM type-library.

Delphi has both DLL and BPL technology, to help you create something that isn't source code, but which has a stable ABI, and which will help you avoid whatever crazy little mess it sounds like you've got on your hands right now.