topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday April 19, 2024, 11:51 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Difference between programming for Linux and Windows?  (Read 10479 times)

zridling

  • Friend of the Site
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 3,299
    • View Profile
    • Donate to Member
Difference between programming for Linux and Windows?
« on: January 08, 2007, 06:59 AM »
I can't code my name, but I need to be informed: What is the difference between programming for Linux and Windows? Especially the same program. I ran a second Linux box for years, but never made the full switch because several of my most used apps throughout the day aren't coded for Linux. Is it difficult? Do you have to go to 'Linux' school? About the best article I could find was Biculturalism by Joel Spolsky:

What are the cultural differences between Unix and Windows programmers? There are many details and subtleties, but for the most part it comes down to one thing: Unix culture values code which is useful to other programmers, while Windows culture values code which is useful to non-programmers.... This is, of course, a major simplification, but really, that's the big difference: are we programming for programmers or end users? Everything else is commentary.
« Last Edit: January 08, 2007, 07:01 AM by zridling »

Josh

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Points: 45
  • Posts: 3,411
    • View Profile
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #1 on: January 08, 2007, 07:06 AM »
win32 style: CreateProcess( <insert 58 million arguments to give the programmer the illusion he has alot of control );

unix style: fork();

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #2 on: January 08, 2007, 07:18 AM »
@Josh  -  Solid!  :Thmbsup:

@Zaine  -  The architecture of programming itself is really very simple. Read >> Process >> Write.  The only difference is really just syntax, so pick your best (most comfortable) language and have at it and see what happens.  Does that help?
« Last Edit: October 19, 2010, 07:08 PM by CodeTRUCKER »

zridling

  • Friend of the Site
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 3,299
    • View Profile
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #3 on: January 08, 2007, 07:28 AM »
Now see Farmsteader, that's just it: I don't know. I don't even know enough about programming to ask the question in a specific way, other than the example of writing the same program for each OS platform.

tinjaw

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • View Profile
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #4 on: January 08, 2007, 08:22 AM »
Maybe a simple diagram will help frame the question better.

application
---------------------------
API Layer
---------------------------
operating system
---------------------------
drivers
---------------------------
hardware

So when you write a program you have to go through the API (Application Programming Interface) layer. So, even though you use the same programming language (say C++) and eventually end up compiling down to the same machine level code for the CPU (say x86) you get there via different paths.

A concrete example would be writing a program to simply open a window/frame to put your applications GUI (Graphical User Interface) into. The code to do that is different depending on what operating system (and what windowing platform) you are using.

It's a little more complicated than that, but that should provide a good basis for an understanding.

mrainey

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 439
    • View Profile
    • Website
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #5 on: January 08, 2007, 08:36 AM »
Zaine,

Here's an opinion from Paul Turley, creator of the IBasic, EBasic, and Aurora programming languages.  These languages are all designed to create self-contained Windows executables.  Aurora is being further developed by Paul to run on Linux.

I'm sure that some programmers will disagree, but that's what makes it fun.


"Linux is worse for the programmer, always has been.  It is dependancy hell as there are hundreds of libraries that an application may depend on that are not included on all distributions.  It is up to you to package these libraries into .deb or rpm distributions."

http://www.ionicwind...hp/topic,1017.0.html
Software For Metalworking
http://closetolerancesoftware.com

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #6 on: January 08, 2007, 08:57 AM »
Ok, right... I thought I just didn't know how to read the instructions on the Redhat box. :P
« Last Edit: October 19, 2010, 07:19 PM by CodeTRUCKER »

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #7 on: January 08, 2007, 09:05 AM »
Josh: you do get a lot of control with the WIN32 API, though - thing is you don't need it most of the time. You can probably do (most of) the same under *u*x, but then you need to hunt down multiple functions to get the same effect; somewhat clearer code, but more user<->kernel transitions.

Then there's the issue of library hell - which is much worse than windows DLL hell has ever been. And if you're a commercial developer who's not into the GPL commie club, it gets much worse - either pay for special commercial license of libraries, or rewrite functionality that's on windows to begin with.

And good luck shipping a binary, with all the various library versions around, which are sometimes incompatible ABI-wise.

Documentation - sucks. manpages are horrible, texinfo only slightly better, so you end up googling trying to find a html'ized version. And no, "aprospos" isn't really a solution.

That said, platform specific stuff can usually be abstracted if you think about the problem in the right way. Even for advanced stuff like I/O Completion Ports, FreeBSD has /dev/kqueue and linux has /dev/epoll ... well, if the user has a recent enough kernel version (I be there's more people running 2.4 kernels without epoll than people running win9x :), though ).
- carpe noctem

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #8 on: January 08, 2007, 09:13 AM »
BASIC: Beyond All Sense, Incomprehensible Crap. Donald Knuth, iirc, has quote where "BASIC" and "brain damage" go together. Yes, fortunately today's BASICs are less hideous than the original ones, but it's not something you should touch unless you have to (ie., VB required for a job).
- carpe noctem

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,884
    • View Profile
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #9 on: January 08, 2007, 10:09 AM »
BASIC: Beyond All Sense, Incomprehensible Crap. Donald Knuth, iirc, has quote where "BASIC" and "brain damage" go together. Yes, fortunately today's BASICs are less hideous than the original ones, but it's not something you should touch unless you have to (ie., VB required for a job).

I haven't touched BASIC in 27 years, and I am still scarred by it. For whatever reason, my first instinct is still to think in BASIC code rather than whatever language I am working in. And I am not referring to VB either...I am talking about that BASIC stuff they taught in schools back in 1980.  :-[

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #10 on: January 08, 2007, 11:15 PM »
BASIC: Beyond All Sense, Incomprehensible Crap. Donald Knuth, iirc, has quote where "BASIC" and "brain damage" go together. Yes, fortunately today's BASICs are less hideous than the original ones, but it's not something you should touch unless you have to (ie., VB required for a job).

I agree the BASIC on the old C64, TI994A, etc. was arcane, but the Emergence BASIC that Mike has crafted his fine app with and I'm really getting excited about is a whole new animal.  For me, it has made programming fun again.
« Last Edit: October 19, 2010, 07:24 PM by CodeTRUCKER »

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #11 on: January 09, 2007, 04:48 AM »
Fortunately, todays BASICs aren't as bad as the original; you can do relatively structured programming in BASIC today, rather than the intertangle GOTO mess and line numbered source of yore.

There's still problems with the mentality, though. I can't remember the specifics since it's many a years since I had to deal with VB, but if you look at some problems and the recommended solutions - christ. No doubt that things can be done cleaner, but when the general responses on "teh intarweb" (or even a teacher) are kludges, things are bad.

There's also a lack of expressiveness in the BASICs I've seen. This again leads to kludges ("use a DLL"/"write it in inline assembly") rather than working with the BASIC language itself. Either you have a pretty bare-bones BASIC that isn't much interesting, or you have one of those frankensteinian BASICs that includes everything and the kitchen sink - or you have to rely on external libraries, probably written in C.

There's hybrid BASICs, but then you might as well use a better language :)

It might not be total brain damage to learn some programming with one of the more modern BASICs, but you'll have to ask yourself how much of the knowledge you can re-use if moving on. Especially if it's one of the frankenstein BASICs with a zillion library functions to make life easier.
- carpe noctem

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #12 on: January 09, 2007, 09:23 PM »
The real acronym goes this way... Beginner's All-purpose Symbolic Instruction Code. <CT winks at f0dder>

Maybe an exploration into the world of coding would be most instructive and helpful? 
« Last Edit: October 19, 2010, 07:18 PM by CodeTRUCKER »

zridling

  • Friend of the Site
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 3,299
    • View Profile
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #13 on: January 10, 2007, 12:13 AM »
Fantastic links and analogies, thanks guys! The last languages I learned was my freshman year in college — FORTRAN and COBOL — and by the time I graduated the Mac hit the market, two years later home PCs were affordable, and FORTRAN and COBOL were worth a warm cup of donkey spit.

But Farmsteader I'm not looking to start programming. I honestly don't have the brain capacity for it. But you're right, I'd love to spend the next two years weaning myself completely off of Windows. Apps like UltraEdit, NewsLeecher, ACDSee, Screenshot Captor, et al. may run quite well under Wine or Codeweavers Crossover. Hardware, drivers, etc., are another challenge. But it was this thought that motivated the question of the difference between coding for them.

I've always thought of the difficulty of switching from the installation and hardware side; that is, until a Linux distro (which, compiling proprietary drivers with Open Source software goes against the whole idea for the most part) can make it as easy to install a program and change hardware as Windows does, then it's still the province of those who have time. If it were simple, I'm sure more software devs would simply port their apps to Linux. But that's not the case as Michael Rainey and I know about UltraEdit!

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #14 on: January 10, 2007, 02:05 AM »
Hey Mike!  Ever had a crack at the *new* UE Studio?  I'm curious as to how it adds, if anything, to the standard UE?
« Last Edit: October 19, 2010, 07:13 PM by CodeTRUCKER »

mrainey

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 439
    • View Profile
    • Website
    • Donate to Member
Re: Difference between programming for Linux and Windows?
« Reply #15 on: January 10, 2007, 05:32 AM »
I haven't looked at UE Studio.  Not really being a hardcore programmer myself, I'm happy keeping three or four source files open in UltraEdit and compiling my project as needed from the IBasic IDE.  Pretty basic stuff (no pun intended).   ;D
Software For Metalworking
http://closetolerancesoftware.com