Re: Mixing OO and DB
Date: Sat, 8 Mar 2008 20:07:00 -0600
Message-ID: <2008030820070037709-unclebob_at_objectmentorcom>
On 2008-03-06 15:37:56 -0600, topmind <topmind_at_technologist.com> said:
>
>
> Robert Martin wrote:
>> On 2008-03-04 17:06:57 -0600, topmind <topmind_at_technologist.com> said: >> >>> >>> >>> Robert Martin wrote: >>>> What you are missing is that there is >>>> no restriction that other objects use the data from the employee_table.
>
>>>> So while a class certainly defines the methods that can be used to >>>> access and manipulate the data within that class, there can be many >>>> different classes that use the same data in very different ways. >>> >>> In other words, each class becomes a little roll-your-own database >>> with a very custom interface. >> >> Each small group of classes becomes a little roll-your-own data access >> and manipulation scheme that is perfectly tuned for it's very specific >> purpose.
>
> Which is over-kill for the task-level.
Do you have proof that it's overkill? Do you have any objective measurements that it's overkill? Or it is just your own opinion. I mean, if it works for you that's great, but don't force your own opinions on everyone else <grin>
> Often one ends up only
> instantiating stuff once, for example. If you do that, you might as
> well use procedural to avoid bloated code.
It takes one line of code to declare a class. Is that the bloat you are talking about? A class is a new scope. It allows you to create variables within a scope that several different functions can share. That can be very useful. Rather like the block structure of Pascal or Algol, except not constrained to the stack.
>
>> >>> RDBMS instead factor common collection- >>> handling and attribute-management idioms into a central tool. >> >> Granted. Very useful.
>
> Then why wouldn't you want that in OOP also? Answer: because you'd
> have to rethink encapsulation and also face the same problems that
> prompted Dr. Codd to formulate relational.
No, because OOP solves a completey different problem and has nothing whatever to do with the problem solved by RDBs.
> Our techniques for measuring "more convenient" apparently are very
> different. Either one of us is way off (or both?), or they are
> subjective personal preferences.
How would you write a reverse polish calculator? Would you use a stack to hold the arguments? Or would you use SQL?
It is very common for programmers to manipulate data into forms that are particularly convenient for the application they are writing. Databases are seldom in that form since (for one thing) they must usually serve many different and competing applications.
>>> OO is shanty-town design versus modern civil planning. >> >> Stupid sloganeering with no substance behind it.
>
> Is your sloganeering also "stupid"? Like calling 5-line methods/
> functions "professional" and longer ones "unprofessional" without
> objective justification?
You need to look up the difference between a slogan and an assertion. Your particular slogans have a pejorative flavor to them. e.g. "function dandruff", "shanty-town design", etc. Assertions have no hidden emotional content.
>>> If >>> one learns to leverage those idioms provided by the DB, then the code >>> is simpler because it doesn't have to reinvent them. >> >> That sentence is true. It is also true if you replace the phrase "the >> DB" with the word OO.
>
> Show me how. I opened my wallet, purchased your book, and found it
> wanting and produced a much simpler and flexible payroll example. For
> free even. Unlike you, I don't charge for personal subjective
> opinions.
There's another one of those hidden emotional barbs. You realize of course that you have just promised that you will never write a book. In any case, I think if you total up the number of words I have provided free of charge over the last twenty years on various newsgroups etc, you'll find they exceed your own by a wide margin.
The truth is, dear Bryce, that you are very comfortable in your little "oop is mad" world. Why would you leave it?
-- Robert C. Martin (Uncle Bob) | email: unclebob_at_objectmentor.com Object Mentor Inc. | blog: www.butunclebob.com The Agile Transition Experts | web: www.objectmentor.com 800-338-6716 |Received on Sun Mar 09 2008 - 03:07:00 CET