Comparison of defining shared behaviors by OOP and algebraic data types