• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

naming conventions

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I have named some of my classes in a verb format, because it make things much clearer. For example, my UpdateRecord class holds the update() that my Data class forwards to. I know typically we are supposed to name classes with nouns, but in some cases I don't see the point in doing so. Any opinions on this? Do you think Oracle will knock me for this?

Thanks,
Matt
 
Rancher
Posts: 175
Clojure Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you could maintain your preference for emphasizing the verb and respect the convention:

RecordUpdater
UpdateRecord
UpdateRecordAction
 
Matt Pavlovich
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good call, David. Thanks. I was using Command, but it just looked ugly. At least Action is a bit shorter. Guess I should buy a Thesaurus.

 
David Byron
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can narrow the scope of your noun-hunt further by considering what kind of thing is doing your verb. It's not merely a matter of rifling through the thesaurus (as you joke) in search of an apt phrase. It's also a matter of stepping back and asking: How are you thinking about responsibility?

You write: "my UpdateRecord class holds the update() that my Data class forwards to." Ok, but since a record is what you retrieve by way of the Data class, maybe a Record class should represent a record. And since updating is something done to a record (perhaps by the record itself), wouldn't it make sense to have update be a method either in the Record or in whatever manipulates the Record? (say, a RecordController or a RecordService or a RecordManager....)

Gesture --> Action (a listener) --> [invocation of intermediate controller] --> business service/method --> domain object --> persistence mechanism --> [invocation of integration adapter] --> db.

If you ponder the functional layers of a typical app and ask who should be doing what, the noun/verb thing will sort itself out.

 
This is my favorite tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic