Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Software Development Software Development
Search Search
Search for:
Tech Support Guy > > >

Question about software "portability"...


(!)

NuttyBar's Avatar
NuttyBar NuttyBar is offline
Computer Specs
Account Disabled with 67 posts.
THREAD STARTER
 
Join Date: Jun 2012
Experience: Beginner
29-Jun-2012, 05:10 PM #1
Question about software "portability"...
I'm new to computer/software programming.

I wanted to see if anyone here can speculate/knows how software code is directly translated for different "platforms"(operating systems).

For example, some IDEs have options to release code and executables for Mac, Linux, Windows, etc.

But what is the difference in the code?

Or is the difference in the way it is compiled? I don't really understand this.

I compile a simple "Hello World" program under Windows like this:

Code:
#include <iostream>
using namespace std;
int main(int args, char *LOC[])
{
cout << "Hello World";
return 0;
}
Is there some specific "on-code" difference per-platform?
allnodcoms's Avatar
allnodcoms   (Danny) allnodcoms is offline allnodcoms has a Profile Picture
Computer Specs
Member with 610 posts.
 
Join Date: Jun 2007
Location: Hertfordshire - England
Experience: Advanced
29-Jun-2012, 08:02 PM #2
The difference is purely in the way it is compiled. Let's take your example, it simply prints some text to the screen, but the way the operating system achieves this is different on each platform. On Mac OS it may go to the Core Graphics suite, on Windows it would go to DirectX. The code would be exactly the same for each, but the platform specific compilation would add the details relevant to the target OS, adding the DX or CG library calls needed to actually print the data.
Remember that graphic output (even to the level of printing a string) is turning on / off individual pixels on a screen, and C cannot possibly know how to do this for every graphic card, on every monitor and at every resolution, so it farms this out to a platform specific OS call.

Basically, the result of the code is the same, it is just down to how the individual host platform interprets or deals with that result - and that decision is down to the compiler.

Danny
NuttyBar's Avatar
NuttyBar NuttyBar is offline
Computer Specs
Account Disabled with 67 posts.
THREAD STARTER
 
Join Date: Jun 2012
Experience: Beginner
30-Jun-2012, 05:03 PM #3
But, if I may, wouldn't the version of an IDE for a Mac have the Dynamic Link Libraries files and such that are relevant to the graphics software of the Mac OS system be specific to the Mac platform by default?

If so, why can't developers just develop with aided & assisted Mac, Linux, etc. graphics .dll files and such, and emulate the executables on virtual machines running the target specific OS to test it before development and release to prevent bugs?

On top of that, you can also use a prediction basis to map out differences in actual hardware functioning as well, and double-test it on two different platforms by sending the data to a network that a Mac can receive and test at the same time you're writing it for Windows, etc.

Wouldn't that be easier, faster, and cost less than having an executable released and tested constantly under different computers?

That's why I don't get why a program says "Works for Mac, but may not work right." Why not?

Emulate it, pre-test it on specific hardware, and release it only when it's exact or near-exact to the primary OS it is made for.

Example: Game Maker the program runs fine on Windows platforms, but Mac users always complain that it has graphics problems. Wouldn't my advice have helped there?

If not, correct where I am wrong, please.
allnodcoms's Avatar
allnodcoms   (Danny) allnodcoms is offline allnodcoms has a Profile Picture
Computer Specs
Member with 610 posts.
 
Join Date: Jun 2007
Location: Hertfordshire - England
Experience: Advanced
01-Jul-2012, 04:16 PM #4
OK, there's quite a lot going on in there...
Quote:
wouldn't the version of an IDE for a Mac have the Dynamic Link Libraries files and such that are relevant to the graphics software of the Mac OS system be specific to the Mac platform by default?
Yes it would, and it does.
Quote:
If so, why can't developers just develop with aided & assisted Mac, Linux, etc. graphics .dll files and such, and emulate the executables on virtual machines running the target specific OS to test it before development and release to prevent bugs?
Why would they do this? Unless the target in question doesn't have a native development environment (iOS for example) it's a lot easier to port the source over to a target machine and compile there. There are exceptions to this, REALbasic being a good example, and some developers may well run a different OS under VM and test there, but I don't. The emulation would not be a true representation, and it would also effect the performance of the host.
Quote:
On top of that, you can also use a prediction basis to map out differences in actual hardware functioning as well, and double-test it on two different platforms by sending the data to a network that a Mac can receive and test at the same time you're writing it for Windows, etc.
The differences are not in the hardware per se, they're in the OS that sits over the top of it. Under the hood there is little difference between the hardware in a Mac and that in a PC, and Linux boxes are just PCs with a sensible OS on. Different form factors introduce new issues, phones and tablets for example, but in the whole it's how the OS talks to the hardware that introduces the differences between platforms. Predicting problems makes no sense whatsoever when you can actually run it and find them, and doing this over a network, just so you can compile on one machine makes little sense either - port the source and compile locally.
Quote:
Wouldn't that be easier, faster, and cost less than having an executable released and tested constantly under different computers?
Er… No.
Quote:
That's why I don't get why a program says "Works for Mac, but may not work right." Why not?
Because it was probably written for Windoze, by Windoze developers, and compiled on an untested machine with an untested compiler by people who don’t own Macs.
Quote:
Example: Game Maker the program runs fine on Windows platforms, but Mac users always complain that it has graphics problems. Wouldn't my advice have helped there?
Er… No.

