Re: Using OO to extend product written in C++ but no Uml diagrams exist

From: Daniel T. (postmaster_at_earthlink.net)
Date: 11/26/04


Date: Fri, 26 Nov 2004 14:32:48 GMT

jjhnospam@yahoo.co.uk (john harkin) wrote:

> Using UML as that is what modelling tool we are using supports and
> staff doing A/D will/could be different to implementors and theory is
> just hand over the model. The theory is great but getting to know a
> large codebase which is several years old to ensure doing it correctly
> without introdcing lots of bugs is different.

It sounds like someone with some political clout managed to get the
company to buy (buy into) some modeling tool and now developers are
expected to use it; whether it makes sense to or not...

Well, if you must use the tool then one thing you need to create a
model. Does the tool have any way to create a model based on existing
code? If so, use it. What you will end up with is a rather complicated
mess of a model because it will contain way too much detail. You then
must go through that mess and clean it up. This is mainly to appease the
manager ants.

What you really need to do is create a test harness. An automated tool
that can compare the output of your new code with the output of the
original code.

I suggest you get the books "Refactoring: Improving the Design of
Existing Code" and "Design Patterns". I'd like to suggest "Refactoring
to Patterns" but I haven't personally studied it.

What you need to do is remove duplication. If there are bits of code
that do the same thing to different object types, create an abstract
type and combine those bits of code. If you find more than one 'if' or
'switch' that make a decision based on the same information, then create
an abstract class that dispatches to the correct code without the 'if'
or 'switch'.



Relevant Pages

  • Re: Transaction Rollback and Object State
    ...  The object instances of my own classes. ... just switch on a parameter...you might want to ask in a database ...  Once I had to do a "snapshot" of a state of my objects in C#, ... Four famous book on design patterns for C#, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: abstract class overriding?
    ... I did use the "/server" switch because I ... thought that's what I was supposed to do to generate the server stubs. ... I saw that the tool generated an abstract class and methods, ... "Manohar Kamath" wrote: ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: switch
    ... Arne Vajhøj wrote: ... public Style GetStyle{ ... Can't I use a switch to check a type. ... an abstract class that has a method that does whatever ...
    (microsoft.public.dotnet.languages.csharp)