Re: My First C# (warning - long post)
- From: "Pete Dashwood" <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 9 Feb 2007 11:56:29 +1300
"andrewmcdonagh" <andrewmcdonagh@xxxxxxxxx> wrote in message
news:1170954277.185118.185740@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Feb 8, 1:27 am, LX-i <lxi0...@xxxxxxxxxxxx> wrote:
snipped...
That's definitely what I was looking for. :) Thanks again for breaking
it down for me.
My pleasure...
(Did you look at the "second C#" post - and if so, does it look like I'm
on the right track?)
I've given it a quick scan but will need to have another look before
commenting. Might be worth while you posting an update ...but if we
can keep it in this thread, it will help keep the topic focused and
together.
The one main OO design point that you should eventually spot from
where I'm taking you, is that numerous small classes with a single
responsibility, when working together, can create a very simple but
powerful design, with lots of code reuse.
As a top of head metric, my designs tend to consist of 40% of classes
containing a single method, which is no longer than a dozen lines of
code. Another 55% would contain at most 6 methods, with the remaining
5% of classes having more than 6 methods.
The 95% classes would having methods of no more than a dozen lines
and all hold onto the **Single Responsibility Principle. The last 5%
would be 'dodgy' and need refactoring...but then lifes too short and
we do have to actually ship stuff!
Regards
Andrew
** Single Responsibility Principle - http://www.objectmentor.com/
resources/articles/srp.pdf
I can't tell you what a relief it was to read these articles :-)
For some time now I have been trying to explain that an OO approach removes
the need for source code maintenance in the traditional sense. Classes and
methods should be encapsulated and "do what they do". When change is
required it should be new interfaces or extensions and NOT an internal
change to already working code. Apart from the obvious benefit of NOT
requiring regression testing, this approach also simplifies maintaining
applications. I came to learn this by working with COM component development
over a number of years.
Most people here, coming from a procedural background where the whole point
of good coding practice is to ensure that source code is easily maintained,
and one of the reasons for using COBOL in the first place is its
"self-documenting" nature, simply thought I was crazy.
Write applications then don't change the code? Impossible!
Of course, it isn't impossible and I've been doing it for some years now. I
see it as one of the most compelling arguments for using OO.
After a number of clumsy attempts to explain myself, I simply gave up...
It's like trying to explain the concept of "red" to a person who has been
blind since birth...
I have never studied the computer science covered in these articles, but
arrived at the same conclusions just by empirical practice.
This is the first tme I have seen some of the things I know innately,
expressed in a tangible and easily assimilable form. OK, there is a heap of
new jargon and acronyms, but the pure light of the underlying principles
shines through like a beacon.
I strongly recommend any COBOL programmer who is labouring under the burden
of heavy regression testing to at least browse the first article. (I
especially liked his description of "software rot" and what causes it :-))
Here is a direct link:
http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf
For me, the quote of the week is:
"The Open Closed Principle (OCP)
A module should be open for extension but closed for modification.
Of all the principles of object oriented design, this is the most important.
It originated
from the work of Bertrand Meyer. It means simply this: We should write our
modules
so that they can be extended, without requiring them to be modified. In
other
words, we want to be able to change what the modules do, without changing
the
source code of the modules."
Now, I wish I'd thought of that... :-)
Pete.
.
- Follow-Ups:
- Re: My First C# (warning - long post)
- From: Howard Brazee
- Re: My First C# (warning - long post)
- From: andrewmcdonagh
- Re: My First C# (warning - long post)
- From: William M. Klein
- Re: My First C# (warning - long post)
- From: andrewmcdonagh
- Re: My First C# (warning - long post)
- References:
- Re: My First C# (warning - long post)
- From: LX-i
- Re: My First C# (warning - long post)
- From: andrewmcdonagh
- Re: My First C# (warning - long post)
- From: LX-i
- Re: My First C# (warning - long post)
- From: andrewmcdonagh
- Re: My First C# (warning - long post)
- From: LX-i
- Re: My First C# (warning - long post)
- From: andrewmcdonagh
- Re: My First C# (warning - long post)
- From: LX-i
- Re: My First C# (warning - long post)
- From: andrewmcdonagh
- Re: My First C# (warning - long post)
- Prev by Date: Re: [OT] My Second C#
- Next by Date: Re: My First C# (warning - long post)
- Previous by thread: Re: My First C# (warning - long post)
- Next by thread: Re: My First C# (warning - long post)
- Index(es):
Relevant Pages
|