A compiler on each platform (unless that platform doesn't have one) is the way to go, and has been for decades. We have a system that works cross platform / OS / form factor, it even supports fridges - it's Java... I rest my case

Danny
NuttyBar's Avatar
NuttyBar NuttyBar is offline
Computer Specs
Account Disabled with 67 posts.
THREAD STARTER
 
Join Date: Jun 2012
Experience: Beginner
02-Jul-2012, 04:01 PM #5
Thumbs down Um ... no.
You seemed to have "mistakenly" missed this part:

Quote:
Emulate it, pre-test it on specific hardware, and release it only when it's exact or near-exact to the primary OS it is made for.
And you can surely agree with me that the Windows version of Game Maker would work perfect on a Mac if all prerequisites and tests were done beforehand to ensure the same performance.

If software that has poor performance on another platform than its primary platform is claimed to only work with ONE platform, why would it be ported for another? Logic fail.

If I write and release a professional program for more than ONE platform I ensure it works as perfect on the primary as it would on the secondary.

You have to at least SOMEWHAT agree that I have even the smallest of points being brought up here.

Mark Overmars created Game Maker, and throughout the years Mac users even now still complain about the differences from Mac to Windows platform. Wouldn't a "good" programmer have ensured the performance on the platform per se before releasing the final version?

That right there is where my host versus actual hardware + platform testing option would work if an executable was ported and sent via network so it can be tested on both platforms in the same instance(less trouble, less time, more ensurance of product equality).

And selling under a Mac is no excuse to hike up marketing sales value of products than with Windows just because Macs cost more.

PS: I also agree that I was wrong in some areas, but I don't get the feeling that you really understand where I'm coming from.

Quote:
Under the hood there is little difference between the hardware in a Mac and that in a PC
Somewhat true, somewhat debatable. You are aware that Macs don't use DirectX software rendering like Windows do, correct? That is a major difference of software rendering and GPU rendering in Mac VS Windows(Simply because Apple will usually use specific hardware for their computer systems different than Microsoft does/will).

Last edited by NuttyBar; 02-Jul-2012 at 04:07 PM..
allnodcoms's Avatar
allnodcoms   (Danny) allnodcoms is offline allnodcoms has a Profile Picture
Computer Specs
Member with 610 posts.
 
Join Date: Jun 2007
Location: Hertfordshire - England
Experience: Advanced
02-Jul-2012, 05:02 PM #6
I was only pointing out the errors in your argument. The line which I "mistakenly" omitted, I agree with you on - except the "Emulate" bit.

Re Game Maker, I actually spoke with Marc about a Mac port of this some 6 years ago, back in the days when it was his baby. He always said that he had no plans to release a Mac version, and when I offered to help he was not interested. YoYo made the call to go ahead with the port, and I think we can generally accept that the two versions are basically different projects that have virtually nothing to do with each other from a development point of view.

I understand when you say that software developed for one platform should run the same on another platform, and for your example "Hello World" that uses nothing other than stdlib then (in general) that's exactly what happens. When you start talking about more complex projects that interface with the hardware to a greater degree, and especially where speed is involved, that hardly ever happens. These projects tend to be written separately, by separate groups of developers on separate machines.

What I don't get is the whole "Do it all on one machine and will just work" thing. Whatever the question, 'emulation' is never the answer. And this bit:
Quote:
That right there is where my host versus actual hardware + platform testing option would work if an executable was ported and sent via network so it can be tested on both platforms in the same instance(less trouble, less time, more ensurance of product equality).
Makes absolutely no sense at all. You can't port an executable and run it in "the same instance" on two different platforms.

At the end of the day, unless you're writing "Hello World", Mac code is Mac code and Windoze code is Windoze code. For simple stuff you can port the source and resources from one platform to another and compile locally without too much additional work, but on the whole this doesn't happen very often. The way I've described things here is the way it's done, and the way it has been done for a very long time. If there was an easier, quicker, cheaper and more reliable way of doing it then I'm sure someone would have discovered it and put it into standard practice. Unfortunately, if you want something to work pretty much the same on all platforms then you're going to have to move to the net - oh, and avoid IE.

Danny
NuttyBar's Avatar
NuttyBar NuttyBar is offline
Computer Specs
Account Disabled with 67 posts.
THREAD STARTER
 
Join Date: Jun 2012
Experience: Beginner
02-Jul-2012, 05:31 PM #7
Internet Explorer is not liked by me in nearly any way.

But graphics can run the same on both platforms IF both parties take appropriate action to develop them specific to the host's processing.

Like I said ... DirectX is not Mac's OS buddy.

The fact of the matter is that Marc Overmars halted the whole process.

He is at fault, and that is where this case closes.

Nice inputs though.
Ent's Avatar
Ent   (Josiah) Ent is online now Ent is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 5,234 posts.
 
Join Date: Apr 2009
Location: United Kingdom
Experience: Intermediate
02-Jul-2012, 07:46 PM #8
It need not be a question of "fault" at all. Some programs are written for windows only, some for Mac only, and some for Linux only. Is apple "at fault" for not releasing OSX for Dell or Toshiba machines?
The point is that it takes additional work to make sure that something works on more than one platform, and often introduces subtle bugs that are very hard to get rid of. It's the programmer's call whether the benefits of porting to that platform outweigh the costs, including more difficult development and a potentially less stable or less feature rich program on both platforms. If they don't, you don't try to port it.

Gamemaker is in a particularly difficult position because it isn't just a program, but it's a system for making new programs (games are programs, even when you don't have to write any code for them). If it's hard enough to port a program to a second system, how much harder do you imagine it is to automate the process? As well as being able to deal with both Direct X and the Mac counterparts, it would have to "teach" the games to be able to deal with either.
When you're talking about development software, focussing on one platform is often the best for everyone.
NuttyBar's Avatar
NuttyBar NuttyBar is offline
Computer Specs
Account Disabled with 67 posts.
THREAD STARTER
 
Join Date: Jun 2012
Experience: Beginner
03-Jul-2012, 04:46 PM #9
I have written for both Windows and Mac, even Linux, and no one ever complained.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
linux, mac, platform, portability, windows

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