Notices
Results 1 to 17 of 17
Like Tree1Likes
  • 1 Post By Strange

Thread: Programming

  1. #1 Programming 
    Suspended
    Join Date
    Jun 2012
    Posts
    344
    What's the main difference between procedure and object? Is python object oriented? Which is more efficient?


    Reply With Quote  
     

  2.  
     

  3. #2  
    Forum Masters Degree
    Join Date
    Aug 2011
    Posts
    703
    Object-oriented is a programming scheme used to help people code better: it help people understand your code better, allow easy extension of your code, and also help you debug your own code better. In object-oriented: all your procedural code is stored in an 'object'. An object is just a container which stores all of the function provided by your codes, which has localization & access protection from outside to hide all its complexity from other peoples' code. Some object-oriented language (like Java) also allow users to 'extend' the function of an 'object' into doing another function without modifying the original code (this called overriding/overload) which help programmer avoiding doing messy stuff.

    -It's an advancement in programming practice. Previous changes was the removal of the "go-to" functionality from any existing modern programming language.

    *Source: this is what I understood from Java textbook

    P/S: for most CPU efficient code it would be most likely procedural because it skip all new variable assignment and 'objectifying' performed in object-oriented programming, but the most CPU intensive code wasn't due to this workload, but instead is whether the code doubled or tripled or quadrupled(!) the workload depending on how many loop it handle (especially when it handle a million loop of data). The way to measure how CPU workload grow is called 'O', and it depend on the design and less on those 'objectifying' workload. 'Objectifying' code is dwarfed by CPU load caused by inefficient design when handling large data.


    Last edited by msafwan; July 23rd, 2012 at 10:52 PM.
    Reply With Quote  
     

  4. #3  
    Brassica oleracea Strange's Avatar
    Join Date
    Oct 2011
    Location
    喫茶店
    Posts
    16,585
    Object-orientated programming is a way of structuring code and data. It is intended to separate the function of a piece of code from the details of the implementation.

    A procedural language is one where the functions is defined as a series of sequential operations: do this, then this, then this.

    Most object-oriented languages are procedural (C++, Java, Python). Nearly all modern procedural languages have support for object-oriented programming (C#, Python, even Perl ).

    The alternative to procedural languages are things like functional languages, such as ML, Prolog, Lisp, F#. These rely more on defining the functions to be performed rather than the steps to be followed (not a good description!). Some of these support both functional and procedural models; there are very few pure functional languages.

    Many modern functional languages also support object-oriented programming.

    With modern compilers, there should not be a significant difference in efficiency. Object-oriented languages are used for embedded and high-performance computing.
    Without wishing to overstate my case, everything in the observable universe definitely has its origins in Northamptonshire -- Alan Moore
    Reply With Quote  
     

  5. #4  
    Forum Freshman
    Join Date
    Jul 2012
    Posts
    38
    Quote Originally Posted by Strange View Post
    Object-orientated programming is a way of structuring code and data. It is intended to separate the function of a piece of code from the details of the implementation.

    A procedural language is one where the functions is defined as a series of sequential operations: do this, then this, then this.

    Most object-oriented languages are procedural (C++, Java, Python). Nearly all modern procedural languages have support for object-oriented programming (C#, Python, even Perl ).

    The alternative to procedural languages are things like functional languages, such as ML, Prolog, Lisp, F#. These rely more on defining the functions to be performed rather than the steps to be followed (not a good description!). Some of these support both functional and procedural models; there are very few pure functional languages.

    Many modern functional languages also support object-oriented programming.

    With modern compilers, there should not be a significant difference in efficiency. Object-oriented languages are used for embedded and high-performance computing.
    As a programmer by trade, I just wanted to weigh in here and make one small correction. It is not very common to use an object-oriented language for embedded programming. In fact, even the development of modern operating systems on modern computers do not use object-oriented programming languages -- they tend to stick with languages like C (as opposed to C++). Windows, Linux, Unix (and Mac OS as a result), etc. were/are all written in C.
    Reply With Quote  
     

  6. #5  
    Suspended
    Join Date
    Jun 2012
    Posts
    344
    I am currently trying to master python. Some people tell me that C++ is better, which do you guys suggest?
    Reply With Quote  
     

  7. #6  
    Forum Freshman
    Join Date
    Jul 2012
    Posts
    38
    Quote Originally Posted by Wise Man View Post
    I am currently trying to master python. Some people tell me that C++ is better, which do you guys suggest?
    It depends on what you are trying to accomplish. Generally, if you are programming for a career, then you'll most likely want to learn C++ as that carries over to the more popular business languages (C#, Java, C/C++). However, if you're trying to just get introduced to programming in general, then stick with Python until you learn it well, then you can consider whether or not you want to move on to more low-level languages (or high-level languages even).
    Reply With Quote  
     

  8. #7  
    Brassica oleracea Strange's Avatar
    Join Date
    Oct 2011
    Location
    喫茶店
    Posts
    16,585
    Quote Originally Posted by ccoale427 View Post
    As a programmer by trade, I just wanted to weigh in here and make one small correction. It is not very common to use an object-oriented language for embedded programming.
    I agree (I didn't say it was common). However, even a decade or two ago, it would have been inconceivable to use C++ for an embedded system but it is slowly gaining some ground there. It helps that processors are fast enough, and memory cheap enough, that any overheads have become somewhat less significant.
    Without wishing to overstate my case, everything in the observable universe definitely has its origins in Northamptonshire -- Alan Moore
    Reply With Quote  
     

  9. #8  
    Brassica oleracea Strange's Avatar
    Join Date
    Oct 2011
    Location
    喫茶店
    Posts
    16,585
    Or, as a learning tool, C# looks pretty good. I haven't used it seriously, just played around a bit. I was quite impressed.
    Without wishing to overstate my case, everything in the observable universe definitely has its origins in Northamptonshire -- Alan Moore
    Reply With Quote  
     

  10. #9  
    Suspended
    Join Date
    Jun 2012
    Posts
    344
    print('Thanks guys')

    python language,
    Reply With Quote  
     

  11. #10  
    WYSIWYG Moderator marnixR's Avatar
    Join Date
    Apr 2007
    Location
    Cardiff, Wales
    Posts
    5,760
    Quote Originally Posted by Strange View Post
    Or, as a learning tool, C# looks pretty good. I haven't used it seriously, just played around a bit. I was quite impressed.
    i have, and whilst i agree with the assessment that C# is pretty useful, it also comes with the overhead of having to use Visual Studio, whereas for many other languages you can get by with a text editor
    "Reality is that which, when you stop believing in it, doesn't go away." (Philip K. Dick)
    Reply With Quote  
     

  12. #11  
    Forum Freshman
    Join Date
    Jul 2012
    Posts
    38
    Quote Originally Posted by marnixR View Post
    Quote Originally Posted by Strange View Post
    Or, as a learning tool, C# looks pretty good. I haven't used it seriously, just played around a bit. I was quite impressed.
    i have, and whilst i agree with the assessment that C# is pretty useful, it also comes with the overhead of having to use Visual Studio, whereas for many other languages you can get by with a text editor
    There is nothing stopping someone from using the command-line to build their C# programs (aside from it being a "pain" for some people).
    Reply With Quote  
     

  13. #12  
    Brassica oleracea Strange's Avatar
    Join Date
    Oct 2011
    Location
    喫茶店
    Posts
    16,585
    Quite. I have used Visual C++ in a purely command-line based environment so I don't see why the same shouldn't be true for C#.

    But I like Visual Studio; development tools have always been among the best things Microsoft have produced because the developers use them. I can only assume they don't use their own documentation tools, for example. (For a long time they didn't use their own server OSs. And it showed.)
    ccoale427 likes this.
    Without wishing to overstate my case, everything in the observable universe definitely has its origins in Northamptonshire -- Alan Moore
    Reply With Quote  
     

  14. #13  
    WYSIWYG Moderator marnixR's Avatar
    Join Date
    Apr 2007
    Location
    Cardiff, Wales
    Posts
    5,760
    Quote Originally Posted by ccoale427 View Post
    There is nothing stopping someone from using the command-line to build their C# programs (aside from it being a "pain" for some people).
    depends whether you're talking about websites or web-independent programs
    the former i would do the manual coding in the code-behind portion, but would not attempt to replicate all the asp:xxx tools by hand
    the latter mostly gets done manually anyway, although there's the issue of how you're going to compile outside Visual Studio

    in short, you CAN do manual coding for C#, but it seems rather pointless since you're making life hard for yourself by ignoring the tools at your disposal
    "Reality is that which, when you stop believing in it, doesn't go away." (Philip K. Dick)
    Reply With Quote  
     

  15. #14  
    Forum Freshman
    Join Date
    Jul 2012
    Posts
    38
    Quote Originally Posted by marnixR View Post
    Quote Originally Posted by ccoale427 View Post
    There is nothing stopping someone from using the command-line to build their C# programs (aside from it being a "pain" for some people).
    depends whether you're talking about websites or web-independent programs
    the former i would do the manual coding in the code-behind portion, but would not attempt to replicate all the asp:xxx tools by hand
    the latter mostly gets done manually anyway, although there's the issue of how you're going to compile outside Visual Studio

    in short, you CAN do manual coding for C#, but it seems rather pointless since you're making life hard for yourself by ignoring the tools at your disposal
    I entirely agree; however, I was physically referring to the compilation process when I said "build" (i.e. invoking csc from the command-line). Personally, I absolutely love the Visual Studio IDE (especially for C# programming). But, I was just explaining to marnixR that using the IDE is not required to actually compile C# programs, as many people are fooled into believing. The IDE is merely a front-end to the command-line compilers/tools (for the most part) -- even with ASP.net.
    Reply With Quote  
     

  16. #15  
    Suspended
    Join Date
    Jun 2012
    Posts
    344
    So what editor do you guys reccomend using? I stick to Vim.
    Reply With Quote  
     

  17. #16  
    WYSIWYG Moderator marnixR's Avatar
    Join Date
    Apr 2007
    Location
    Cardiff, Wales
    Posts
    5,760
    i tend to use UltraEdit, more out of historical contingency rather than from a well-researched weighing of pros and cons
    "Reality is that which, when you stop believing in it, doesn't go away." (Philip K. Dick)
    Reply With Quote  
     

  18. #17  
    Forum Freshman
    Join Date
    Jul 2012
    Posts
    38
    Quote Originally Posted by Wise Man View Post
    So what editor do you guys reccomend using? I stick to Vim.
    I tend to use Notepad++ for PHP, JavaScript, CSS, etc. I use Visual Studio for C# and C++.
    Reply With Quote  
     

Similar Threads

  1. Programming help
    By J_live in forum Computer Science
    Replies: 4
    Last Post: February 20th, 2011, 02:52 PM
  2. Programming
    By thyristor in forum Computer Science
    Replies: 8
    Last Post: December 12th, 2009, 04:41 PM
  3. New to Programming
    By CarpeDiem in forum Computer Science
    Replies: 19
    Last Post: November 8th, 2009, 09:50 PM
  4. Programming
    By thyristor in forum Computer Science
    Replies: 3
    Last Post: June 5th, 2008, 09:40 AM
  5. C programming
    By ert in forum Computer Science
    Replies: 6
    Last Post: October 4th, 2007, 03:55 AM
Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •