I am not sure if this is even possible but I have watched a few videos with programming examples where it seems like the program is being written in some kind of command prompt rather than a nice graphical IDE. Im just curious as to what might be going on in these videos. Is it possible to write a program without an IDE?

Obviously you can write a program without an IDE. How do you think the first IDE was written?
–
Charles SalviaDec 30 '10 at 2:54

31

Kids these days! Think they can't write programs without a fancy IDE! Why, in my day we had to compile to machine code ourselves, walking uphill both ways in the snow...
–
JSBձոգչDec 30 '10 at 5:48

30

This question makes me sad. Even more than ordinary people assuming software and hardware to be something magical - you're a programmer, you ought to know better! (And for the record, I propably count as kid for people who used machine code.)
–
delnanDec 30 '10 at 8:56

10

It's not a command line, it's a terminal based text editor. Two of the most popular text editors, vi and emacs runs in terminals. (And GUI also, nowadays).
–
Lennart RegebroDec 30 '10 at 15:55

24 Answers
24

All you need to write a program is a text editor and a compiler (or an interpreter if you're writing in a non-compiled language). Code is usually just plain text. Really, you could write any program imaginable using Windows Notepad and a command-line C compiler.

A lot of programmers don't even use IDEs. I personally used Gedit (a basic Linux text editor with syntax highlighting) for the longest time before I finally switched to Eclipse.

In fact, I still use Gedit when I want to write a simple program. Sometimes I'll even just use nano if I want to whip up a quick script, because I'm too impatient to wait for an IDE to load.

In fact you don't even need a text editor either. In UNIX you can write code with cat in Windows with more obviously you have to write it right the first time. Of course, real programmers use butterflies ;) xkcd.com/378
–
OscarRyzJan 3 '11 at 16:06

@Matt, it's simpler than it looks. Let's take a look on the second video: They are writing a python program. Python is an interpred language - meaning that a program written in python does not need to be compiled, it just need to be interpreted to run.

If you have a simple editor, as notepad (windows) or nano (linux) you can write a simple text file, name it, let's say, "program.py", and run the interpreted from command-line, as below:

python program.py

If you want to program in Lua for example, you can write a simple text file named "program.lua" using either notepad or nano and write a single line on your text file as below:

print("my first program in lua")

Then go to the command prompt (cmd on windows, terminal in linux) and run the command:

lua program.lua

The key concepts:

A raw program is a text file. All you really need to write a program is a text editor;

If your language choice is an interpreted one, you will need the interpreter to run your program (Lua, Basic, Python, etc...). This interpreter must be installed on your computer;

If your language choice is a compiled one, you will need a toolchain installed (mainly a compiler and a linker) to translate your source code to a binary machine-understandable-and-runnable code. Each language (C, Java, C++, C#, VB.Net, etc...) has it's own toolchain.

This translated the source code in HELLO.C and generated the object file HELLO.OBJ. The object file contained the machine code for the program, but it wasn't in an executable form yet. For one thing, the actual binary code for the printf call isn't present; there's only a placeholder for it. You still had to run the object file through a linker, which incorporated the binary code from the standard library (and any other libraries you need) and formatted the file so that it could be recognized as an executable:

$ LINK HELLO

The result of this step is the file HELLO.EXE, which is the executable version of your program.

The procedure's pretty much the same on any modern system; it's just that the specific toolchains are different. For example, the sequence of commands on a typical Linux system would be

$ vi hello.c
$ gcc -o hello hello.c

or

$ vi hello.c
$ gcc -c hello.c
$ ld -o hello hello.o -lc

Since I grew up in this environment, I never understood how someone could need an IDE just to write their code. However, early this year I started working in Java, and while Eclipse has its many, many faults, I can understand how someone can come to rely heavily on an IDE to get their work done. Since Java's such a huge language compared to C, and since I'm still trying to get the finer points of the syntax down, it helps to have a smart development environment that knows what packages particular types are in and helps me organize the imports.

An IDE is not a compiler, a debugger or anything similar, it is actually a front-end that allows you to access all these, which are typically separate programs. Behind the scenes of Visual Studio there's a compiler which you can access as a separate program, compiling your programs from the Command Prompt, and there's probably a debugger which is also separately accessible and so on -- I'm not too familiar with its infrastructure because I don't use it.

Depending on who you ask, an IDE is either very useful, or it tends to get in your way. It also depends on what you are writing, on its size, your coding style and so on. I, for one, don't really feel the need to use an IDE too much, but I reckon that some tasks are better handled by it (or, depending on how you look at it, that I'm too lazy to write scripts/macros for those myself).

However, it's nice to have something to edit the file later. IDE (integrated development environments) have been around a lot longer than many people are suggesting in their answers. The only IDE I ever really liked was the one that came with Turbo C, which ran on DOS. It was like oxygen to the people who had been forced to muck around with edlin.

I've tried many different IDE 'suites' on recommendations from friends who could not stop raving about how much time they save and how convenient they make everything. Every time I sit down to try and use one, I find that I fight it more than use it.

For the most part, I just use the simplest of text editors. My favorite happens to be KATE, which comes with KDE. These are the features that I like:

Just as it's possible to make coffee without simultaneously frothing milk, drive to work without also talking on the phone and doing your taxes, or gaze at the stars without listening to "flight of the bumblebee" on a surround-sound system, it is possible to compile code without also running an editor, debugger, code analysis system and snake game.

It certainly is. In the first video, it is about C programming. To write C programs, you need the following:

some kind of source files where the code is written to

a toolchain to transform this source file into a binary, which is the only thing that a CPU can understand in the end.

Strictly speaking, you don't need file, but I don't know any environment which does not use file for C/C++. As such, you need an editor to edit the source code. Although something as simple as notepad works, you really want something more elaborate to do coding (code highlighting, opening multiple file at the same time, etc...).

For the second point, you need a compiler (source code -> object code) and a linker (object code merged together + minimal support to start the program).

Even with an IDE, most tasks done behind the scene may be done from the command line: for example, in visual studio, the IDE still uses files, and call compilers at the command line for you, but it could work some other way (and maybe does for more integration).

So why not using an IDE ? Some people are quite anal about their code editor, because they really know it. For example, I am quite productive with the vi code editor. IDE are also limited if you need to interact with things that the IDE has not been designed for. There is a tradeoff here that depends on programmer ability, project, programming languages/tools, etc... Some languages don't even have a decent IDE, some other languages are almost unusable without one. Although I don't use IDE myself, one area where I think they are very useful is debugging integration for C and C++.

You can certainly write programs without a graphical IDE. For compiled languages (e.g. C or C++) the process would go something like this:

Write the program in your preferred text editor.

From the command line, invoke the compiler and/or linker that will convert your program to executable machine code and pull in the required external libraries. (I'm a little hazy on the order of linking and compilation here, but I'm sure someone will correct me in no time. :))

