Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class normalization

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Scott
What is class Normalization?
 
Surasak Leenapongpanit
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
see class normalization

Class normalization is a process by which you reorganize the structure of your object schema in such a way as to increase the cohesion of classes while minimizing the coupling between them.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So would it be fair to say the most often the goal of refactoring is class normalization?
 
Aurimas Valionis
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A fundamental difference between class normalization and refactoring is that class normalization is typically performed to your models whereas refactorings are applied to your source code.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ilja Preuss:
So would it be fair to say the most often the goal of refactoring is class normalization?

Most often, probably yes. However, I could imagine someone applying a refactoring to "denormalize" a set of classes in order to make the code more readable, for example.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Aurimas Valionis:
A fundamental difference between class normalization and refactoring is that class normalization is typically performed to your models whereas refactorings are applied to your source code.


I agree that models typically can't be refactored in the strict sense, simply because they don't have behaviour.

But besides that, I don't see where the distinction you are drawing is coming from. When by refactoring I increase cohesion and decrease coupling, why wouldn't I call it class normalization?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lasse Koskela:

Most often, probably yes. However, I could imagine someone applying a refactoring to "denormalize" a set of classes in order to make the code more readable, for example.


I could imagine *someone doing that*, too. I'd suspect an alternative design lurking somewhere, though, one in which readability and normalization can coexist in peace.

An example might be interesting...
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ilja Preuss:
An example might be interesting...

Yep. I'll try to remember this thread if I ever see one
 
Scott Ambler
author
Ranch Hand
Posts: 608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The goals of both class normalization and refactoring are to produce better designs. Normalization rules can be applied during modeling, as can refactoring for that matter. You can also refactor your code to make it "more normal", for that matter.

In short, they're complementary concepts, not competing concepts.

One of my philosophies is that it rarely makes sense to ask the question "X vs. Y" but instead to ask the question "how well do X and Y complement each other?"

- Scott
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic