Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Unit sharing in large similar projects

Posted on 1998-06-17
6
Medium Priority
?
240 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 300 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

704 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