Python: Getting to know Object Oriented Programming

The latest Coursera project was to code Blackjack – a simplified version, with simple scoring instead of true Blackjack rules (before you play and complain). This was, as I said in my last post, a challenge for me. I was very confused about objects at first, in particular how they interrelated. For example, at first it seemed like dealing a card should automatically add a card to a hand. Then I thought about it awhile, and I realized that while true for Blackjack, other card games might have cards dealt to a common area, instead of an individual hand – like Texas Hold ‘Em.

This has also proven very helpful in the next project, a version of Asteroids. Spawning the asteroids and missiles would be far more difficult without object-oriented programming (unless I’m missing something).

I’ve also been teaching myself Tkinter, since the course uses SimpleGUI, which was created for the class. It’s coming slowly, there isn’t a great intro to Tkinter that I’ve found that doesn’t assume more knowledge than I have. I was finally able to code a working metric clock. I translate standard time to a clock of my own creation where there are ten hours in a day, 100 minutes in an hour, and 100 seconds in a minute. It’s pointless, really, but helped my learn some things about Tkinter along the way.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s