Solved

Unit sharing in large similar projects

Posted on 1998-06-17
6
235 Views
Last Modified: 2010-04-04
Hello everyone,

I am currently working on two projects with a lot (say 100) units. The projects are very much the same; therefore a lot of units are excatly the same. Different people work on the projects and the up-to-date source of all projects is never on one machine.

At this moment we work with two copies of the units that are the same. Every now and then I scan the two sources for differences. The two projects have the same name.

How can I determine wether a unit can be put into a shared directory and be used by both projects. What unit dependancies are allowed for this type of sharing sharing. Ideally the shared units are only compiled once for both projects. All types of unit dependencies are used in the projects.

So there are a number of cases that are distinguishable:

- candidate unit uses a project unit in the interface section
- candidate unit uses a project unit in the implementaion section
- candidate unit is used in a project unit in the interface section
- candiadte unit is used in a project unit in the implementation section

note: the units in both projects which are in the uses clause the candidate units have the same filename.

I have experimented a bit with this but am not sure yet which units to include in this sharing. I have seen strange behaviour: units not being recomplied while I expected they would be.

I hope to solve this problem soon. Maybe some people have experience with multiple similar projects and sharing units.

Regards Jacco
0
Comment
Question by:Jacco
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Expert Comment

by:pjdb
ID: 1353375
Put the share untis in one folder and then add this folder in the default path for Delphi (Tools / Options / Library / Path) So that Delphi will find them. I'm doing this every day for some extension i've made to the delphi default functions and proc. These units are used either in the implementation or interface section.

I've never tryed to do so for unit that are using some units specific to the project. However, but you can specify a file (from the project directory) the be included in all file with
{$I Specification.pas}
in this file, you define your project with {$Define MyProject} and then, you will be able to define specific code (for the uses clause for example) in any unit by using
{$IfDef MyProject}
  <come code for this project>
{$Else}
  <some code all other projects>
{$EndIf}
Those {$<..>} command are used by the compiler to determine if he have to compile the lines or not. Specific code will not raise errors even if it's some meaningless stuuf if the current case
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1353376
Unless you have got particular requirements, a very common way is making dll's of those units, so to get rid of duplication at all. This also allowes modification of the shared code with no need to recompile the project source.

Regards, julio
0
 
LVL 3

Expert Comment

by:rickpet
ID: 1353377
I would look into going to packages...place all your shared units into packages...

You should also consider getting a version control software...
We use PVCS by Intersolv.  If money is an issue look at http://www.surehand.com/vcspro.htm this was originally written by Dr. Bob


Rick
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:Marcius
ID: 1353378
I agree with Rick, but would go one step further. Why don't you created components out of your units ? In the place where I am currently working, we are developing a LARGE billing system and are using components for the whole thing. The main form is essentially just a collection of tab pages etc onto which the components will be dropped. It works well.

Marc
0
 
LVL 3

Accepted Solution

by:
altena earned 100 total points
ID: 1353379
a source conrol system is definitely the way to go.

Use PVCS or Visual sourcesafe. The investment will pay
itself back in no time. The amount of time you guys must
be loosing now with those scans and backups. brrrr

Basically what you get is:
- everybody uses the same file, changes are propagated automatically.
- You can see who changed what where and why.
- You can roll back to any version.

and a last comment: I am suprised to see that people are still building "large" (100 units) systems without a source control system.
0
 
LVL 10

Author Comment

by:Jacco
ID: 1353380
Thank you all for responding.

I don't know what the rules are about the score distribution. Fair would be to give you all a share of the 100 I offered.

All options given sound good !

1) We will consider a PVCS for the managing of the modules.
2) We will build the most commom dialogs into a DLL
   (I don't know how to implement form inheritance through a DLL
    trying is the best I guess)
3) Custom components are already widely used, but I think the
   use for a component is primarily visual/non visual
   encapsulation of something. At most one TForm (like the
   dialogs).
4) The {$I ....}  and {$DEFINE etc are useful for the utility
   units.

Again thank you all.

Regards Jacco

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question