Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

DAO or Service?

 
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm doing B&S. I see, that some ranchers chose to create a simple interface for clients and gave it a name e.g. ContractorService.

My dilema currently is, whether I should name my interface also in this way, e.g. "ContractorService" or stay with "ContractorDAO".

My reasoning is, that what this interface really does, is providing access to data source (local or remote), where transfer object is Contractor.

I guess, that Service is probably doing something more in real world, but in case of our assignment I don't see difference.

What are the essential differences when I'm calling something Service?

Thank you.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, in my B&S assingment there is a DB interface which I have to implement using a class called Data.

DB declares some methods like get(recNo), search(...), delete(recNo), ...
all those tasks a usually the concern of a DAO.

In a 3 tier architecture you should now create a layer (the service or business layer) on top of the DAO (DB, Data, ...) which, in very simple cases just delegates to the DAO.
This service usually combines the primitive methods of DAOs to implement the business needs. Checking if a record is available before booking it could be such a task.
 
On top of spaghetti all covered in cheese, there was this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic