Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 07/08/19 in all areas

  1. Bill Meyer

    How do you organize units, forms?

    In my own code, and in code which I inherit from other sources, I like to use MMX to sort classes. Unfortunately, I work with a good deal of legacy code which is in source control, and applying class sorting would wreak havoc there.
  2. PeterBelow

    How do you organize units, forms?

    I did something similar in the past but have stopped since it does not work that well if you let the IDE's code completion or a tool like Modelmaker Code Explorer (which I simply cannot live without) create the methods for you. I find it more useful to stick to a good naming convention for methods and event handlers and also use MMX or the structure view to navigate around a unit.
  3. dummzeuch

    How do you organize units, forms?

    One of the first things I do is delete those annoying comments the IDE inserts: Private/Protected etc. declarations. Apart from that I sometimes use the GExperts sort expert to sort the methods inside a section alphabetically. But normally I just let the IDE put them in whatever order it uses.
  4. WillH

    Funny Code in System.Types

    Are Emba doing any unit testing? Clearly, either this isn't tested or isn't sufficiently tested. Is any of the RTL being unit tested?
  5. Bill Meyer

    How do you organize units, forms?

    Agreed. And it can be sorely tempting in that legacy code, especially in a class which is painfully large and ought to be refactored. But working in a group, it would be pretty hostile to apply the sort. 😉
  6. Sherlock

    How do you organize units, forms?

    Amen! Anyway, sorting is just something that pleases the eyes. I only keep the methods sorted within their classes. Anything else I find via Ctrl+f or Shift+Alt+s.
  7. PeterBelow

    redefined anonymous method - bug or my mistake?

    Well, TRunner.TCallback is closer in scope, so I would expect the compiler to use it instead of the global TCallback, so that does look like a bug. Should be easy enough to work around, though, just specify TRunner.TCallback as type for the property and its field. Of course it's a bit problematic to have this kind of nameing conflict in the first place, not (only) for the compiler but also for a programmer trying to make sense of the code 😉. Delphi 10.3 Version 26.0.33219.4899 still shows this behaviour, by the way.
  8. Edwin Yip

    How do you organize units, forms?

    Agree with @PeterBelow, good naming conventions + GExpert's Procedure List (or CNPack's counterpart) + MMX are enough to achieve quick method navigation.
  9. Found today in System.Types........ class operator TPoint.Explicit(Value: TPoint): TSmallPoint; begin if Value.x < Low(SmallInt) then Result.x := Low(SmallInt) else if Value.x > High(SmallInt) then Result.x := High(SmallInt) else Result.x := SmallInt(Result.x); if Value.y < Low(SmallInt) then Result.y := Low(SmallInt) else if Value.y > High(SmallInt) then Result.y := High(SmallInt) else Result.y := SmallInt(Result.y); end; Useless and wrong Code...
×