Posts

Showing posts with the label Design patterns

Treehouse Intermediate Course - Part 14 (Delegation 1)

Image
So a slight change of plans - one more theoretical course before the practical one. I'm doing that because I get the feeling that delegation is going to be useful before the practical courses. So I'm going to do this one - a bit shorter than the last two. Some today before going to a barbecue! Start Time - 12:15 Introduction to Design Patterns During days of early software development, there were general problems, which have general solutions. These are called DESIGN PATTERNS! General and reusable, regardless of the domain. Decorator pattern - structural pattern. This is concerned with how we add responsibilities to an object dynamically at run time, rather than at build time etc. So a general intro! Racing Horses Cool, a link to a game! Right source code copied over. I like the sound of this. There are horses with max speed. But they won't run at that all race. So their speed will be varied during the race by querying a speed. So the random function I a...

Angela Yu Course part 8 (up to lesson 94)

Image
Continuing! Last time, classes were introduced. These seem to be - generally speaking - the way to go in all coding that involves objects. So the first part is going to be about object-oriented programming, something Pasan taught via the 'tower' game. That was a bit confusing to be honest, so hopefully this will clarify things! As before, I only have around half an hour - one our max, so here goes! Object Oriented Programming Machine Code - made up of 0 or 1. Technically, you could run with MC and do billions of lines of this but it would take forever! 1970s - C programming language. This is where all the other languages came from. Procedural Programming Language - Do this, then this, then this....repeated! Restaurant analogy - ONE person doing a long list of things including waiting on the tables, taking the orders...etc etc. Instead, you could have one person for the waiting, one for cooking. Good analogy! So in the restaurant analogy, messages can be passed aroun...

Build A Simple iPhone App - Part 3

Continuing with the course! So I've got the basic layout features pretty much sorted, complex as they are. It looks like for the next part that I'll create an array and link this to the code. Then this will bring up different facts from the array. It will be good to put this into practice. The more practice, the more it will make sense. That's the idea at least! Creating a Data Collection Collections - data types that allow you to create and manage groups of information. An array works best here - we do not need dictionaries! I know the difference between these from before. @IBAction func showFact() {                  let facts = [ "Michael Schumacher has won the most F1 races and championships" , "Game of Thrones started in 2011" , "Hugh Grant starred in About a Boy" ]                  funFactLabel . text = facts[ 1 ]               ...