What is the effect of primitive data types on the nature of programming languages?

why the languages which are having primitive data types in them are considered to be not purely object oriented ,why is said that any language which depends on such primitive data types has actually an involvement of the machine architecture and hence it is not called a pure-object oriented programming language

Replies

  • Anoop Kumar
    Anoop Kumar
    You might heard that "Using primitive type is faster and cost effective (memory+time) than using object oriented". This is the reason object oriented languages still allow primitive types.

    Why it is faster and cost effective:
    How class variable works:
    When you declare String str = new String ("Z").
    variable str will point to a memory location to an object. Now this object has it's own instance variable which creates an array of char to store the value passed in, i.e. : "ABC".
    (And some other things whatever String class require to initialize and store the value).
    For java see: code of String.java.

    Now primitives:
    When you declare a char c = 'Z'; . variable c will point directly to a memory location where char ' Z' is stored.
    So obviously using char is faster and cheaper.

    I hope this answers your question. Now, what's the pro and cons, dig it out 😉

    PS: I suggest, not to get involved in pure or object oriented languages. They develop for usability not to fulfill criteria of something called Pure Object oriented or not.

You are reading an archived discussion.

Related Posts

If the UNIX, when is allowed to run on another machine then it needs c compiler for it ,so when we install the compiler for it ,then is that a...
CrazyEngineers Presents Hunt For India’s Best Academic Project ​About The Contest CrazyEngineers is on a mission to hunt for the best academic project being worked on by engineering students all...
Notice to contestants: If you have submitted your entry, you should've received a confirmation email regarding it. If you haven't received it, you can contact us at contact@crazyengineers.com Stage I...
We've 5 hoodies left from the batch ( 2 "M" size, 2 "L" size and 1 "XL" size). If anyone wants to own the hoodie; please write to store[at]crazyengineers[dot]com. Each...
Quote: Programming quantum computers is vastly different than programming conventional ones. To get a better idea of what it could be like, this article steps through the process of programming...