tags:

views:

341

answers:

6

I was reading Code Complete (2nd Edition), and came across a quote in the margin on page 87 by Bertrand Meyer.

Ask not first what the system does; ask WHAT it does it to!

What exactly is the point Mr. Meyer is trying to get across here. I have some rough ideas, but I would like to make sure I really understand.

+2  A: 

I believe the point here is not on what the system does, but on the data it operates on and what those operations are.

This provides two major thinking shifts:

  • You think of the data and concepts first
  • You think of operations on that data

With those two "baselines" you will better prepared to organize a system to achieve your goals so that operations on data are well understood and make sense.

In effect, he is laying the ground work to be able to write the "contracts" on the code you write.

njsf
Ah, thank you. This is along the same track as I had deduced, but is put much more elegantly, and is much easier to reflect upon. Thanks.
Matthew Vines
+3  A: 
Thomas L Holaday
WTF? .
Mike Kucera
Thanks for the link. I'm still digesting it all. But this gets at the root of why Bertrand Meyer even felt the need to point out such a thing in the first place.
Matthew Vines
Thanks for reminding me why "artificial intelligence" research keeps going out of fashion - it happens when people suddenly see through the jargon-laden pretentious waffle to the trivial thoughts actually being expressed.
MarkJ
A: 

My opinion is that the quote is meant as a method to find good abstractions in your software. The text next to this quote deals with finding real-world objects to design your classes.

An simple example would be something like this:

You are making software for a bank. Because your software is working with bank accounts, it should have a class for an account. Then you start thinking what properties accounts have and the interactions you can have with accounts.

Of course, this quote makes more sense if the objects you are trying to model aren't as clear as this case.

Jorisslob
A: 

From Google search it picked up Art Gittleman's Computing With C# and the .Net Framework:

Bertrand Meyer gives an example of payroll program, which produces paychecks from timecards. Management may later want to extend this program to produce statistics or tax information. The payroll function itself may need to be changed to produce weekly checks instead of biweekly checks, for example. The procedures used to implement the original payroll program would need to be changed to make any of these modifications. Meyer notes that any of these payroll programs will manipulate the same sort of data, employee records, company regulations, and so forth.

Focusing on the more stable aspect of such systems, Mayer states a principle: "Ask not first what the system does: Ask WHAT it does to!"; and a definition: "Object-oriented design is the method which leads to software architectures based on objects every system or subsystem manipulates (rather than "the" function it meant to ensure)."

We today take UML's class diagram and other OOAD approach for granted, but it was something that was "discovered" along the way.

Also see Object-Oriented Design.

eed3si9n
A: 

Fred Brooks stated it this way:

"Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won't usually need your flowcharts; they'll be obvious."

starblue
A: 

Domain-Driven design... Understand the problem the software is designed to solve. What "domain" entities, (data abstractions) does the system manipulate ? And what does it do to those domain entities?

Charles Bretana