Purephysics Posted April 20, 2012 Posted April 20, 2012 I am brand new to programming and I have no prior knowledge of programming or software other than the usual computer usage that I conduct on a day to day basis (on windows). I wondered what the difference is between Windows and Linux, why there is a difference, and what they are best used for in a programming sense? (I'm also considering learning Python as my first programming language) Any help would be greatly appreciated.
Xittenn Posted April 20, 2012 Posted April 20, 2012 Windows tends to be home for commercial applications, office software, and games--really anything that people will buy. Linux tends to be for non-profit software or software developed within academia (can be quite pricey.) There is a fair bit of difference in how each OS addresses the issues relevant to software and a provided platform, I am not personally going over the details there are a lot. There is a difference because people like to think in their own way and so variety is a result, this reality has evolutionary impact. My suggestion is that you start working with python on Windows, because it is the OS you use. Python is independent of OS in terms of programming shtough. If you want to learn about programming native code that targets a platform you would probably start with c++. Start with python, it seems to be the thing to do these days and requires much less of an investment on your part!
Schrödinger's hat Posted April 20, 2012 Posted April 20, 2012 I am brand new to programming and I have no prior knowledge of programming or software other than the usual computer usage that I conduct on a day to day basis (on windows). I wondered what the difference is between Windows and Linux, why there is a difference, and what they are best used for in a programming sense? (I'm also considering learning Python as my first programming language) Any help would be greatly appreciated. The fundamental difference between operating systems is in the way they control the hardware, and the way they expose that control to various programs/bits of code. The piece of software that does all this is called the kernel. This means a binary (set of computer/kernel instructions, usually an .exe file in windows) has to be written quite differently to run on one OS vs another. Because of this (and because the underlying philosophy tends to differ), the tools (command line utilities, window manager (the thing that actually manages the graphical environment) that you use to communicate with the computer tend to be different as well. Another major difference that stems from this fundamental difference, is you wind up with different libraries (collections of code for making interacting with the kernel and hardware) available for different operating systems. Basically what this means is the main difference you'll see in use of linux is there will be windows software you cannot use. Most software and libraries designed for linux are open source. Because of this, someone usually comes along and recompiles (turns the human-readable source code into a machine readable binary) or ports (modifies the source code slightly so that it does not ask the OS to do things that it cannot so that it can then be recompiled) any linux software for windows. Lots of windows software is closed source (you cannot get the human readable source code, only the machine and OS specific binaries) so this process doesn't tend to happen as much the other way around. The other difference you'll see is tools for interacting with the OS will be different. The various graphical user interfaces available for linux (windows only has one) are very different from each other, and only a few of them are all that similar to the traditional way of doing things in windows. The commands used in the command line interface are also quite different, as well as the various command shells available (again, windows only has one -- it's that black background window that comes up when you open a run dialogue (windows key+r) and type cmd). Most/all linux distributions I've seen (a name for the linux kernel + command line tools + a big bunch of software including window managers etc etc) come with a fairly standard set of command line tools and either the bash shell (the command line thingy) or one so similar that it is very hard to tell the difference. A kernel is pretty useless without a basic set of tools like this, so we usually use the term operating system to refer to the kernel+tools/basic libraries. The precise term for the most operating systems referred to as linux is GNU/linux, ie. the GNU operating system with the linux kernel. The GNU part just refers to the behavior and toolset that accompanies the kernel. Now. On to python. Luckily for you, python is an interpreted language (not technically completely true, but close enough and I don't want to explain bytecode right now), This means there is a binary file that sits between your program and the OS that interprets a standard set of source code commands and runs your program for you. As such, you don't have to worry about all the messy details of what OS your python program is running in, you just program python and the interpreter takes care of the rest. The main advantage of linux for your case would probably be that getting programming tools is very easy on most modern distributions. It's usually as simple as typing in a command like: sudo apt-get install python or opening a graphical package manager and clicking on python Which will download it, check that you have all the necessary libraries to run it (and if not, download and install them) and install it for you. That's if your distro doesn't already come with it (many do). Python is probably a good choice for a first language. Its syntax is similar enough to most popular languages that it is easy to transition to something else. There aren't many strange quirks that you have to deal with, and you don't have to worry about low level language issues. There is some division of opinion as to whether picking a high level language (one that takes care of all the messy details like python) first is a good idea, or whether you should start with a low level language to get a better understanding of what it is you're actually telling the computer to do. If you are planning on learning a lot about programming in the long-term, and don't get discouraged easily, I would say that learning C first is a much good idea. If you're not 100% sure about it, or want to make interesting things happen quickly then I would say starting with a high level language is a good idea. 4
Xittenn Posted April 20, 2012 Posted April 20, 2012 The other difference you'll see is tools for interacting with the OS will be different. The various graphical user interfaces available for linux (windows only has one) are very different from each other, and only a few of them are all that similar to the traditional way of doing things in windows. The commands used in the command line interface are also quite different, as well as the various command shells available (again, windows only has one -- it's that black background window that comes up when you open a run dialogue (windows key+r) and type cmd). Most/all linux distributions I've seen (a name for the linux kernel + command line tools + a big bunch of software including window managers etc etc) come with a fairly standard set of command line tools and either the bash shell (the command line thingy) or one so similar that it is very hard to tell the difference. A kernel is pretty useless without a basic set of tools like this, so we usually use the term operating system to refer to the kernel+tools/basic libraries. The precise term for the most operating systems referred to as linux is GNU/linux, ie. the GNU operating system with the linux kernel. The GNU part just refers to the behavior and toolset that accompanies the kernel. This point here could be misconstrued if someone were to try and put the statements into a programming context. Windows provides it's user interface and this user interface is very difficult to modify as it is intended to be left alone. In terms of programming applications there are many UI libraries that target the windows platform. For the .net framework there is WPF and Silverlight. There are a few C++ libraries, Microsoft provides MFC, WTL, and Win32 or WinAPI, other cross platform libraries include Tcl/Tk and Qt. I note this because someone who wishes to program tends to want to include a UI and it would be aggravating if Windows only provided one library to do the task--something you will learn should you learn.
Purephysics Posted April 20, 2012 Author Posted April 20, 2012 Wow, that's a lot of information to process! But you both have cleared a lot of things up for me that's for sure. I believe I shall research some more with this new knowledge, and look more into other programming languages like C, and C++. I'm pretty sure I'll want to start at the bottom with the programming (I thinks it's always best to start basic and work up steadily) Though having said that, how long does it actually take to learn Python, or C? Because I have no idea. I've heard good things about Python thats one of the reasons why I asked about it. The good things were that it isn't too complex to learn. I just wondered about the Windows/Linux deal because I keep hearing Linux everywhere, and wanted to understand more about it. I thunk for he time being I'll still to Windows, as I do know it, and I don't want to jump in too deep just yet!
Xittenn Posted April 20, 2012 Posted April 20, 2012 I'm pretty sure I'll want to start at the bottom with the programming (I thinks it's always best to start basic and work up steadily) Though having said that, how long does it actually take to learn Python, or C? Because I have no idea. C is for production code and can be very boring if you are new to programming. Learning python will get you to a place where learning c will be less of a grind. I highly recommend you learn python. Python can also be wrapped by c so if you ever want to use your python code in c you are good to go . . .
Purephysics Posted April 20, 2012 Author Posted April 20, 2012 C is for production code and can be very boring if you are new to programming. Learning python will get you to a place where learning c will be less of a grind. I highly recommend you learn python. Python can also be wrapped by c so if you ever want to use your python code in c you are good to go . . . That's what I've heard, and that suits me just fine. I'm not going to learn programming to become a programmer, I'm going to need a functional knowledge of programming for thre physics I'm planning to study at University. Though programming does interest me, but not enough to get all serious about (just yet. Who knows, I might love it.) At the moment I'm trying to make sense of all the languages out there like python, C, C++, Fortran etc, finding there functions and working out if I should read more about them. But python as read, does seem a good place to start. Especially if I can be used with C.
Xittenn Posted April 20, 2012 Posted April 20, 2012 (edited) PETSc binds to python, enjoy! ** linux or cygwin Edited April 20, 2012 by Xittenn
phillip1882 Posted April 22, 2012 Posted April 22, 2012 python is what i like to call a "natural" programming language in the sense that it does what you want it to do with the least amount of fuss. for example, here would be bubble sort in python. import random def bubbleSort(array): for i in range(0,len(array)): for j in range(i+1,len(array)): if array[j-1] > array[j]: array[j-1], array[j] = array[j], array[j-1] return array arrayToSort = list(range(0,100)) random.shuffle(arrayToSort) print arrayToSort print bubbleSort(arrayToSort) if you tried doing the same program in c, you would need nearly twice the number of lines. it definitely takes some time to learn though.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now