I have been working with Delphi since Delphi 5, on and off through the years. I have a few ides for making the code easier to read and I hope to hear some feedback.
I have been working with Delphi since Delphi 5, on and off through the years. I have a few ides for making the code easier to read and I hope to hear some feedback.
Delphi classes and records
Scope containment
Less Typing and, Easier to refactor ,Easier to read
Simple = record
private
fID : Integer;
function GetID:Integer;
procedure SetID(Vlaue:integer);
published
property ID : Integer read GetID write SetID;
implemented
Procedure GetID: Integer;
begin
result := fID;
end;
procedure SetID(Value : Integer);
begin
fID := Value;
end;
end;
Simple = class
private
fID : Integer;
function GetID:Integer;
procedure SetID(Vlaue:integer);
published
property ID : Integer read GetID write SetID;
implemented
Procedure GetID: Integer;
begin
result := fID;
end;
procedure SetID(Value : Integer);
begin
fID := Value;
end;
end;
I think the value of a for loop should be made available after a loop is completed. I have seen this requested before.
for iPos := 0 to high(myArray) do
if myArray[iPos] = Value then break;
yay i can use iPos
and last but not least
Case statement update
function SC(Value:integer):integer;
begin
Case SimpleCase of
1: inc(SC);
2: inc(SC);
3: inc(SC);
4: inc(SC);
5: inc(SC);
else
end;
end;
// sc(0) has now a value of 0
// sc(1) has now a value of 1
// sc(2) has now a value of 1
// sc(3) has now a value of 1
// sc(4) has now a value of 1
// sc(5) has now a value of 1
// sc(5) has now a value of 0
function SC(Value:integer):integer;
begin
// The Switch will allow the c type case statement
// Or just introduce switch
Case Switch SimpleCase of
1:
begin
inc(SC);
BreakCase; // I dont't know if an ordinary Break would work here
//as you might want to break out of a loop
end;
2: inc(SC);
3: inc(SC);
4: inc(SC);
5: inc(SC);
else
end;
end;
// sc(0) has now a value of 0
// sc(1) has now a value of 1
// sc(2) has now a value of 6
// sc(3) has now a value of 6
// sc(4) has now a value of 6
// sc(5) has now a value of 6
// sc(5) has now a value of 0
I think the greatest change is as follows... I love working in Delphi. Please make it more affordable for small part time developers, or it could end up a bit of a Dinosaur.
Delphi classes and records
Scope containment
Less Typing and, Easier to refactor ,Easier to read
Simple = record
private
fID : Integer;
function GetID:Integer;
procedure SetID(Vlaue:integer);
published
property ID : Integer read GetID write SetID;
implemented
Procedure GetID: Integer;
begin
result := fID;
end;
procedure SetID(Value : Integer);
begin
fID := Value;
end;
end;
Simple = class
private
fID : Integer;
function GetID:Integer;
procedure SetID(Vlaue:integer);
published
property ID : Integer read GetID write SetID;
implemented
Procedure GetID: Integer;
begin
result := fID;
end;
procedure SetID(Value : Integer);
begin
fID := Value;
end;
end;
I think the value of a for loop should be made available after a loop is completed. I have seen this requested before.
for iPos := 0 to high(myArray) do
if myArray[iPos] = Value then break;
yay i can use iPos
and last but not least
Case statement update
function SC(Value:integer):integer;
begin
Case SimpleCase of
1: inc(SC);
2: inc(SC);
3: inc(SC);
4: inc(SC);
5: inc(SC);
else
end;
end;
// sc(0) has now a value of 0
// sc(1) has now a value of 1
// sc(2) has now a value of 1
// sc(3) has now a value of 1
// sc(4) has now a value of 1
// sc(5) has now a value of 1
// sc(5) has now a value of 0
function SC(Value:integer):integer;
begin
// The Switch will allow the c type case statement
// Or just introduce switch
Case Switch SimpleCase of
1:
begin
inc(SC);
BreakCase; // I dont't know if an ordinary Break would work here
//as you might want to break out of a loop
end;
2: inc(SC);
3: inc(SC);
4: inc(SC);
5: inc(SC);
else
end;
end;
// sc(0) has now a value of 0
// sc(1) has now a value of 1
// sc(2) has now a value of 6
// sc(3) has now a value of 6
// sc(4) has now a value of 6
// sc(5) has now a value of 6
// sc(5) has now a value of 0
I think the greatest change is as follows... I love working in Delphi. Please make it more affordable for small part time developers, or it could end up a bit of a Dinosaur.
Bernard Duffin Are you using any 3d library or it is bare metal opengl ?
ReplyDeletejeff weir or as Lars Fosdal pointed, learn to love it as it is.
ReplyDeleteFabio Nascimento EWDraw 3D component for boolean. I am currently working on interfacing directly with opencascade.
ReplyDelete