can everyone show me the differences between procedure and funtion /
procedure and objec-oriented ?
thanks !

Recommended Answers

All 3 Replies

Have you tried looking this up on wikipedia or anything?
And I don't think everyone will help. That'd be too redundant.
Anyhoo:
Procedure, I believe, is the arrangement of code into one long thread that runs beginning to end. Programs of this style take input and give output but should eventually terminate once all tasks are completed. All the instances of datatypes are declared and defined in the main program and can be accessed at any time.

Then, Procedure/Function would probably be like the above, but with often-reused pieces of code outside the main program so that the program can call the function again and again to calculate something. Some instances of datatypes are declared inside the functions and cease to exist after the function ends, but their values are still able to be used by the main program based on the returned results. This approach compartmentalizes code and often makes it cleaner on repetitive tasks. It also enhances 'modularity', which is where the programmer can completely change the purpose of the function or even remove it without screwing up the rest of the program. It's a good way to work, as it makes updating code easier.


Object-oriented programming is a technique that puts certain datatype instances and functions that are related to those instances in a package called a class, which are then called from the main program and the functions called from main. The class functions only operate on the data internal to the class, and this enhances modularity even further. Typically, the data is stored in a private location that tells the program that only that instance of class should be able to interact with its data.

Object Oriented programming allows for cleaner code in many cases, but procedural, procedural/function and object oriented programming all have scenarios where one coding methodology is more appropriate than the other two.


If this wasn't helpful, you'll find a good number of resources online if you care to research first.

This sounds like some type of homework question that you have to answer. I'm going to rely on the old saying "Give a man fish and he will eat for a day... teach a man to fish and he will eat for a lifetime".

This is the internet. Almost anything you'd like to know that can be known is out there if you take the time to look for it. If you are learning programming, which I assume you are, you need to learn how to search quickly, efficiently, and effectively.

Google is your best friend. Learn how to use it and use it well. A properly worded Google search will give you exactly what you want to know in a matter of seconds.

Need to know the definition or history of something? Check the Wikipedia. Try searching for procedural programming and object-oriented programming in the Wiki. I guarantee that you will find a lot of helpful information and useful links on both topics there.

that's all information I need !
Thanks ! :p

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.