Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Let's talk about classes
New Posts  All Forums:Forum Nav:

Let's talk about classes

post #1 of 2
Thread Starter 
In particular I would like to talk about Python's classes and when is the right and wrong times to use them. I recently learned how classes work, and they're basically wonderful, and now I seem to want to put everything into classes. It's getting to the point where I'll write a new program in all classes, maybe 4 or 5 of them, and then main is just hanging out in the bottom there about 3 lines long. This seems like a pretty good idea when I'm writing the code, but when I take a step back it looks overly complicated. Sometimes it doesn't though, and I even manage to drop the line count while improving readability.

It's kind of hard to Google up reading material specifically relating to classes and Python. The internet exists to make people money apparently, so most search results come back as offers for learning classes or courses. I did however find this nice video on Youtube from Pycon 2012. It's pretty much exactly the topic I'm looking at here.

I would like to know what else is out there as far as reading and watching materials goes. Your own 2cents.gif on the matter is of course welcome. I would also like to know how people look at classes in other OOP languages and how those views differ from the 'Pythonic way'.
post #2 of 2
I am not familiar with Python. However this is how I go about creating classes in c++, c#, Java.

- object <- proper noun, and pronouns
- Classes <- noun
- Collection of objects <- plural noun
- Methods, functions, operator <- verbs( when it mentions things that is does )
- Plural is important
- Adjectives <- attribute values <- attribute of a class
- Adverbs -> modifies a method
- Object(GR)- parameter to the verb, what the verb works on

Basically we encourage lots of classes whenever it makes sense to have one.
2009
(15 items)
 
   
CPUMotherboardGraphicsRAM
i7 920 4.0Ghz 1.20v golden? Asus p6x58D Premium 770gtx Windforce OC ocz gold 1600 8-8-8-24-74-1T 
Hard DriveCoolingOSMonitor
x25-m80G2 Black640 H100 GT AP-15s Windows 7 Pro. 64 bit Dell U2410 1920x1200 IPS 
PowerCaseAudio
corsair tx 850 antec 1200 SoundBlaster ZX 
CPUMotherboardGraphicsRAM
Intel i7 3720qm(ivy) 2.6 Sager GTX 670m 8 gig 
Hard DriveKeyboardPower
80gig mssd steel series Huge power brick 
  hide details  
Reply
2009
(15 items)
 
   
CPUMotherboardGraphicsRAM
i7 920 4.0Ghz 1.20v golden? Asus p6x58D Premium 770gtx Windforce OC ocz gold 1600 8-8-8-24-74-1T 
Hard DriveCoolingOSMonitor
x25-m80G2 Black640 H100 GT AP-15s Windows 7 Pro. 64 bit Dell U2410 1920x1200 IPS 
PowerCaseAudio
corsair tx 850 antec 1200 SoundBlaster ZX 
CPUMotherboardGraphicsRAM
Intel i7 3720qm(ivy) 2.6 Sager GTX 670m 8 gig 
Hard DriveKeyboardPower
80gig mssd steel series Huge power brick 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Let's talk about classes