• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Bitter Java and Patterns

 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Corey McGlone:
all too often, the wrong thing is done because it's cheaper.


And most often, it even is only slightly cheaper for a very short spell and much more expensive in the long run (well, that is why it is the wrong thing, isn't it?)... :roll:
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilja Preuss:

And most often, it even is only slightly cheaper for a very short spell and much more expensive in the long run (well, that is why it is the wrong thing, isn't it?)... :roll:


Indeed, I should have added that to my statement. Often, the wrong thing is done because it's cheaper now. You should always look ahead at possible costs in the future, such as maintenance. Even when that is done, however, sometimes it still turns out to be cheaper to do the wrong thing. It really depends on the situation. Usually, however, doing the wrong thing will bite you somewhere down the line. :roll:
Corey
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Frank Zheng:
Have you guys met this situation:
Even though everybody are aware of the principles of good design and patterns, it is not necessary that these principles be applied in real-world programming. Historical reasons, resources, political barrier are all possible obstacles that prevent good programming rules being carried out. Is this a hard topic in project management?


Just recently I was sitting in a meeting where the following discussion happend:
CowOrker: We need to test more.
Me: So lets start by defining testcases.
CowOrker: But we don't have time to go through the testcases before every release.
Me: So lets work on automating the tests.
CowOrker: But we don't have time to write automated tests.
Me: So we have to deliver the software untested...
CowOrker: We can't deliver the software untested - that would be silly!
:roll:
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Corey McGlone:
So, in the beginning, I would have to presume that solid design principles precluded patterns. Of course, with that, I believe that developers were using patterns even before they knew they were patterns. After all, was the first singleton really called a singleton? :roll:


Well, even if it was, it wouldn't have been a pattern...
IIRC, to be called a pattern, it has to be used successfully at least for three times.
 
Sheriff
Posts: 16278
271
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

...
CowOrker: We can't deliver the software untested - that would be silly!
:roll:

LoL...
(if it were) Me: Well then, just shoot me!
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Junilu Lacar:
I've always wondered though, does knowledge of patterns somehow subliminally influence the refactoring into them


Well, I wouldn't know how to uncouple my knowledge about design patterns while refactoring.

[...]or does it just follow that improving the code to conform with good design principles naturally gravitates the design toward certain patterns, even without the designer being aware of the patterns.


On the XP mailing list someone once reported about an experiment: He tried to refactor stringently by book, just taking care of local code smells without paying attention to the big picture. He even listened to music at the same time, to occupy the creative part of his brain.
He wrote that he was slightly suprised as he generated class diagrams from the result of his refactoring day - according to his statement they could have been part of a design patterns book...

Patterns are discovered, not invented. But I guess so were good design principles. So which comes first, patterns or good design principles?


Mhh, how would usefull patterns emerge if not by applying good design principles?
 
Junilu Lacar
Sheriff
Posts: 16278
271
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilja Preuss:

Mhh, how would usefull patterns emerge if not by applying good design principles?


But how could they (whoever first stated what were good design principles) come to the realization of the principles without first noticing certain patterns in the designs that were considered "good"?
Like I said, it's the Chicken or the Egg question...
 
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilja Preuss:

And most often, it even is only slightly cheaper for a very short spell and much more expensive in the long run (well, that is why it is the wrong thing, isn't it?)... :roll:


But shall we take into consideration of the trade-offs between the maintainability, reusability, extensibility and the cost they cause?
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Doug Wang:

But shall we take into consideration of the trade-offs between the maintainability, reusability, extensibility and the cost they cause?


Any design you create will have its ups and downs. A system that is very extensible might be very costly and slow. However, a more stringent system might be cheap and fast. As no project has an infinite budget, you're forced to make tough decisions as to which aspects are most important to the system. Those decisions will obviously have a significant impact on the design of your system.
Most patterns do a good job of balancing these things. Granted, some may do a better job than others, but they are considered to be good design models because of the fact that they balance these aspects of a system fairly well.
Corey
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Corey McGlone:
A system that is very extensible might be very costly and slow.


Why would it?
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Doug Wang:

But shall we take into consideration of the trade-offs between the maintainability, reusability, extensibility and the cost they cause?


Certainly, let's take it into consideration - what trade-offs do you see, to begin with?
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Junilu Lacar:
But how could they (whoever first stated what were good design principles) come to the realization of the principles without first noticing certain patterns in the designs that were considered "good"?


Perhaps something like
"Often when I do *this*, it hurts badly, but when I do *that* instead, it seems to work rather well..."
"Hell, that's exactly what I am experiencing, too! Perhaps we should write an article about this versus that."
"OK. Shall we name it 'Our That Principle' or 'The Law Of Us'?"
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilja Preuss:

Why would it?


A system that is extensible isn't necessarily going to be slow and costly. I was just trying to come up with an example. In order to gain greater extensibility in a system, you might have to opt for a design or implementation that is not as efficient as you'd like. This may not be the case, which would be ideal, but, more often than not, there are tradeoffs for just about anything.
Corey
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Corey McGlone:
A system that is extensible isn't necessarily going to be slow and costly. I was just trying to come up with an example. In order to gain greater extensibility in a system, you might have to opt for a design or implementation that is not as efficient as you'd like.


Mhh, I am not sure what you mean by extensible.
If you mean that you can extend the system without touching the original code, I aggree, as you have to somehow build some "extension points" where you can plugin externally defined behaviour.
If you mean that you can extend the system by changing its code, I disagree. In my experience, the system with the simplest design (that is, which only implements the currently needed functionality in the easiest way in a well decoupled and coherent design) is also the most extensible, cost-effective, maintainable and easy to optimize system. (In fact that is not only my experience, but also one of the presumptions of eXtreme Programming.)
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ilja Preuss:

If you mean that you can extend the system without touching the original code, I aggree, as you have to somehow build some "extension points" where you can plugin externally defined behaviour.


This is, actually, what I was referring to. Perhaps I should have used the word "customizable" as opposed to "extensible." I was referring to systems in which you could alter the behavior by changing external files and the like. Sorry for the confusion. In the end, I agree with what you're saying - it just took a little while to understand. :roll:
Corey
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
all too often, the wrong thing is done because it's cheaper
Or because it's percieved to be cheaper, at least in the short term. Often this turns out to be incorrect... :roll:
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jim Yingst:
all too often, the wrong thing is done because it's cheaper
Or because it's percieved to be cheaper, at least in the short term.


And most times this happens it seems to get combined with the notion of being "pragmatic". I can't stand this misconception much longer...
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic