[DUG] unit source code size
Leigh Wanstead
leighw at Softtech.co.nz
Mon Jul 5 16:54:37 NZST 2010
Hi Colin,
I am constantly refactoring code, but sometimes the form unit just grows bigger and bigger.
Regards
Leigh
-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On Behalf Of Colin Johnsun
Sent: Monday, 5 July 2010 4:39 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] unit source code size
Can you refactor your code?
See if you can break your classes or methods into smaller segments.
Depending upon your class relationship, can you reduce it to one class per unit?
If you have such large methods (200 lines seems like is a lot!), you
can break them up into smaller methods.
If it make sense, you could possibly extract a base class out of your
existing class and have that in another unit.
Or rather than extracting out a base class, you can make your classes
more coherent by redefining them based on their functionality. eg an
order class that maintains a list of order items, calculates their
totals and taxes and generates a printed invoice can be broken into
several smaller (but associated) classes - one for maintaining items,
one for calculating totals and taxes and another for printing
invoices.
Just a thought,
Colin
On 5 July 2010 13:50, Leigh Wanstead <leighw at softtech.co.nz> wrote:
> Good afternoon,
>
>
>
> I am facing a trouble. Some of the class I wrote reaches more than 1600
> lines. I don't like it. The methods in the class are ordinary range from one
> line to 200 lines. I really like each method sitting in their own unit.
> Just like abap in sap. It is easy to maintain 200 lines in a source code
> unit than 2000 lines.
>
>
>
> Without using include, what can I do?
>
>
>
> BTW, I don't understand why classes.pas in Delphi contain 11103 lines? Just
> to save Delphi programmer less uses clause?
>
>
>
> TIA
>
>
>
> Regards
>
> Leigh
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
More information about the Delphi
mailing list