OOP style



Just wonwdering what "real" programmers do... :)

Several questions:
1) If you have a form, and then some subsidiary dialog boxes, do you
create separate units for each of those dialogs, or do you make them as
panels (so thay they're all part of the same unit) that you then
display when needed?

2) If you have a procedure that is, say 200 lines long, do you break it
down in to more modular methods (Extract Method refactoring)? How do
you organize your unit if you have several "main" methods (like to
respond to a Save button, and a Load button, and a Preview button) and
a bunch of "helper" methods (if you have broken down your Save, Load,
and Preview methods)?

2.5) Is a Unit equivalent to a .java file in Java? Generally, do you
have one class per file? Some of the code I've seen seems to act as
though a unit is more like a package in Java (several classes stuck
together in a single file).

3) When you create a form, do you have a unit which simply validates
input, and does other UI sorts of things, and then a separate unit that
handles processing, like calculations, writing to the database, or
formatting for printing (Model-View pattern)?

I ask, because it seems to me that the way Delphi does things for you
seems to inhibit proper OOP style. Maybe it's just me, but I find
myself reverting back to my evil days of spaghetti code, and I feel
like I fight Delphi at almost every turn. Maintenance is becoming a
big issue for us, and it seems to me that OOP/refactoring/patterns
would help in that regard.

I'm more familiar with Java, and I've been picking up Delphi over the
last few months, and the other Delphi programmers I work with have kind
of picked it up too, so I don't have good OOP role models here :)

-Corinna

.



Relevant Pages

  • Re: OOP style
    ... > create separate units for each of those dialogs, or do you make them as ... > a bunch of "helper" methods (if you have broken down your Save, Load, ... > 2.5) Is a Unit equivalent to a .java file in Java? ... > like I fight Delphi at almost every turn. ...
    (comp.lang.pascal.delphi.misc)
  • Re: DotNet proponents trigger backlash by claiming it is always bestsolution
    ... In Borland's case, they want to sell Delphi licences, and upgrades. ... and make it harder for programmers that learned to program in VB6 to work later on really object oriented languages with strong typing.. ... There is a lot of comparisons with Java, except that this argument misses the point of Java. ... MSFT may have gone after java, ...
    (borland.public.delphi.non-technical)
  • Re: Turbo Delphi to include Java bytecode generator
    ... program into Java byte code. ... Turbo Delphi, ... new language means learning a handful of syntax rules, ... Java programmers are not going to turn into Delphi programmers just beacause ...
    (borland.public.delphi.non-technical)
  • Re: What Borland should stop wasting their time on
    ... > concept is pioneered by Delphi and Java. ... Not better than Delphi or VB6, ... C/C++ programmers have to integrate such code into their projects. ... as far I remember all windows program runs on virtual ...
    (borland.public.delphi.non-technical)
  • Re: .NET & Java(Not accurate Information).
    ... ..Delphi Programmers are earning even less.". ... Join Developer forums and include your opinion giving away segments of code ... > Here in Brazil Java still dominates,Delphi development is restrict to ...
    (borland.public.delphi.non-technical)