Originally posted by Thomas Paul:
I have lots of code that I know I can improve. But it's already gone to QA and if I make a change now it will cost thousands of dollars to retest it.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Thomas Paul:
The code is "perfect" when it (in order of priority):
1. does all the customer asked for (runs all the tests, if you are doing full XP)
2. contains no duplicated code
3. expresses all the ideas that need to be expressed
4. has minimal number of classes and methods
[...] That being said, 2, 3, and 4 are all elements that we work on given the restraints of time and budget. If we have to sacrifice something (and I have never worked on a system where I had unlimited time and money) then 2, 3, and 4 are where we make sacrifices. At some point we say that it is good enough and move on to the next project.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
Yes, now it is to late. IMHO you should have refactored much earlier - because IME that would have speeded you up, not slowed you down. Refactoring shouldn't be something that you schedule, but that you do as your daily job, minute by minute.
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Quality is only free in the long term. If you get fired because your app was three days late then it wasn't exactly free, was it, no matter how high the quality.Originally posted by Ilja Preuss:
I stick to it: you get fastest by not sacrificing quality at all.
http://c2.com/cgi/wiki?QualityIsFree
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Mapraputa Is:
[QB]Uncle Bob wrote: "And even those things are result of the yin and the yang in proper combination"
If to think further, what is the one single idea behind those two? Orthogonality! They are orthogonal! Otherwise there would not be "yin and yang" and would be only one yin-yang.
BTW, who said that in OO "*everything* is an object"?
OMG-2. You are not saying that it was me, are you? :roll: I quoted the expression to say that this is a bad idea and now my words were taken out of context!
Again, I suspect that it is rather hard to speculate about the balance between inheritance and composition without having experienced it...
It's like to say that in order to understand processes that happen during thunder storm, you need to be stroked by a lightning!
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Thomas Paul:
I think the link you provided has a very important comment: "I think you pay for quality up front, but it's an investment that pays off -- in the same way that a $50 Estwing hammer is initially more expensive that a $10 K-Mart hammer, but cheaper in the long run."
That only makes sense if you have $50. If you only have $10 then the K-Mart hammer is the proper investment, isn't it? As programmers working for a business trying to make money we must be very careful about how we spend that money.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Thomas Paul:
Just a quick comment: please stop using abbreviations like IMHO and IME. I have no idea what they mean and find them extremely annoying.
As to your comment, I don't think you have a clue what I am talking about. Do you only refactor programs or do you refactor applications? Do you work on all your applications by yourself? When 5 developers are required to put up an application in 10 days, do you refactor the entire application over and over again during development?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
No, I refactor only the code I am currently working on, but there I do it mercilessly. I do this when I am working alone as well as when working in a team.
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Ilja Preuss:
You can look them up at http://www.ucc.ie/acronyms/ - they are rather easy to learn and you will find them everywhere on the net, so I think that would pay back. I will try to explain the ones I use in this thread, but often I don't even notice that I use them, so please forgive me if I miss some.
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Mapraputa Is:
I disagree. The conclusion would be correct if you had to stick with the patterns you decided upon upfront. But you don't - well designed and -tested OO systems are rather easy to refactor.
I would only note here that probably any well designed system is rather easy to refactor and easy of refactoring is pretty much orthogonal to OOP...
Later the book shows that "the preplanning problem" doesn't exist in Smalltalk because of its wonderful reflection system.
I don't get this - could you elaborate?
They call it "noninvasive, dynamic composition based on intercepting messages". As far as I understood, it means you can dynamically attach objects to other objects at run-time, while the code is untouched. You really do not need up-front design for it.
And nevertheless there are many people (including me) who find the abstractions of OOP to be very helpfull for writing good software. I wonder wether there might be a fourth category missing...
Rats, I wanted to leave the fourth undefined category for extensibility and forgot Bad design. So what do you think, it is? Anything
that proved to be useful in practice?
I am confused - I think this is exactly what "extends" is doing: implicitely forwarding all calls to inherited methods to the super class.
Not "exactly". With how inheritance is implemented now, if a superclass added a method, a subclass will get it without recompilation. If we re-define "extends" to provide explicit method calls at the code level, the automatic inheritance of new methods will be prevented.
The responsibility of a DOM parser is to parse XML - nothing more. It shouldn't have to know anything about Javascript. So, here delegation certainly would be the proper solution.
Then what would be an example of "is a" concept?
Isn't it what specialization is about - to add extra services a base class doesn't provide?
Because, in the above example, we don't know how many customers the system will have to handle.
I did not understand that... How many customers - isn’t it orthogonal to the task of parsing? Or you are talking about another example?
Yes, it does, as we neither refer to interfaces or classes any longer, but only to the methods we expect an object to have.
Ah, I see. I mentally already got rid of instances and was left only with classes and interfaces.
Oh, sorry. Replace "an object" by "a class". For me, it doesn't make a difference, because in OO, *everything* is an object, even classes...
if we do not have inheritance,
SomeObject.someMethod(...) is the same as someMethod(pointer to SomeObject's data, ...)?
Yes. In fact, if "SomeObject's data" included jump tables to tell which actual methods to call when working on this object, you would have already implemented OO-like polymorphism.
If you then write a macro that makes it possible to automate the tedious work of defining the jump tables, you would have just implemented yet another OO language...
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Frank Carver:
[QB]Ilja wrote: For me, "good enough" is implying that I can reach a state where I no longer have to think about improving the quality of the code - why should I do if it already is good enough?
Ah, I think I get it.
Which aspects of the development process (customer requirements? timescales? your own health and family life?) are you willing to sacrifice to improve other aspects of something beyond what is required today.
How do you know that the project won't be cancelled (or radically changed) tomorrow morning ?
Would the customer payng the bills prefer that you made one feature "better than good enough", or that you implement two features "good enough"?
Most importantly, how do you know that what you are proposing is really "better"? By surpassing "good enough" you have gone beyond the requirements and the tests, you are adding something no one has asked for and which may acvtually be something they implicitly don't want!
Or am I missing your point?
Can you give us a real, concrete, example of something which you consider "good enough" and what you would do to make it "better" ?
I feel that I have somehow let myself down if I embark on a task for which I won't know when I'm done. I also find it hard to be motivated at such tasks - you may remember some discussion here about tests for documentation.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Thomas Paul:
That explains the problem between us. I'm talking about refactoring an application. And in OOP terms, the biggest rewards come from application wide use of OOP techniques.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
I don't have any clue what you are talking about...
The refactorings I know are done in very small steps, so refactoring a big application would mean to apply myriads of small refactorings to part after part of it.
How does that connect?
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Thomas Paul:
I'm talking about refactoring an application. And in OOP terms, the biggest rewards come from application wide use of OOP techniques.
Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Frank Carver:
Ilja wrote: Can *you* give an example of code that is "good enough for now", but you know could be improved?
Ah, I'm ahead of you there. I make several comments to that effect in my refactoring examples, collected in this thread.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Thomas Paul:
Imagine you have an application with 20 classes. You know that inside those classes are large blocks of code repeated several times across multiple programs. Each program is very well written but you have still created a maintenance nightmare.
One small business rule change could force multiple changes across many program each needing to be tested. We refactor the application by yanking out blocks of reusable code and creating separate classes. Now only a single class of shared code contains changeable business rules.
Personally I would rather work on a well structured application with classes that need to be refactored than on a poorly designed application with beautifully written individual classes. The odds are that the latter is going to be much more work to fix than the former.[/QB]
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
It depends on whether you are working on the class or the application, doesn't it? The point is that it is usually easier to refactor a class than it is to refactor an application.Originally posted by Ilja Preuss:
So are you saying that it is less work to implement a poorly designed class than it is to implement a well designed class???
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Thomas Paul:
It depends on whether you are working on the class or the application, doesn't it? The point is that it is usually easier to refactor a class than it is to refactor an application.
That's 100 posts on this topic which is probably more than enough.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Originally posted by Mapraputa Is:
I found explanations that sound reasonable. Here.
I remember I found the site a year ago, but then did not read the whole text, only beginning and decided the author was in a bad mood when writing this, so it isn't worth reading. Maybe I am in bad mood now
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Originally posted by Mapraputa Is:
Also, when you are saying "Isn't it a well known fact that even the average heads don't become teachers because those don't get paid enough?" - I am afraid you may be in trouble with many of our ranchers, Thomas Paul for one example.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Mapraputa Is:
I guess, some people aren't created for Object Orientation.
Either that, or my early exposition to the Table Orientation undermined my intellectual abilities.
In any case, the text above makes much more sense to me than all I read about OOP.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Originally posted by Mapraputa Is:
What is probably hindering you is that you always try to compare what you learn about OOP to the relational way.
What's hindering me most is that I see the Solution, but I do not see the Problem this Solution is for.
What I observe is that what was simple with my old set of tools, with OOP getting unnecessarily complicated.
You are saying: OOP is good for quick prototyping. Isn't it what scripting languages are for? Jython, for that matter...
We worked with Clarion - template-based code generation engine. It was damn fast to develop a full-blown application, a lot of typical tasks were "encapsulated" in templates and if you need to adjust something - there are a lot of places you can plug in your code. It was easy to use, and what's better, templates were written for many languages, maybe even for Java (we didn't use it that time), so your application can be generated in any language you want. If there is no template - write your own. I guess, the same methoda wouldn't work if we were to computerize a giant enterprise, but we were not.
Another thing, it's hard to make estimations, but roughly 30-50% of my time was devoted to "write once and throw away" code. Endless data format conversions, data mining, etc. I really do not need all complexity of OOP for that :roll: The code was written "from scratch", nothing to "inherit" from, and nothing to "demise".
You are saying: "OOP abstractions are useful". No doubt they are useful. Look at this post in our XML forum. Who will say the first solution isn't useful? Of course, it is. It's just that the second is much simpler and more elegant.
You hear a detail about OOP, try to interpret it in the relational world and come to the conclusion that it doesn't make sense. You don't know that it does make sense in the OO world, because you are not familiar with it.
Let's see, I got "A" and "A+" in my college classes, I got my SCJP with 94% (it's not "developer" yet something), I read Grady Booch "Object-Oriented Analysis and Design", J.Cooper's "The Design Patterns Java Companion", "Design Patterns Explained", "UML distilled" and "Refactoring". "Java Virtual Machine" after all - OOP (at least in Java variant) doesn't make mush sense without knowing how method dispatch works. Hardly qualified as " hear a detail about OOP"...
Now I wonder if OOP makes so much sense to you only because you aren't familiar with the
relational model.
1. "The problem is that OO is permeating my niche where it probably does not belong. Its few, rare benefits there do not justify the added complexity."
2. "I see the OO side of the story all the time, but rarely are the down-sides mentioned."
3. "Claimed that OOP version was better without saying exactly why. You must be able to trace and articulate your mental steps, or provide clear metrics. "Emotional votes" don't count because nobody can externally verify them.
Constructs and arrangements that make your own mind happy may not do the same for other brains, being that people are different from each other."
4. "I am the product of the same education process that most of the other programmers out there get. <...>If I am uninformed, then so are most OOP programmers. If you agree with this, then OOP is doomed because the industry is not presenting (training) OOP properly and most people will not spend 5 years on a mountain top with gurus to get there. My alleged ignorance may simply be a mirror to a much larger problem."
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Originally posted by Mapraputa Is:
I would say that whereas I can learn the need to set priorities, "oligarchic" style is more natural to me. I can be totally off here, but maybe this somehow contributes to "OOP vs. RM" preferences.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Mapraputa Is:
The problem OOP tries to be a solution to is simply that of decoupling: how can I decouple things from one another which change for different reasons.
This is what baffles me: why first to couple data and code,
then to couple coupled data and code (objects) by arranging them in hierarchies, and then work hard on decoupling things from one another...
"motivates you to stop" - no, I am not going to stop.
My mistake was that I tried to understand a system (OOP in this particular case) from inside of system only (by reading OOP gurus). It never works. To fully understand something you need to see it in broader context, you need a theory in which OOP is only one particular case of some general rule. I am trying to find such a context.
To start with, James Coplien's work can probably provide some insight...
"OOP" and "scripting" are orthogonal concepts Means that there are scripting languages that aren't object-oriented, as well as those that are. I mentioned Jython because it's so well integrated with Java.
I happened to use one that didn't have any notion of OOP. My point was that in some cases other techniques can do the job without overhead of OOP.
This is from Eric Evan's domain language book Kyle Brown suggested:
The first solution is not plainly procedural. All virtues of OOP -- interfaces, incapsulation, casts are here.
What Dan suggested, is to use OOP wrappers around an XPath expression. XPath does all the job, NodeIterator only presents results as objects. Now XPath itself can be implemented in OO language, and I suspect it is, but this has nothing to do with choosing a right tool for the job.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Mapraputa Is:
How does that connect to "3. ... Constructs and arrangements that make your own mind happy may not do the same for other brains, being that people are different from each other."?
Why should it connect?
Perhaps OO is introduced in that niche by people whos minds are made happy by it?
Perhaps. There is a powerful source of this happiness: educational system. You see, classes that I took in college were called "Computer Science-1" and "Computer Science-2". 98% of content was OOP (in Java variant), Java as such and Java's noble APIs. With some minor digressions into how computer represents integers and float-point numbers. Now *this* is Computer Science? I suppose that students' "minds were made happy by it", yes, because they didn't get a chance to learn anything else. They have to learn OOP before they acquire enough knowledge to make their own informed opinion. All this is not OOP's fault, of course, rather "how system works"...
So he is accepting that OOP might be the perfect match for the majority of developers out there and just not appropriate for his brain? So, what is all the fuss about???
How did we move from "your own mind" to "majority of developers out there"?
Well, as you already mentioned, most programmers are even less well informed about the relational model. What does that tell us?
That OOP is oversold and overhyped and the relational model is not?
And that all this is orthogonal to their real qualities, whatever they are?[/QB]
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Mapraputa Is:
I got an impression he *is* intellectually honest, which doesn't mean he is always right.
Partcularly, this passage bothers me:
"Many OOP proponents brag about OOP's alleged elimination of "case" or "switch" constructs. Case statements are a favorite (straw-man) whipping boy for OO textbooks and fans. In reality what is being done is that the case statements are being broken up and spread around the program so that they are not immediately visible. Their equivalent is still there, but simply morphed and divided."
"spread around the program" - perhaps, but I think one potentially important thing is missing: with "switch" (of if-else for that matter) construct you can only have limited number of alternatives, whereas when you replace it with polymorphic method calls, you can add infinite number of alternatives - this jump to infinity shouldn't be ignored.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Mapraputa Is:
But having read about C++...
I am not so determined to set up to investigate heaps of classes and constructors.
My impression is that someone ingenious has thought up remarkable cubes, played a little, and then canonized not cubes, but consequences of his games.
I have my own hypothesis. OOP is a language for system analytics. If programmers start to use it, the result is nonsense".
I particularly liked the claim that OOP is not for programmers.
It is said that "Objects hide implementation complexity, yet they expose modeling complexity".
Kyle Brown keeps on asking people to read at least one book before starting to model anything, but they prefer to ask "tell me which pattern I can use..." This is a cultural clash. Programmers need "complete practical code", they do not need patterns. To build models, they simply lack proper education. At least, I know I do.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
Well, at least an *undefined* number of alternatives - it's the OO-typical decoupling again: the code using the alternatives doesn't depend on the actual alternatives, but only on an generalized abstraction.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
We don't have time for this. We've gotta save the moon! Or check this out:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|