[Gambas-user] Debugging with libraries

Tobias Boege taboege at ...626...
Tue Feb 2 12:31:29 CET 2016


On Tue, 02 Feb 2016, Christof Thalhofer wrote:
> Hi,
> 
> Am 02.02.2016 um 00:12 schrieb Tobias Boege:
> 
> > now that I use a library in my projects, I noticed that debugging these
> > projects is sufficiently harder. E.g. if a call into the library raises
> > an error, I cannot display local variables and have basically to resort
> > to Debug statements in the library.
> 
> I develop the classes first inside the project where I use them, when
> they are stable they will be moved into the external lib. There I write
> testcode to test their functionality that I can execute inside the
> lib-project if I have changed anything.
> 
> To debug the lib inside your project you can copy all classes of the lib
> to a subfolder of your main project, switch the lib off and debug like
> usual. When done, copy them back, recompile the lib and include it again
> in the main project.
> 

Pffff, sounds error-prone if *I* had to do it -- and not the nice kind of
error but the bad kind where you permanently lose files or forget that you
have still old copies of library sources in some project and wonder why the
code crashes. If I have to mess with the source trees anyway, I guess this
suits me better:

  - In all projects which use the library:
     - Remove the library dependence,
     - Symlink to the library source into .src,
     - Add the components needed by the library sources,
  - Until satisfied:
     - Change library from one project,
     - Check that other projects using the library don't break,
  - Again in all projects which use the library:
     - Remove symlinks,
     - Remove unnecessary components,
     - Enter library as dependence.

The benefits being that nothing needs to be copied and the library is
updated in every project that uses it, so the changes can be checked
against quickly.

The problem with this project is that I deliberately didn't overthink the
interfaces beforehand. I still think this was a good choice because I had
something usable after a month. Now that I extend the library, I have to
gradually rewrite portions of it, including interfaces and whole class
designs, and check against other projects using the library. That's maybe
a different workflow than you have, e.g. there is no notion of "stable"
class in my library.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list