Question??

Why would you want to write a program in a machine-independent language instead of a machine-dependent language? Why might a machine-dependent language be more appropriate for writing certain types of programs??

Comments

  • : Why would you want to write a program in a machine-independent language instead of a machine-dependent language?
    [blue]
    One word--Portability. Its the same reason most pograms
    are written in HLLs then assembly language--bacause they
    are easier to port from one system to another.[/blue]

    Why might a machine-dependent language be more appropriate for writing certain types of programs??
    [blue]
    I could only think of hardware-control programs (like
    device drivers), or some OS programs (like a bootstrap
    or kernel).
    [/blue]

  • : Why would you want to write a program in a machine-independent language instead of a machine-dependent language? Why might a machine-dependent language be more appropriate for writing certain types of programs??
    :


    Which one of the following would you prefer?

    1) your s/w provides solution to 30 windows platform customers.
    2) your s/w provides solution to 30 windows cust, 50 Linux xust ans 60 unix cust?

    obviously, ur choice will be the second option.
    Because you can cover more customers (or customers with whatever platform they prefer)

    This is exactly what other friend described as portablity.

    When u consider C, it has a seperate compiler for windows based machines and Unix/Linus based machines. So its platform dependent.
    But JAVA is intelligent. it converts the code to a byte file which is the same in all the platforms (in other words MACHINE INDEPENDENT)..

    Regards
    Praaveen

  • : : Why would you want to write a program in a machine-independent language instead of a machine-dependent language? Why might a machine-dependent language be more appropriate for writing certain types of programs??
    : :
    :
    :
    : Which one of the following would you prefer?
    :
    : 1) your s/w provides solution to 30 windows platform customers.
    : 2) your s/w provides solution to 30 windows cust, 50 Linux xust ans 60 unix cust?
    :
    : obviously, ur choice will be the second option.
    : Because you can cover more customers (or customers with whatever platform they prefer)
    :
    : This is exactly what other friend described as portablity.
    :
    : When u consider C, it has a seperate compiler for windows based machines and Unix/Linus based machines. So its platform dependent.
    : But JAVA is intelligent. it converts the code to a byte file which is the same in all the platforms (in other words MACHINE INDEPENDENT)..
    :
    : Regards
    : Praaveen
    :
    [red]C is platform independent. So is C++. I am not sure why this myth persists. Stick to C or C++ standards and your code will be platform independant, only thing needed is to recompile for that program. The fact that you have to recompile does not make platform dependant by itself. Sure that can be a pain, but doesn't necessarily mean rewriting code. Incompatibilities crop up when you start using stuff like OS API's and networking. But there are ways around it, but add a bit extra work.

    That 'intelligence' of Java you speak of is a virtual machine, which is added overhead that C and C++ do not have. Java is a terrific language, but is not 'smarter' then any other language. For the record it is possible to write a java app that is not platform independant, and only using the java API libraries. As a simple example:
    [code]
    FileWriter fr = new FileWriter("..\somefile\myfile.txt");//will cause problems in linux but will work in windows
    FileWriter fr = new FileWriter("../somefile/myfile.txt");//will work in both linux and windows[/code]
    [/red]
  • : : : Why would you want to write a program in a machine-independent language instead of a machine-dependent language? Why might a machine-dependent language be more appropriate for writing certain types of programs??
    : : :
    : :
    : :
    : : Which one of the following would you prefer?
    : :
    : : 1) your s/w provides solution to 30 windows platform customers.
    : : 2) your s/w provides solution to 30 windows cust, 50 Linux xust ans 60 unix cust?
    : :
    : : obviously, ur choice will be the second option.
    : : Because you can cover more customers (or customers with whatever platform they prefer)
    : :
    : : This is exactly what other friend described as portablity.
    : :
    : : When u consider C, it has a seperate compiler for windows based machines and Unix/Linus based machines. So its platform dependent.
    : : But JAVA is intelligent. it converts the code to a byte file which is the same in all the platforms (in other words MACHINE INDEPENDENT)..
    : :
    : : Regards
    : : Praaveen
    : :
    : [red]C is platform independent. So is C++. I am not sure why this myth persists. Stick to C or C++ standards and your code will be platform independant, only thing needed is to recompile for that program. The fact that you have to recompile does not make platform dependant by itself. Sure that can be a pain, but doesn't necessarily mean rewriting code. Incompatibilities crop up when you start using stuff like OS API's and networking. But there are ways around it, but add a bit extra work.
    :
    : That 'intelligence' of Java you speak of is a virtual machine, which is added overhead that C and C++ do not have. Java is a terrific language, but is not 'smarter' then any other language. For the record it is possible to write a java app that is not platform independant, and only using the java API libraries. As a simple example:
    : [code]
    : FileWriter fr = new FileWriter("..\somefile\myfile.txt");//will cause problems in linux but will work in windows
    : FileWriter fr = new FileWriter("../somefile/myfile.txt");//will work in both linux and windows[/code]
    : [/red]
    :


    hai
    Thank u for ur infornmation.
    i want u to clarify the following

    Does it mean that platform dependent means re-writing the code alone?

    java is one step ahead than C++ in the way that there is no need to recompile the program.. why do u call java interpreter as an overhead?

    Regards
    Praveen

  • : : : : Why would you want to write a program in a machine-independent language instead of a machine-dependent language? Why might a machine-dependent language be more appropriate for writing certain types of programs??
    : : : :
    : : :
    : : :
    : : : Which one of the following would you prefer?
    : : :
    : : : 1) your s/w provides solution to 30 windows platform customers.
    : : : 2) your s/w provides solution to 30 windows cust, 50 Linux xust ans 60 unix cust?
    : : :
    : : : obviously, ur choice will be the second option.
    : : : Because you can cover more customers (or customers with whatever platform they prefer)
    : : :
    : : : This is exactly what other friend described as portablity.
    : : :
    : : : When u consider C, it has a seperate compiler for windows based machines and Unix/Linus based machines. So its platform dependent.
    : : : But JAVA is intelligent. it converts the code to a byte file which is the same in all the platforms (in other words MACHINE INDEPENDENT)..
    : : :
    : : : Regards
    : : : Praaveen
    : : :
    : : [red]C is platform independent. So is C++. I am not sure why this myth persists. Stick to C or C++ standards and your code will be platform independant, only thing needed is to recompile for that program. The fact that you have to recompile does not make platform dependant by itself. Sure that can be a pain, but doesn't necessarily mean rewriting code. Incompatibilities crop up when you start using stuff like OS API's and networking. But there are ways around it, but add a bit extra work.
    : :
    : : That 'intelligence' of Java you speak of is a virtual machine, which is added overhead that C and C++ do not have. Java is a terrific language, but is not 'smarter' then any other language. For the record it is possible to write a java app that is not platform independant, and only using the java API libraries. As a simple example:
    : : [code]
    : : FileWriter fr = new FileWriter("..\somefile\myfile.txt");//will cause problems in linux but will work in windows
    : : FileWriter fr = new FileWriter("../somefile/myfile.txt");//will work in both linux and windows[/code]
    : : [/red]
    : :
    :
    :
    : hai
    : Thank u for ur infornmation.
    : i want u to clarify the following
    :
    : Does it mean that platform dependent means re-writing the code alone?
    :
    : java is one step ahead than C++ in the way that there is no need to recompile the program.. why do u call java interpreter as an overhead?
    :
    : Regards
    : Praveen
    :
    It is overhead because the JVM is a program. So your program is being run in another program, that adds an extra layer between your program and the processor, that extra layer does not exist in C/C++. That takes extra time to execute. The JVM is getting fast and with care it can come close to the execution speed of C++, so it is not a huge issue, but something to keep in mind.

    If code is not platform independant, that means a rewrite, sometimes a huge one, will be necessary to get it to run on another OS.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories