3 Replies - 534 Views - Last Post: 07 March 2011 - 03:37 AM

#1 skifozoa  Icon User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 37
  • Joined: 16-January 11

Some question to broaden my general CS knowledge, which I'm lackin

Posted 28 February 2011 - 05:56 PM

I can program a little bit, but since I have never studied computer science, I'm unable to place my mechanical ability to compile and execute a simple program in the bigger context that are computers. The answer to these three questions might give me some more insights and inspire me to do some further research, ...

thanks for any info you can provide me with!


- Do IDE's (Netbeans, Eclipse, Visual Studio,...) rely (in the background) on a compiler of the corresponding SDK (javac.exe, csc.exe, vbc.exe, cl.exe,...) or do IDE come with their own independent compiler? Is there any form of standardization that yields the resulting byte code files reliable/identical for the different compilers?

- Is there a way to determine if an executable is written in byte code or native code?

- Does an executable that is written in native code and works on my computer under Windows also work on my computer under say Ubuntu? (why not? I thought native code was written processor specific not OS specific)

Is This A Good Question/Topic? 0
  • +

Replies To: Some question to broaden my general CS knowledge, which I'm lackin

#2 lordofduct  Icon User is offline

  • I'm a cheeseburger
  • member icon


Reputation: 2531
  • View blog
  • Posts: 4,631
  • Joined: 24-September 10

Re: Some question to broaden my general CS knowledge, which I'm lackin

Posted 01 March 2011 - 07:59 AM

1) it depends upon some compiler in the background. Some may use the compiler that came w/ the SDK, some may use their own compiler, some may use a compiler you tell it to use.

2) technically yes. And that's technically in the 'technical' sense, not the misused 'sort of' sense. It isn't straight forward because the idea of 'bytecode' is pretty abstract. Both Flash and .Net use byte code, but neither look anything alike.

3) code written for one OS may not work for another. It all depends on what things it is attempting to access. If it is accessing stuff related to the OS, then it only works on that OS. And most software accesses OS specific stuff, because the OS supplies access to things like graphics and the sort to make the developers job easier.

Thing is there are design patterns to deal with this. You can write code that resolves which OS you're on and adjusts its operations based on it. Or there are libraries designed to function on more then one OS that already do this (take for instance GTK+, which can work on both *nix running X windows, and Windows if installed correctly).

Actually the last thread I was in covered one of the design patterns that makes this easy. That is the 'Abstract Factory' design pattern. Look at the wikipedia article for it and you'll see what I mean: http://en.wikipedia....factory_pattern

This post has been edited by lordofduct: 01 March 2011 - 08:00 AM

Was This Post Helpful? 2
  • +
  • -

#3 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: Some question to broaden my general CS knowledge, which I'm lackin

Posted 03 March 2011 - 06:18 PM

> I can program a little bit, but since I have never studied computer science,

These aren't really computer science questions. You might want to Google the word and check out the syllabi of top universities to understand what CS means.

> Do IDE's (Netbeans, Eclipse, Visual Studio,...) rely (in the background) on a compiler of the corresponding SDK (javac.exe, csc.exe, vbc.exe, cl.exe,...) or do IDE come with their own independent compiler?

Varies. As you might imagine, there's no rule on how a program should function. Typically an IDE and the compiler are decoupled. Whether the compiler came with the IDE distribution or is separate is another question.

> Is there any form of standardization that yields the resulting byte code files reliable/identical for the different compilers?

Not sure what precisely you asked here. Is there a standard that tells you exactly what output a compiler gives you? There may or may not be. Depends on language, etc. Identical? Not happening unless you take two compilers following the same standard that mandates precisely the same output (no real examples of this).

> Is there a way to determine if an executable is written in byte code or native code?

Inspect the file. If the data is executable by a processor, it is native.

> Does an executable that is written in native code and works on my computer under Windows also work on my computer under say Ubuntu?

No. For one thing, executable file formats differ across operating systems, unless they were designed to match. Windows use PE format, Linux uses ELF. The other point is that executables rely on underlying operating system behavior. This differs, obviously.

Now, if you take arbitrary blocks of native code that are just processor instructions (like JITted snippets) that's going to work fine across operating systems, given the same processor. But real world executables are a bit more than that.
Was This Post Helpful? 1
  • +
  • -

#4 skifozoa  Icon User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 37
  • Joined: 16-January 11

Re: Some question to broaden my general CS knowledge, which I'm lackin

Posted 07 March 2011 - 03:37 AM

thanks for the info. Appreciated!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1