Question

My goal is to define contracts between classes.

I like duck typing and all but I'd like also to define an interface between different layers of my application to clearly define which are the method to call from the external, and which are accessory methods that shouldn't be used by the other layer.

For example in Java I can define a Persistor interface with methods like get() and save() and then define a JdbcPersistor class with all the methods I need to persist on database. And maybe another RestPersistor with other methods for saving on a remote restserver.

I'm not asking for interfaces in Ruby, just to know if there is a neat way do keep this distinction. I like Ruby but I worked only on small projects with it.

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top