|
Re: OOP Case Study: The Bank Account Class (Part 3)
|
Posted: Nov 20, 2004 6:00 AM
|
|
> > And, that could mean designing languages as if things > > could go wrong. > > What does this mean? > > Java and C# were created (partly at least) because there > was a lot of crappy C and C++ code "out there", and some > of the ways in which that crappy code could be written was > taken out of Java and C#. > > Now we also have a lot of crappy code written in Java and > C#, none of which helps the fact that crappy code in any > language is written by programmers who: > > a) don't care > b) haven't sufficient training > c) haven't sufficient time to care or take care > d) try real hard but still write crappy code > > (d) are the people who will read forums like this one, > learn stuff, become better programmers. To some extent, > those in category (b) and (c) will too. IME it's those in > (a) who write the most code - make it work NOW, > release it and forget it ever existed. > > More new languages are unlikely to change that, and can > never change the fact that there is a lot of crappy code > written in lots of different languages, until we have an > AI compiler that can read bad C++ (or whatever) and spit > out great x-new-funky-language. > > Techniques such as the ones you mention are important when > trying to write good new code and interface with > legacy code. That doesn't take away the fact that if new > code is written with better design and coding techniques, > it's still better code. If we can push the average > standard up just a bit, it's an improvement.
Steve, thanks. In the blog entry that Chris quoted I was talking about adding first class support for testing in languages. The idea was that tests could have special access to classes to allow easy mocking without affecting the encapsulation of the code in production.
As I mentioned in the blog, this by itself could have some undesirable effects. If it is hard to test something, that in itself is valuable design feedback, so a little cheat like that in a language could be slightly counter-productive. However, it would help us with one case: the case where you have programmers who didn't know any better and dug themselves into a hole. A feature like that could help them dig out. And, as I mentioned before, I think that we have to open our eyes and realize that there are a lot of people who are in this situation.
I'm all for teaching people how to design better and helping organizations alter their development so that they aren't continually under the gun. It is what I do for a living. But, to me, it is only half of what needs to be done.
|
|