CodeClan Week 12
Week 12 of 16 complete.... this week has been really conceptual but really helpful to me as it helped me grow my understanding of why we do things a certain way, This week has also helped me with planning my projects out in a very clear and specific way before I even start coding. sorry this may get a bit 'whaatttt....?" but im going to basically write exactly what my class notes say... just to help me soz...!
Inheritance
in its most basic term.. one class inherits from another.. child classes inherit something in common from the parent class and to use this we add the word 'extends' to the end of the class name and name the class that is the parent class. Methods created in the parent class can also be overridden in the child class. We can also create an inheritance chain, where a class inherits from more than one layer of parent classes.
Polymorphism
The term polymorphism comes from two Greek words: 'poly' meaning 'many' and "morph" meaning 'change'. When we talk of something being 'polymorphic' we mean that it can have 'many forms'. Polymorphism can be implemented using both abstract classes and interfaces. All classes which inherit from a class can take the type of the superclass. To use an abstract class we create a superclass which all the classes we want to treat as being the same can inherit from. Inheritance is fraught with problems and we can quickly get into a mess. We can also just have one superclass. Interfaces also allow us to treat a class as being of another type. When a class implements an interface it gains the type of the interface without having a horrible inheritance chain. We can have as many interfaces as we like, too. Rather than just one super class.
Composition
One important thing to know about composition is that it is also about ownership. When we assign an object to be part of the composition of another object. Inheritance can be useful, but it needs to be used with caution. We can very easily get into a nightmare of tangled classes and override methods. We also can only inherit from ONE thing and one thing only. An object can't be both a Car and a Motorcycle. It can be one or the other.
In programming we have the saying favour composition over inheritance. We should compose our classes from other classes that implement the behaviours we need.
Solid Principles
S- Single Responsibility Principle -
O- Open Close Principle - Open for extension but closed for modification.
L - Liskov Substitution principle. This principle states that if you substitute a parent class with a child class then it shouldn't break your application. Building code that is maintainable and reusable.
I - Interface Integration Principle - Instead of one fat interface many small interfaces are preferred based on groups of methods, each one serving one submodule.
D - Dependancy Inversion - High-level modules should not depend on low-level modules.
Temple of OO
Inheritance
Polymorphism
Abstraction
Encapsulation
Coder Dojo
this week Coder Dojo was held at Code Clan which introduces young people to code. We used a microbit to create a game of Rock Paper Scissors and display different things dependant on the input so when button A was pressed, it would display a name, when B was pressed, it would show the string "Hello Dad" and on tilt it showed a smiley face! it was really cool to see young people getting involved in this kind of thing! I loved it and also really want a microbit.... Its something i'll do again definitely.
Day 4- All Day Lab
this lab was so much fun... it was to model a fantasy adventure. The game will have players, who will have a number of health points and weapons/spells. It took a lot of thinking and 3 Minds to make but it's been one of my favourite days! Game logic and I tend not to be friends but getting involved with this and having two really wonderfully talented team members helped!
we planned best we could but theres always changes as there is always an error something you don't think about but its such a good place to start! I can get a bit overwhelmed sometimes when I initially look at a task but then when you plan things out it breaks it down into really small manageable pieces!
Weekend homework
Rays Music Exchange - Basically was just recapping the whole week. It's been a heavy week on the brain, although I enjoyed the homework and It solidified everything from this week. The part I most enjoyed was planning the work and how everything is connected through interfaces or abstract classes and using TDD. Ive finally come to enjoy TDD... who knew.
Job Hunt
Job Hunt Continues... ! possible employers Hello! if anyone is looking for a super keen graduate developer get in touch, id love to her from you!
on to week 13...