C++ in Object Oriented Programming language Coding

A team has two types of players: Batsman, Baller. It is required to assess their performance in a particular tournament and thus find out the best player in each of the categories. The assessment criterion for each type of player is different. For batsman, it is the average of his scores throughout the tournament. For ballers its the number of wickets taken in the tournament. Thus, the performance is determined based on score made (in-case of batsman), wickets taken (in-case of baller). There should be a display function that displays all the information of player of a particular category including team name.

Design a class hierarchy for the players in which you are required to find out the best player in each category according to their performance in a tournament. For this, you need to identify classes/objects, attributes against each class/object, operations against each class/object, type of association between (aggregation, composition, or inheritance) classes/objects. After identifying them, you need to make an object model. Your design should be such that which can be used to declare a list of players belonging to each category.

Code Organization in Functional Programming vs. Object Oriented Programming

Introduction

A co-worker asked about code organization in Functional Programming. He's working with a bunch of Java developers in Node for a single AWS Lambda, and they're using the same style of classes, various design patterns, and other Object Oriented Programming ways of organizing code. He wondered if they used Functional Programming via just pure functions, how would they organize it?

The OOP Way

If there is one thing I've learned about code organization, it's that everyone does it differently. The only accepted practice that seems to have any corroboration across languages is having a public interface for testing reasons. A public interface is anything that abstracts a lot of code that deals with internal details. It could be a public method for classes, a Facade or Factory design pattern, or functions from a module. All three will utilize many internal functions, but will only expose one function to use them. This can sometimes ensure as you add things and fix bugs, the consumers don't have to change their code when they update to your latest code. Side effects can still negatively affect this.