Of all the freedom of choice among the available blogging services on the Internet, deciding on settling with Blogger (or "Blogspot") was a difficult decision for me. Although I have had experience with most of the blogging services (ie. Tumblr, WordPress, LiveJournal, Blogger, etc), weighing between the pros and cons of each still took a bit of time. In the end, I deemed Tumblr to be too distracting, did not like WordPress' post editor, and found LiveJournal to be a bit too buggy for my liking. That left me with Blogger. I have actually done a similar course blog (as compared to sLogs) on Blogger before, so it probably was a decent choice since I am already familiar with this environment.
However, to fully set up this blog with "style" and other components such as background music or extensions as such, it's probably going to take me a bit (which is within expectation). Hopefully I will update this blog every time a topic concludes. If not, then once a week (and no less frequent).
To be honest, I do find blogging a good idea to help organize and refresh the material learned in class. In order to write a blog post, one must fully understand both clearly and logically the material to express it in their own words. It would also be beneficial to come back and reread the posts written (as mentioned in the instruction PDF) for review. Although most notes are written in the notes.pdf, I will sum up what I found interesting and significantly notable taught in class.
Up until now, here is a brief list of aforementioned knowledge (in the format such that a study sheet can be formed for myself towards the end of the semester).
Objects/Classes:
- has type(/class), value, methods/functions/operators
- mutable
- attaching method to class blueprint:
- Class.method = outside_method
- own methods defined (dented) within class body
- Big Three:
- __init__(self) //construction, 2 stages
- Brand "new" object created with attributes
- init method declares initial state
- __str__(self) //print
- __eq__(self, other) //equals ==
- Optional + Applicable Only:
- __add__; __lt__; __mt__; //standard operations, etc.
Properties:
- manages access by end users
- private (instead of public)
- notations/conventions/grammar:
- _var
- _method_name
- #"""
- #comments
- #"""
- maps usage of var to its private methods
- var = property(_getter,_setter,_del,_documentation)
- leave out methods/set to "None" to disable corresponding functions
- Example: _var = (_get_var, _set_var, None, """@param type var:description""")
Composition:
- parallel structure
- borrow other class/code
- instance of one class in another
- individual sets of attributes/properties
Inheritance:
- no duplicate code (avoid error)
- group objects w/ similar attributes/properties
- hierarchy
- Parent: Super class
- Child: subclass
- def subclass (Superclass):
- subclass is an instance/child of Superclass
- avoiding duplication of documentation:
- Inherited: no need
- Extended: how extended
- Overridden: how overridden
Abstract Data Types (ADTs):
- suppress technical details to end users; expose value + what var is worth
- OBJECTS (ie):
- list: sequence of items, add, remove, access position;
- stack: specialized list, only access to most recent item, Last In First Out (LIFO)
- dict: collection of items, accessed by associated keys
Usable Code (misc.):
- pass //"continue"
- if __name__== "__main__": //executing only if in own module
- import doctest //doctests
- doctest.testmod()
- @type var: type //variable type declaration
- description
- @rtype; type //return type declaration
- description
- @param type var: description //"better" variable declaration
- "str{}",format(var) //can use simply {} w/o ints
- from module import Class //importing
- TIPS; MAKE SHALLOW (shadow?) copies to prevent accidental modification
- ie: new_list = old_list[:]
- new_list = [expr for x in L if condition //list comprehensions + filters
- TIPS: circular for loops for lists
- for i in range(len(s)):
- function([i] + [i-1]) // 0 can go to -1 to loop from first back to last element
- type(var).__name__ //returns class name
- str = "seperator".join(str(x) for x in list) //using list comprehensions
- unittest //written before code, represent interesting cases
- setUp(self) //set up for each individual test case, used before each
- tearDown(self) //reset to none (default), used after each
- assert bool, "error msg"
- testSmallestArgs, testBoundaryCases, testTypicalCases
And last but not least, IMPATIENCE, HUBRIS, LAZINESS.