3 Replies Latest reply: Apr 15, 2014 4:05 AM by jwenting RSS

Why objects are said to have physical reality when they are just software programs?

0b5fc302-7c76-48af-be15-6146a99280a8 Newbie
Currently Being Moderated

I am very new to java, infact to the programming world, and am confused about classes and objects. Why do we need a class to create an object? How and when these objects find physical reality? And why do we need to create a software model of a physical thing? Where are these objects and classes stored?  Please help. Gone through 10+ websites and 4 books ,couldn't get the clear picture.

  • 1. Re: Why objects are said to have physical reality when they are just software programs?
    rp0428 Guru
    Currently Being Moderated
    Why do we need a class to create an object?

    Why do you need a house before you can create a bathroom inside that house? An object is a 'member of' a class.

    How and when these objects find physical reality?

    How and when does a 'bathroom' find reality? When you create it.

    And why do we need to create a software model of a physical thing?

    Why do you think that is necessary? It isn't. A model shows what 'might' become a physical reality. Do you need to draw a blueprint for a house before you build it? No. Is is a good idea to create a blueprint for a house? Of course - otherwise some lazy/dumb/incompetent contractor (programmer) might forget that the toilet needs to have sewage and water connections. You might wind up with a toilet that has nowhere to flush so it empties onto the floor.

    Where are these objects and classes stored?

    What 'physical' places are available for them to be stored? On disk as source and class files and in memory when the the program that uses those classes is loaded/executed.

  • 2. Re: Why objects are said to have physical reality when they are just software programs?
    TPD-Opitz-Consulting-com Expert
    Currently Being Moderated

    0b5fc302-7c76-48af-be15-6146a99280a8 wrote:

    Why do we need a class to create an object?

    I'ts almost like a construction drawing of a car. This drawing tells you e.g. what the car will look like an how many persons it can carry. But the drawing is not able to do that. But the real car build based on that drawing is able to do things planned in the drawing. But the drawing does not tell what horsepower the cars engine may have. There will be different engines that may fit in the car giving it differen maximun speed and scceleration.

     

    Similar thing is with java classes and objects. A class describes what the objects created from that class are able to do. When You see a class you get a clear picture of those abilities without having an object yet. From that class you get objects having all the same behavior but the objects may differ in the properties given to them.

    0b5fc302-7c76-48af-be15-6146a99280a8 wrote:

    How and when these objects find physical reality?

    Not sure what you mean by that. A computer program has no physical reality in a way you coult touch. The physical reatity of a computer program is representet by the magnetic alignment of goups of tiny areas  at your hard drive or electric charge/discharge of the capacitors of your computers RAM. So there is no physical reality for a computer program.

     

    0b5fc302-7c76-48af-be15-6146a99280a8 wrote:

    And why do we need to create a software model of a physical thing?

    Imagin:

    You are a car manufactorer. You have to prove that your cars are safe for their passengers in case of a crash. How do you check that? Are you willing to build hundreds of physical cars only to destroy them in a test crash?

    The better way is to simulate the characteristics of the construction and the materials it will be build from in a computer program and do (most of) the crash test with that computer program untill you find a setup that is prommissing to pass a real physical crash test.

     

    0b5fc302-7c76-48af-be15-6146a99280a8 wrote:

    Where are these objects and classes stored?

    This question also has more than one answer:

    1. Computer programs are stored in the world wide web and/or your computer (which effectively is part of the www).

    2. Computer programes are stored on some kind of durable memory (punch tapes, magnetic tapes, barcodes, magnetic disks, memory cards/sticks, optical disks...)

    3. Computer programs are stored in so called files at those locations and memory types. There are 2 types of files: human readable files and machine readable files. The human readable files are used by programmers to create or change a program. Some kind of program (called compiler or interpreter which is not the same and Java uses both) converts human readable files into machine readable files. Machine readable files contain the program as a sequence of numbers that a computer will interpret as commands and their parameters.

    4. The machine readable files cannot be executed as long as they are at the locations and memories mentioned earlier. before a machine readable program can be executed it must be copied to the computers RAM.

     

    hopefully this didn't made things worse... ;o)

     

    bye

    TPD

  • 3. Re: Why objects are said to have physical reality when they are just software programs?
    EJP Guru
    Currently Being Moderated

    > Why objects are said to have physical reality when they are just software programs?

     

    They aren't 'said to have physical reality' at all. Where did you get that?

  • 4. Re: Why objects are said to have physical reality when they are just software programs?
    jwenting Journeyer
    Currently Being Moderated

    For clarity:

    to future readers: EJP here replied to a known forum troll who's since been removed.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points