Solved

Unit sharing in large similar projects

Posted on 1998-06-17
6
232 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
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now