Finding orphaned code automatically

Discussion forum about all things Team Developer 7.x
gaiflo
Germany
Posts: 20
Joined: 29 Oct 2019, 12:00
Location: Berlin

Finding orphaned code automatically

Post by gaiflo » 07 Nov 2019, 13:11

So i gotta find unused code in our applications.
First i thought that i'd go through all the apls, classes and windows to get all names of declared functions. Then go through all of the Actionblocks and look if any of the names of the declared functions are being called. Then report the ones that are never called anywhere. That's how i would find orphaned code.

But i googled and found some websites with advertisement of TeamDeveloper where it stated that TD contains a orphaned code tool. Where do i find this and how do i use it? I can't find any usages of this tool online or anywhere else...

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1358
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Finding orphaned code automatically

Post by Dave Rabelink » 08 Nov 2019, 11:10

I'm not aware of any such tool for TD.
Maybe IceTea group offered something in the past. (anyone?)

I created some CDK tools in the past which I use sometimes, but they are far from perfect.

The first action would be to remove unused libraries from a project. These orphaned libraries carry in a lot of unused code.
Try to traverse the include tree from bottom to up and remove libraries to see if they compile on their own and in the entire project as a whole.
In an old project I could reduce the total number of libraries from 1400 to about 900.
But it was a hell to do. But resulted in smaller binaries and faster compile times.

It would be great if TD would offer such tooling out-of-the-box.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

aspurga
Lithuania
Posts: 68
Joined: 06 Mar 2017, 08:54
Location: Lithuania

Re: Finding orphaned code automatically

Post by aspurga » 08 Nov 2019, 12:19

Hi,

TD .NET has a option to analyze orphaned code. It requires manually to go throught all functions, constants, variables and etc. Not very helpfull.
You do not have the required permissions to view the files attached to this post.

Acclaro
Germany
Posts: 67
Joined: 16 Mar 2017, 08:13
Location: Hannover, Deutschland

Re: Finding orphaned code automatically

Post by Acclaro » 09 Nov 2019, 12:44

Hi,

the tool from iceteagroup was called Dr. Livingstone it is still available and (now ) free
but it only works for TD version up to 4.2

http://www.iceteagroup.com/ppj-downloads/

I'm still crying behind :cry: ... it was really great

Maybe OT should have a look on it to see professional features once availabe by third party and now still missing :idea:


Introduction from Dr. Livingstone help file:

Know the Who-is-who of your Team Developer Application without browsing manually through tons of code!
Dr. Livingstone explores your program and tells you exactly where your variables and classes come from, where they've been, and where they go to.
Information at your fingertips, just a click away.

Dr. Livingstone is a powerful extension to Gupta's Team Developer.
It scans the source code and detects all variables, functions, and classes and displays them in a nicely integrated dockable set of windows. From there a simple click brings you to the declarations or to the statements that use them.

This makes it possible to get answers to questions such as:
· Where is a certain variable used?
· Where is a specific variable modified i.e. assigned or passed as a receive parameter?
· What functions are called by a given function?
· From where is a certain function called?
· What classes are derived from a given class?
· What are the base classes of a certain class?
· Where are instances of a functional class created e.g. anUdv = new MyClass?
· Where are variables of a functional class declared?
· Where are instances of window classed declared?

As an extra bonus Dr. Livingstone also offers the possibility to:
· Rename a symbol e.g. change the name of a function and all calls to that function will be renamed automatically
· Show all unreferenced symbols within a section e.g. show all unreferenced parameters in a function or show all unreferenced symbols within the entire application
· Remove all unreferenced symbols in the application, all unreferenced symbol of a certain type e.g. internal functions or only the ones selected by the developer

--------------------------------------------------------------------------------

Copyright © 2007 by Ice Tea Group, L.L.C. and Johan Alm
Author: Johan Alm

gaiflo
Germany
Posts: 20
Joined: 29 Oct 2019, 12:00
Location: Berlin

Re: Finding orphaned code automatically

Post by gaiflo » 11 Nov 2019, 09:00

First thanks for all your answers. Seems like i have to write my own Analyzer. Would be cool as hell to do that with C# but i could't find a wrapper around the C++ library altough i found someone mentioning that he was trying to do that. Never found any libs or code though....
Dave Rabelink wrote:
08 Nov 2019, 11:10
I created some CDK tools in the past which I use sometimes, but they are far from perfect
Would you be allowed or willing to share these? Maybe i could reuse some of your code (#

Dave Rabelink wrote:
08 Nov 2019, 11:10
It would be great if TD would offer such tooling out-of-the-box.
Hell YEAH! I really don't understand why tools like these don't come out-of-the-box....

@Aspurga: Thanks but yeah - seems like that "analyzer" is not very helpful in an automated environment -.-

Return to “General Discussion”

Who is online

Users browsing this forum: [SiteExplorer] and 0 guests