1a. working local variables when in a

1a. What is your definition of OOP ?In Object-oriented Programming, everything in the system is an actor which:have a list of actions that such an actor may carry outhave a list of states that such an actor possessan action make by an actor may change his own state or other actor’s statesThere are two main categories of OOP:Class based – of which a new object is instantiated from a class constructorPrototype based – of which a new object is clone from a proto objectprototype based OOP is more flexible as new attributes and methods can be dynamically added into an object proto in runtime.There are also concepts like:inheritance( extend a class to form a subclass)interfaces ( implements certain methods defined by an interface )override ( of which subclass can override a superclass method implementation)overload ( of which for methods with same method names, can have different input parameters signature and different implementation)1b. Explain OOP with examples in a comparative way with other programming paradigms, e.g. Functional Programming, Procedure Programming.Compare with Functional Programming:OOP usually relies on object instance’s state for keep tracking calculated result, while functional programming is stateless, it does not rely on mutating existing state in the external environment for processing. So that functional programming has no side effect. Because it has no side effect, it is safe to chain up functional methods.Functional programming complements OOP : C# was a pure OOP environment. But after the introduction of LINQ, which is functional, it greatly simplifies the work in summarizing, manipulating and transforming data. Functional Programming makes OOP coding less terse and less error-prone.For example, one may use for-loop to process an array. However, with functional map and reduce, it helps to reduce an extra variable just to keep track of array item currently pointing at. Furthermore, an anonymous function in map can be written solely for transforming one item at a time, there is no need to reset working local variables when in a for-loop. An function in reduce helps to aggregate array items. filter helps to keep only desired array items without modifying existing array and do not need extra working array like those in for-loop.Compare with Procedure programming: OOP combines data (as object instance state) and actions allow for data (as object instance methods) in a single object. It is less error-prone because now the object governs how its private data can be manipulated by forcing user to mutate object instance state only by object methods, while procedure programming relies on importing libraries to manipulate data, and leave user to call library function to change data. We may say that OOP abstracts one more level compare with procedure programming.While procedure programming deals with data directly, poor OOP design can lead to excessive use of manager classes to spawn objects. Subclasses by inheritance are also not flexible enough for real-world system changes.