This week's lab was on inheritance, unittesting (more robust than doctest, you create a subclass of unittest's TestCase to check specific cases for your code) and a bit on property. My group didn't manage to finish it but I think we all generally understood the concepts of all three. Personally, I have to do some reading to get a better grip on property and then see if I can use it on my own. Updates on that to come! :)
This week's lecture was focused mainly on recursion and Dustin did more examples. The remove3s function in particular stood out for me in terms of getting a better understanding of how coding for recursion works. The code side by side with the tracing of the current value of the list in an example with a nested list made it much clearer for me to understand how calling a function within its own body was possible. If you're uncomfortable with recursion, I think it's something good to look at it. I'm more comfortable after I had that concrete example that I could trace through for myself and then check. Figure out the base cases and then do the recursive cases!
I've started reading the code for A1 but the deadline is creeping up on me so I have to get started on some actual coding this weekend. I might get a group going on Monday with a friend so I'll see how that goes.
Until next week, see ya!
Thursday, 30 January 2014
Saturday, 25 January 2014
Week 3: Object Oriented Programming
To start, what is 'object
oriented programming'?
Object oriented programming (OOP) is a style of programming that is used in many different programming languages such as Python(which we are using!), Java and C++. Just as its name suggests, OOP revolves around the idea of "objects". Objects are instances of a class and usually correspond to items or concepts that are in the real world. For example, the 'Dog' objects of the class "Dog" from Exercise 1 last week. These objects have attributes (like Dog.name) and methods (relatable to actions or functions that some item can do or have done to it) like play or call. This makes it easier for people who are not familiar with computer code or a certain programming language to understand what the code is doing. It also breaks up what otherwise would have been large chunks of code that did a variety of operations into smaller, more manageable pieces which are grouped by their relevance to each other.
Seeing as the only coding I've been doing has been this past semester in Python, OOP is the only style of programming that I know and I wasn't even aware that I knew it until doing this course. From the reading that I've done about it and my experience, OOP makes sense; well organized code that is easier to understand because of its association with real life items. OOP also has the benefit of inheritance. This is where one class gets most of its attributes and methods from a parent class (and will also acquire any changes made to its parent class post-creation). Inheritance is useful when you want to modify a class in possibly different, incompatible ways or when the original class was sufficient for one audience and the extension of its features would just create clutter.
I'd love to hear the thoughts of people who have coded in other (possibly less object oriented) programming languages, so comment away! :)
Object oriented programming (OOP) is a style of programming that is used in many different programming languages such as Python(which we are using!), Java and C++. Just as its name suggests, OOP revolves around the idea of "objects". Objects are instances of a class and usually correspond to items or concepts that are in the real world. For example, the 'Dog' objects of the class "Dog" from Exercise 1 last week. These objects have attributes (like Dog.name) and methods (relatable to actions or functions that some item can do or have done to it) like play or call. This makes it easier for people who are not familiar with computer code or a certain programming language to understand what the code is doing. It also breaks up what otherwise would have been large chunks of code that did a variety of operations into smaller, more manageable pieces which are grouped by their relevance to each other.
Seeing as the only coding I've been doing has been this past semester in Python, OOP is the only style of programming that I know and I wasn't even aware that I knew it until doing this course. From the reading that I've done about it and my experience, OOP makes sense; well organized code that is easier to understand because of its association with real life items. OOP also has the benefit of inheritance. This is where one class gets most of its attributes and methods from a parent class (and will also acquire any changes made to its parent class post-creation). Inheritance is useful when you want to modify a class in possibly different, incompatible ways or when the original class was sufficient for one audience and the extension of its features would just create clutter.
I'd love to hear the thoughts of people who have coded in other (possibly less object oriented) programming languages, so comment away! :)
Sunday, 19 January 2014
Weeks 1-2: And so it begins...
...with the first post of the semester!
Week 1's class for me felt unimaginably long, but I have solved the problem in week 2 - a snack to get me through it!
In week 2 we were introduced to Abstract Data Types (ADTs) and recursion. I really like the concept of ADTs, it's a way to define a class and what that class can do without explicitly writing code for it. This way, the class and its methods can be implemented in many different programming languages. On a smaller, more personal scale, I see it as a way of planning out my moves when creating a class for an assignment.
Recursion is where you call on a function within the body of the function itself. It's a really clever way to deal with certain problems and the example on removing nodes that have less than n edges from a graph really helped me to understand where you would use recursion. I suppose part of that is because I was able to visualize the problem more clearly since I've had some exposure to graph theory.
The first exercise was pretty simple, just review of material covered in CSC108. The hardest part was retraining my brain to match the PEP8 style guidelines but I suppose over time I'll get used to it.
Until next time, ¡adiรณs! :)
Week 1's class for me felt unimaginably long, but I have solved the problem in week 2 - a snack to get me through it!
In week 2 we were introduced to Abstract Data Types (ADTs) and recursion. I really like the concept of ADTs, it's a way to define a class and what that class can do without explicitly writing code for it. This way, the class and its methods can be implemented in many different programming languages. On a smaller, more personal scale, I see it as a way of planning out my moves when creating a class for an assignment.
Recursion is where you call on a function within the body of the function itself. It's a really clever way to deal with certain problems and the example on removing nodes that have less than n edges from a graph really helped me to understand where you would use recursion. I suppose part of that is because I was able to visualize the problem more clearly since I've had some exposure to graph theory.
The first exercise was pretty simple, just review of material covered in CSC108. The hardest part was retraining my brain to match the PEP8 style guidelines but I suppose over time I'll get used to it.
Until next time, ¡adiรณs! :)
Subscribe to:
Posts (Atom)