replace oop objects with ddd types in functions