TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Coupling in Object-Oriented Programming

4 pointsby jayferdabout 12 years ago

1 comment

lmmabout 12 years ago
I think the author hasn't grasped what Fowler was talking about (and equating OO with JavaBeans is a bit unfortunate). His Dog example seems to support his point because <i>it doesn't have any behaviour</i>; he hasn't told us anything a Dog <i>does</i>, which means there's really no need for his Dog to be an object. (I was going to say it should be a struct, but actually given the use cases so far it should probably be a tagged String) Which is fine, sometimes it's the appropriate approach. In scala there's a nice distinction between "class" and "case class"; I understand some people use C#'s struct/class distinction the same way.<p>So yes, don't give your domain objects responsibility for serializing themselves to json. But that doesn't mean it's bad for objects to take responsibility for things that are actually part of their domain.