Welcome to Gaia! ::

Reply
Object oriented vrs Procedural

Quick Reply

Enter both words below, separated by a space:

Can't read the text? Click here

Submit

What do you prefer?
  Procedural programming
  Object Oriented Programming
View Results

EdThaSlayer

PostPosted: Fri Sep 08, 2006 6:55 am


Object Oriented Programming example:

#taken from byteofpython
#!/usr/bin/python
# Filename: method.py
class Person:
def sayHi(self):
print 'Hello, how are you?'
p = Person()
p.sayHi()
# This short example can also be written as Person().sayHi()


and its output


$ python method.py
Hello, how are you?

-----------------------------------------------------------------------------------------------------------------------------------------
Procedural Programming example sad does the same function as above)


#!/usr/bin/python
#filename:Superior.py
a="Hello,how are you?"

print a


or


#!/usr/bin/python
#filename=Easier.py
def hi():
a="Hello, how old are you?"

print hi()


and its output

Hello, how are you?
PostPosted: Sat Sep 16, 2006 9:30 am


uhh---
someone...

EdThaSlayer


Unknown Variable
Captain

Familiar Citizen

PostPosted: Sat Sep 16, 2006 12:27 pm


If you can do object oriented code, it's usually cleaner and executes much faster than procedural code. I usually code my projects in procedural with few included files during alpha or beta of whatever it is, and overhaul it all with object oriented and linked resources during the finalization, as procedural is usually faster to type out. Of course if the project is going to be fairly huge, I'll just start off with object oriented and linked resources from the start, to save myself a headache later on. ;3
PostPosted: Sat Sep 16, 2006 12:43 pm


Unknown Variable
If you can do object oriented code, it's usually cleaner and executes much faster than procedural code. I usually code my projects in procedural with few included files during alpha or beta of whatever it is, and overhaul it all with object oriented and linked resources during the finalization, as procedural is usually faster to type out. Of course if the project is going to be fairly huge, I'll just start off with object oriented and linked resources from the start, to save myself a headache later on. ;3


Alright-nice answer...iam going to learn OOP but its kind of confusing.
So its better in the long run...
i better change to object oriented when programming huge programs...which are 1000+ lines of code...

EdThaSlayer


Dizy_lizy

PostPosted: Mon Jan 15, 2007 2:46 am


i only know how to program in object oriented but i find that i like how it works.
Reply


 
Manage Your Items
Other Stuff
Get GCash
Offers
Get Items
More Items
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff
Gaia's Games
Mini-Games
Play with GCash
Play with Platinum