Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

heres two examples: http://www.youtube.com/watch?v=hFSY9cWjO8o( @ 6 min) http://www.youtube.com/watch?v=tKTZoB2Vjuk (@ 5 min)

Could anyone explain how this is done?

Thank you all for the great feedback!

share|improve this question
43  
Obviously you can write a program without an IDE. How do you think the first IDE was written? –  Charles Salvia Dec 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.) –  delnan Dec 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 Regebro Dec 30 '10 at 15:55
3  
@jas- thanks for the constructive and insightful comment. –  Matt Dec 30 '10 at 18:01

24 Answers 24

up vote 21 down vote accepted

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.

share|improve this answer
2  
I'm a big fan of Gedit and KATE. I use Nano when I'm editing code remotely. –  Tim Post Dec 30 '10 at 16:41
6  
I like Notepad++. :) –  muntoo Dec 31 '10 at 1:25
4  
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 –  OscarRyz Jan 3 '11 at 16:06
1  
@OscarRyz - "'course there's an emac command for that." +1 to Notepad++ though –  Jetti Jan 6 '11 at 1:56

@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.

Hope that helps.

share|improve this answer
4  
Notepad++ is much better for syntax highlighting! And don't forget about EMACS :D –  K-RAN Dec 30 '10 at 9:11
1  
@K-RAN: All I use is Emacs, unless I'm using XCode for iPhone programming. With TRAMP it is unstoppable! –  Josh Jan 6 '11 at 1:50

Jesus, I feel old now, and I never even had to mess with punch cards or batch processing. Hell, I only had to use a hardcopy terminal once or twice over the course of my college career.

Here's how we did things back in the late Cretaceous (circa 1986). I was working on VAX/VMS through a VT220 amber-on-black character-based terminal that could display in either 80x24 or 132x24.

First, you fired up the text editor:

$ EDIT/EDT HELLO.C

EDT was the VMS equivalent of vi, falling somewhere in capability between DOS edlin and Notepad. You typed in your program text

#include <stdio.h>

int main(void)
{
  printf("Hello, Stupid\n");
  return 0;
}

saved it to the file, and then exited the editor.

Then you ran your code through the compiler:

$ CC HELLO

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.

share|improve this answer
2  
@Tim Post: Are you kidding? To me, those were the good times; it's been all downhill since then. –  John Bode Dec 30 '10 at 16:53

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).

share|improve this answer

Editor? I don't need no stinking editor or IDE to write code:

cat << EOF > hello.c
/* This IS an example of writing code from the command line */
#include <stdio.h>

int main(void)
{
    puts("Hello, World!");
    return 0;
}

EOF

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:

  • Great syntax highlighting
  • Code folding
  • Simple regex based search / replace
  • Inline shell window
  • Inline compiler window / debugger window
  • Snippet gallery
  • Symbol viewer
  • Extremely lightweight memory footprint (some of my projects have several hundred source files)
  • Easy tabs / split windows
  • Simple sessions instead of complex 'projects'
  • (Semi) simple plug-in architecture

With just those basic features, I feel like I'm almost spoiled.

I'm actually less productive when working with feature rich IDEs, and thankful that I never developed a dependency on one.

share|improve this answer

Yes, yes it is.

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.

But... who really wants to gaze at the stars in silence?!

share|improve this answer
1  
Would you be willing to explain how? –  Matt Dec 30 '10 at 1:55
1  
@Matt: one program per task... Write code in an editor, compile it using a compiler, debug it using a debugger, take a break and play snake. –  Shog9 Dec 30 '10 at 1:56
1  
-1 I don't think that this is constructive. –  sixtyfootersdude Dec 30 '10 at 2:37
1  
+1, it's not destructive, it's just a metaphor. Don't afraid of humor. –  ern0 Dec 30 '10 at 11:50

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++.

share|improve this answer

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

  1. Write the program in your preferred text editor.
  2. 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.

share|improve this answer

Yes, you can write code without a compiler and without an IDE. All it is is writing. Text.

share|improve this answer
2  
Would you be willing to explain how? –  Matt Dec 30 '10 at 1:50
7  
You type on your keyboard. –  Matthew Read Dec 30 '10 at 1:51
1  
Oh. thanks..... –  Matt Dec 30 '10 at 1:55
2  
@Abimaran I'm not 100% sure what you mean, but you can certainly run/use a program without a compiler or IDE. Languages can be interpreted, not just compiled. –  Matthew Read Dec 30 '10 at 1:59
1  
@Michael I have to disagree. It's not interpreted any more than the analytical engine interpreted the position of its gears. –  Matthew Read Dec 30 '10 at 5:14

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.

share|improve this answer
1  
Would you be willing to explain how? –  Matt Dec 30 '10 at 1:57

All an IDE does is provide several tools in a single convenient place and then automate some of the processes. Those tools are generally...

  • A text editor
  • A compiler
  • A debugger
  • A documentation viewer

To write your source you can use any text editor that produces plain text, eg. NotePad, Word or a purpose built code text editor.

Once you have your source in a text file you can then launch your compiler via the command line passing in your test file, eg cc my_program.c This will produce an object file that you can execute.

To debug your program you launch your debugger via the commandline passing in your program, eg. gdb my_program You can then set breakpoints, step through your program, inspect stuff etc.

With an IDE all of this happens with the press of a button behind the scenes and the IDE puts a fancy UI on top of it all.

PS. Real programmers use the commandline

share|improve this answer
2  
Real programmers use punch cards and build their own CPU out of pre-MOSFET transistors. They also play chess with pieces made of concrete and weighing at least 25 pounds each. –  Job Dec 30 '10 at 3:18
1  
@Job, transistors are for sissies, the real-deal are those: en.wikipedia.org/wiki/Vacuum_tube –  Machado Dec 30 '10 at 3:22
2  
Real programmers use a magnetized needle and a steady hand. xkcd.com/378 –  Goran Jovic Dec 30 '10 at 10:13

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.

share|improve this answer

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.

share|improve this answer

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

A) Be really good at what you are doing

B) Be writing a simple program

C) Be bat-shit crazy

share|improve this answer
1  
...or trying to impress someone. –  Michael K Dec 30 '10 at 4:11

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)

share|improve this answer

blinks

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.

share|improve this answer

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

http://www.fas.harvard.edu/~libe50a/homework.html http://www.fas.harvard.edu/~libe50a/faq.html http://www.fas.harvard.edu/~libe50a/java.html

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.

share|improve this answer

For database work, you just need a text editor (notepad++) and a command line client such as osql or sqlcmd. Not even a compiler.

share|improve this answer

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).

share|improve this answer

I use a 99 cent notebook with my trusty Pilot Gel Pen to write programs.

Them I just re-type into Visual Studio the code.

Writing a program and coding are two different things (for me).

share|improve this answer

Programming without an IDE is a great way to learn what's happening.

We started programming in school with a simple syntax-colored text-editor. Compiling happened with the command prompt (or through a simple batch script).

Only when we understood the basics of programming we moved on to more powerful editors like Eclipse or Visual Studio.

share|improve this answer

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....

share|improve this answer

You don't even need a text editor. :) :)

If you're in windows try this:

more > hello.c 
#include <stdio.h>

main()
{
   printf ("Hello World!\n");
}
Ctrl-C

If you're in UNIX

cat > hello.c <<. 
#include <stdio.h>

main()
{
   printf ("Hello World!\n");
}
.

And then just compile it with your favorite command line compiler. :)

Obviously you have to write it right the first time.

Remember that real programmers use butterflies: http://xkcd.com/378/

share|improve this answer

Lately I've upgraded to vim. I like how it highlights keywords in whatever language I'm writing. Sigh, only when I can get to a real OS and not use notepad.

My wife wrote COBOL using edlin. I thought that was pretty funny.

Such an improvement over the keypunch cards we used to use and the 24 hour turn around from operations just to discover we had a typo.

I have coding forms somewhere up in the attic.

You had 1's and 0's? We had to draw a line through our 0s.

But you tell the young people today that and they won't believe you.

j.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.