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 .NET you could use class fragments. .NET (including Prism - the new
Delphi for .NET) you can create bits' of a class in separate files.
This facility was afaik originally created to fix a shortcoming in .NET
which was the lack of separate resource files to store form designs (i.e. no
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
Hi Colin,
I am constantly refactoring code, but sometimes the form unit just grows bigger
and bigger.
Regards
Leigh
-Original Message-
From: delphi-boun...@delphi.org.nz [mailto:delphi-boun...@delphi.org.nz] On
Behalf Of Colin Johnsun
Sent: Monday, 5 July 2010 4:39 p.m.
To: NZ Borland
It sounds like there is far too much coupling between your classes, if
that is the case.
I am constantly refactoring code, but sometimes the form unit just grows
bigger and bigger.
Regards
Leigh
-Original Message-
From: delphi-boun...@delphi.org.nz
Form units should not usually have methods with 200+ lines.
Forms should have minimal processing, events typically consisting of a
handful of lines to invoke business logic on business objects and update the
UI according to any response.
There is rarely a 1:1 relationship between any one form
Hi Leigh,
On 5 July 2010 14:54, Leigh Wanstead lei...@softtech.co.nz wrote:
Hi Colin,
I am constantly refactoring code, but sometimes the form unit just grows
bigger and bigger.
Regards
Leigh
-Original Message-
The amount of code shouldn't bother you. What matters is that the
I am using topgrid. It needs to handle different logic based on which column
tsGrid.CurrentCell.DataCol user keyed for KeyDown events. May I ask how to
separate the logic to a class?
Let's say I have ten columns for that grid. I can use case or if statement, but
still it is more than 30 lines
What do the columns represent in your business logic?
Are you handling every event on every column?
I am using topgrid. It needs to handle different logic based on which column
tsGrid.CurrentCell.DataCol user keyed for KeyDown events. May I ask how to
separate the logic to a class?
Let's