-2

I am going through this OO design course: https://www.coursera.org/learn/object-oriented-design/home/welcome and starting to look at the use of CRC cards. (class responsibility collaborators).

I wanted to apply this to one of my own projects to get some experience using the technique. I have previously written a sqlite wrapper class here:

https://github.com/arcomber/sqlite_cpp

Yes I know this is being done the wrong way round but to get some practice I wanted to use something I already know. So if I wanted to create a crc card for this class, would something like this be appropriate:

class:
sqlite

responsibilities:
insert (create)
update (update)
delete (delete)
select (read)

collaborators:
sqlite3 c library

The next thing to consider is the other classes. Now originally I wrote this without using crc cards and I came up with the following classes:

cgi_request
cgi_response
model
controller
[didn't need a view class]
I used the sqlite3.h/c c library
a main function

but mvc is quite technical. Would something like that come out of doing a crc session?

If I had used crc modelling in the first place, is it likely I would have come up with the same design?

2

Would something like that come out of doing a crc session?

CRC cards appear to concern themselves primarily with entities, not with architectural design. MVC was created primarily to address the architectural problem of separation of concerns.

Think of a CRC card as a fill-out form that's been created for entity classes. When you create any kind of paper form, you do so because there is specific information that you want to capture that pertains to your problem space.

There's nothing special about the CRC card, other than it elegantly captures useful information about each entity. It doesn't change the process of class design; it merely provides meaningful assistance to that process.

To put it another way, CRC cards are a tool, not a technique.

If I had used crc modelling in the first place, is it likely I would have come up with the same design?

That would depend on how the exercise of creating the CRC cards informed your design decisions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.