> If there is a better way that doesn't require rewriting from
> scratch, then I am all ears.

Oh really? I gave you a suggestion 7.5 hours before this message was sent.
You complained:
> So all of that code would have to be rewritten
> if we made the FullName/Date readyonly

And I replied:
> I don't think anyone suggested that solution. The set()
> implementation can parse the long string into the real,
> internal fields with ease.

That's it. That's all there is to it. Just turn your implementation
inside-out.

More specifically (apologies for syntax; I'm used to C#):

You currently have one private field, a buffer _Line. Get rid of that.
Replace it with two strings, _Fname and _Lname.

Then
        Public Property FullNameFormatted() As String Implements
Name.FullName
            Get
                Return _Fname.Substr(10).PadRight(10) +
_Lname.Substr(10).PadRight(10)
            End Get
            Set(ByVal value As String)
                _Fname = Mid(_Line, 1, 10).Trim()
                _Lname = Mid(_Line, 11, 10).Trim()
            End Set
        End Property

        Public Readonly Property FullNameNatural() As String
            Get
                Return _Fname + " " + _Lname
            End Get
        End Property

        Public Property FirstName() As String Implements
Name.FirstName
            Get
                Return _Fname
            End Get
            Set(ByVal value As String)
                        _Fname = value
            End
        End Property

        Public Property LastName() As String Implements
Name.LastName
            Get
                Return _Lname
            End Get
            Set(ByVal value As String)
                        _Lname = value
            End
        End Property

Beyond this, consider reading up on OO as suggested, as your Class1 thing is
kinda weird (or maybe that's just due to being a Q&D sample). I also suggest
looking at "Design Patterns" by Gamma et al, particularly in this case for
the Factory patterns.
http://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Profess
ional/dp/0201633612

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to