30 days with swift — Day 04 — Object Oriented Programming

Guilherme Akio Sakae
2 min readMar 5, 2015

Missed the last day, check here:

OOP

Now we're starting to use some powerful tools, if you have experience with object oriented programming you already now what I'm talking about, classes, inheritance and method override.

Like objective-c, Swift takes advantages of this concept and we’re going to study all of the concepts to really build a solid foundation to further courses and future projects, OOP is everywhere, trust me you really want to know this.

Day highlights

  • Classes: Classes are pretty much equal to structs, but with classes we can use these two (four) concepts below.
  • Inheritance: This concept allows you to inherit properties and behaviours, avoiding code duplication.
  • Overriding: Also you can create custom behaviour depending of your needs, you don’t need to follow the rules all the time ☺
  • Convenience initializers: Lets save some time creating “shortcuts” to initialize our classes, but use with care there’s several rules to follow here. “With great powers comes great responsibilities.”
  • DRY: Don’t repeat yourself, adopt this as your mantra and you’re golden.

Day Conclusion

Big deception today, my ISP just decided to fuck me over, I spent most of the time refreshing the page, pinging my connection, restarting my router and nothing! Right now I’m really mad but I can’t do anything, sadly services providers in Brazil just don’t take the clients seriously. I ran out of energy and it’s probably better just to call the day.

So I’m truly sorry I wasn’t able to met my daily goal but I try to speed up tomorrow. I’m not really mad anymore just tired and sad.

I hope tomorrow will be a better day, thanks for the patience.

--

--