Week 2 At datara flow
Week 2 was all about;
1)OOP; is a programming language based on organising codes into objects and classes for better organization. It is used when your program deals with both data and behaviour. It keeps data organized and is reusable. Example of where it is applied; cars, bank accounts, users as objects e.t.c.
2)Inheritance; is a mechanism where a class derives behaviour from another class. Inheritance is used to avoid repeating codes. Exampla; you have different accounts ina bank system
3)Iterators; it is an object that allows access to elements of a collection without exposing the underlying structure. Iterators are used to loop through items without manually Marking indexes. An example is processing transactions from a list one by one
4)Polymorphism; is the ability of different classes to respond to the same method call on there own way. For example, different objects implementing a method draw() but produces a different output. It is applied when different objects should respond to the same method name in different ways. Example, different types of accounts calculate fees differently
5)Scope; the region of code where a variable is determined by its visibility and lifeline e.g local scope, global scope, and class scope. Scope matters where variables can be used. It helps prevent errors and makes code readable. It keeps sensitive data inside classes instead of exposing them globally.