Basically I'm starting to play around with java and I learned about how source code is compiled into object code when it's compiled. So I began to wonder if source code can be compiled into object code can object code be translated into source code? If not, why not?
asked Sep 07 '10 at 19:24
Yup, this is called decompiling - it can be performed on MSIL (Microsoft Intermediate Language, the language C#, VB.Net etc compile into). In theory it should be quite easy to "decompile" java "bytecode" (the object code) back into source code, however it's a practice that is often frowned upon. Also, the source code will not necessarily be 100% the code you entered - it may have been optimised and things may have been renamed - e.g.:
could end up as something like:
Hope this sort of helps!
answered Sep 08 '10 at 12:37
yes it can: but because when you write code in a high level language there are many ways the compiler can translate it to assembly. when you go though a disassembler or de-compiler (IDA is popular) it can also take that code and translate it to many ways in your high level language.
what im getting at is that when you go from high level to low level and back to high level, the code does not like anything like the code you started with, and because comments are not compiled to the object, it is very hard to reverse engineer.
point being yes it can be done, but not everyone can do it, and understand it.
there are supposedly tricks to do to make it harder to do this, but they often times make the code inefficient.
answered Sep 08 '10 at 20:17