For interpreted languages like PHP or Python, you write code in your preferred text editor (or an interactive shell like the one Python comes with) and the code is executed by an interpreted program. For example, to invoke a Python script, you'd run something like python.exe myScript.py.

Python is not a purely interpreted language, since it does get compiled first, but that compiled form is run by the Python interpreter, so it still fits the definition. Other languages such as PHP are entirely interpreted.

I think you are refering to the Integrated Development Environment's (IDE). They provide code hints and syntax highlighting among other things. A compiler just takes the files and compiles them into machine code or byte code. A compiler is usually used by an IDE by sending it a command to compile your files.

It is possible to write without a compiler. These languages use an 'interpreter' and process the script at run time.

I write my everyday code in a vim editor (basic text editor) and i can asure you that it goes smoothly (most of my code is PHP). Specially cause my dev env is a Dev base Linux distribution and i take quite advantage of shell tools.
I have programmed like this for a year now and this has helped me a lot when dealing with remote application deployment and production modifications where you generally got access to a *Nix console via ssh.

digital stored-program computers have been in use since the 1950s, while graphical user interfaces really only started to appear in the late 1960s (and for end users in the 1980s). People had to use - and program - computers somehow before then.

While it contains some inaccuracies (not every platform's user interface is a layer atop a command-line system) you should probably read Neal Stephenson's short piece In the Beginning Was the Command Line.

It'll really get you thinking about things on your computer work under the hood, and how it's "possible" to program without an IDE, get real work done with a command line, and so on.

You really only need a text editor (hell, notepad will work) and a compiler/interpreter (the more important thing).

You said something about doing it via command line? Shit sounds insane, but it is very well possible. I mean just using Windows built in command prompt you 'could' write to a file via echo "some codez" > target_file.sauce but you would have to

You really need to think that an IDE is just an Editor + Compiler + (some sort of) Makefile + Debugger (sometimes) + Graphical UI Builder (sometimes) so of course you can choose not to use an IDE at all, and you replace them with an Editor of your choice (vim, emacs, gedit, notepad++, [insert_others_here]), an compiler (jdk for java, gcc, platform SDK or [insert_Cpp_toolchain_here] for C++, python interpreter, or whatever toolchain your language has), some sort of makefile (like autoh... tools, cmake, ant, maven, etc.), some sort of debugger (that usually is included with the compiler), and if you want an graphical ui builder (glade comes to mind), and there you have it your own IDE without an IDE. Which approach is best depends on you (and I think that IDE's today are slighty overrated)

He's using pico, a nano clone. I use it occasionally. Usually I use emacs, which is slightly less helpful, but more featured.

I don't use IDEs as a rule of thumb. Occasionally I've dropped into them for debugging or because the command-line toolchain was a pain to find (looking at you Xilinx). I also use them to sketch out C# in the rare occasion when I do a GUI. But IDEs are not very good editors in my experience: inflexible, weird character chords, not very easy to use, not many languages supported, take too much memory.

I'd rather use emacs.

You should look into the history of computing. It's fairly accessibly written and will give you a wonderful perspective on our work.

Here is what is fun: Harvard Extension School is teaching programming with no IDE ... unless telnet + pico is what you mean by an IDE.

The easiest way is to use a basic text
editor to write your Java programs,
then transfer files to the FAS system
using an FTP program, connect through
telnet, and compile and run them on
FAS (fas.harvard.edu - Java is already
installed there). They MUST be on FAS
in order to submit them for your
homework. To use this method, you may
want to learn enough about one of the
Unix text editors to be able to make
any needed quick corrections to your
files, or plan to update the file
locally and re-transfer it. More
information about transferring files
is on the FAQ page.

DO NOT use a word processor, e.g. Word
or WordPerfect! They add lots of
formatting characters which you don't
see, but which will prevent your
programs from ever compiling. On
Windows, you may use Notepad or
Wordpad and make sure you save the
files as "Text Document" with the
.java extension. If the system tries
to add a ".txt" suffix, put quotes
around your file name and extension in
the Save box to prevent this. You may
also try any of the editors in the
Useful Downloads section (one we
highly recommend for PC's is
Programmers File Editor). On the Mac,
use BBEdit Lite (also linked on the
Resources page), or one of the
built-in Unix editors which are
available in a Terminal window. You
can obtain a secure telnet program or
use one that you have, telnet into the
FAS system, and write and edit your
programs on the system. There are
three Unix editors which you may try:
pico, emacs, and vi. Once you've
written your program and saved it,
then, as above, you can compile and
run it on FAS

If you ask me, they are torturing the kids, but that is ok. There more Spartans, let alone Mothakes, Perioikoi and Helot than Harvard can admit in any given year.

Yes, it is possible. I suppose something like Notepad is a no-IDE,
but emacs and Textpad (I used both for C, Java coursework) are considered an IDE.
Now ... after coding in C# in VS2010, with WinForms and all, I would not want to go back to text editors at work - I would be yelled at for not getting crap done.

For academic projects, however, when examples are small, it makes sense to use no IDE. Remember: in intro programming classes, many real-world issues are not present. You will probably not have to add .xml files as resources to a dll; You would probably not need to debug it much, you would not need to use code contracts, or go from an unmanaged C++ to C++/ClI, then to C# and back. Academic assignments need not be messy because they can be done from scratch, and are measured in man-days/weeks. All files can be part of just one project (even for a compilers or an OS class). An IDE like Visual Studio can actually hinder you when a simple makefile will do. Think of the myriads of options that one must configure. Same with Eclipse - it is an over-engineered editor that is infinitely customizable. A simple makefile and two simple C files might be all that you need. In fact, you tend to have more control that way, when you specify every flag yourself. I have coded like that in a university lab once. It is funny, but one of the "embedded" (meaning it had to be so tiny that it would fit on an airplane) computers there had no GUI, and no mouse :) I was still able to log in, edit, compile and debug a C program, as well as add drivers and recompile the kernel.

It's not only possible, but - at least once in your life - you have to do programming without IDE. It will help you understand the compilation process, the use of libraries - maybe that'll open your eyes what programming means really.

Also, I think a good text editor is better than an IDE. For MS-Windows I recommend PSPad (it was such a strong flash, like MultiEdit was in the MS-DOS era), for GNU/Linux try Geany (maybe it's in your distro's repo).

As expected, all the answers say the same thing: "of course you can! It's just text! Text text text text!" This is true, generally speaking, and is the best answer to your question. Most IDEs simply manipulate text.

But it's not always true, and in certain cases moving away from a text-only model results in great advances. These advances are usually rebuffed by text-only purists (which is most everybody, because how-it-was is also how-it-should-be... ain't that a coincidence?!). IBM Visual Age was one really cool example that died a horrible death.

Another example that comes to mind and it kicks butt and is very popular is Interface Builder for creating Mac and iOS products. Its output is NOT text programs but rather serialized objects, so you cannot create NIBs without either using IB or writing your own IB.

Purists will say, "yeah, but Interface Builder is written in text code!" So?

I truly believe that CS as a field would advance greatly if we could go beyond the text-only paradigm. Beyond that, I think that we will eventually go in this direction, but it'll take decades. First we'd have to figure out which is better, vi or emacs....