Jump to content

OOP, procedural programming, etc.

- - - - -

  • Please log in to reply
2 replies to this topic

#1
jackson6612

jackson6612

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 304 posts
Hi :)

Please help me with queries below.

1: I understand that OOP is not a language rather it's a tool to better organization of data. It is said before most languages were procedural - 'procedure': a series of steps followed in a regular definite order. I think without OOP functionality C++ is a procedural language; OOP adds further features of data handling etc. So, I would say languages, at least C++, is still procedural. Please correct me.

2: "+" is a binary operation. Is a function also an operation rather a set of code which performs particular task?

3: How would you simply define "polymorphism"? Perhaps analogizing it would be better.

4: Does OOP give you better data security and data hiding? "security" and "hiding" in what way? One cay still access data. I mean you don't need password to access anything. Perhaps, it's just that you have to dig a little deeper to mess up things.

Thank you for your time and help.

Regards
Jackson
I'm an outright beginner, learning C++. Using Win XP Pro and Code::Blocks. Be nice to me, please.:)

#2
mebob

mebob

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 490 posts
I'll try to answer your questions:

1. Depends on how you interpret the meaning of those terms, I guess. Most programs, however, aren't procedural in the way you are defining it; think about if/else statements and things. A program rarely follows a definite order, so it isn't a procedure the way you defined it. But, in a way, I guess all programming languages are procedural to some extent.

2. Depends on where it is used; when you are just adding to regular integers, yes, it is normally just one operation. It's even the same, usually, when adding floating point numbers as well.

3. Polymorphism is basically a feature that allows you to create multiple versions of the same function or object, with the same name, for handling different data types.

4. Not that I know of, no. It mean, it is a little bit harder to screw things up, because a lot of the data in a class is stored as private, so it can't be accessed outside the class. But no data security or data hiding.
Latinamne loqueris?

#3
DarkLordofthePenguins

DarkLordofthePenguins

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 409 posts

jackson6612 said:

1: I understand that OOP is not a language rather it's a tool to better organization of data. It is said before most languages were procedural - 'procedure': a series of steps followed in a regular definite order. I think without OOP functionality C++ is a procedural language; OOP adds further features of data handling etc. So, I would say languages, at least C++, is still procedural. Please correct me.

Yes, C++ is a procedural language in addition to being object-oriented. A procedural language is any programming language that uses subroutines. Very few languages are object-oriented but not procedural; the only major exceptions are functional OOP languages like Common Lisp.

jackson6612 said:

2: "+" is a binary operation. Is a function also an operation rather a set of code which performs particular task?

I'm going to assume that by operation you mean operator. A function is not an operator in the same sense that + is because it requires a transfer of control, that is, it requires pushing parameters onto the call stack and branching to a different instruction. The + operator simply puts two numbers through an adder.

jackson6612 said:

3: How would you simply define "polymorphism"? Perhaps analogizing it would be better.

Can't help with this one. My understanding of the actual details of OOP is very limited.

jackson6612 said:

4: Does OOP give you better data security and data hiding? "security" and "hiding" in what way? One cay still access data. I mean you don't need password to access anything. Perhaps, it's just that you have to dig a little deeper to mess up things.

OOP allows for bounds checking by way of making variables private and using set and get functions to access them. These functions can include conditionals that tell the compiler to only perform the operation if the parameter is within a certain range. It's not "security" in the same sense that prompting for a password at login is security.
Programming is a journey, not a destination.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users