Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Making our model video. Why you made two DAOs?

Couldn't quite get what is going on there. Would be better if this explained more in details. what is the role of courseIdeaDAO, simpleCourseIdeaDAO? Little confusing.

1 Answer

I agree, in later courses like 'Spring Data Rest' he'll switch to Spring Convention:

CourseDao -> CourseDaoImpl

This was we know what is interface, and what is the implementation.

The roles... ? Well

One is the interface and other is the implementation. That is it. We always use interface, so that later on we can be flexible and change the implementations, without changing a lot of code of our Application.

Trying to be Object-Oriented Programmers...

Does that sound more helpful ?

Thanks, Alexander. I got that one of them is interface and other implementation, but the whole concept is very loosely taking place in my mind. I wanted to have some concrete explanation. I wanted to get this once and forever. So, basically we could use just one class but that would disable us from changing data provider if we wanted in the future. Is that correct?

So, basically we could use just one class but that would disable us from changing data provider if we wanted in the future. Is that correct?

Yes.In fact it is a very bad practice. And I know that when big companies that software architects to check the architecture of the big Java and other Obj, Oriented languages, those people check for such things (i.e. using Implementation without interface) and report as errors.