Command Line Compile or IDE Compile?

Computer Science Teacher
Computer Science Teacher - Thoughts and Information from Alfred Thompson

Command Line Compile or IDE Compile?

  • Comments 3

There are times when I have wondered if we would not be better off going back to punch cards. Really I am somewhat serious. Back in the day I remember people really paying a lot of attention to their programs before they passed them to the computer. After all if you only get one chance a day to compile and lots of time between compiles it makes sense to desk check. And of course we had come amount of JCL we had to set up to make sure things compiled correctly. This leads right into the ongoing debate about using an IDE versus using a command line compiler that is going on at the MainFunction forums. There is a good “back to basics” argument about command line compilers.

The debate about command line v. IDE is, in some ways, a false comparison though. Compiling a program is only one of the things an IDE does. An IDE also does editing and debugging. I've read arguments against using a debugger when teaching programming. I completely disagree with those arguments. I think that a good debugger lets a student see a lot more about what is going on behind the scenes than any other method of debugging. And I really like the idea behind IntelliSense and strongly believe that it encourages experimentation. I've used all kinds of editors in my time from punching cards to line mode editors on paper printing ASR 33s to full blown, color coded, IntelliSense using Visual Studio. I think the IDE adds a lot to the process.

Getting back to compiling, is there value in students knowing about the switches and other options? Absolutely. The question in my mind is when they should learn about them. I tend to think that the first course in not the time. Perhaps not even the second one. We don’t start students with assembly language after all. I have heard the argument that we should BTW.

Back in the day when you had a large program (i.e. more than 16k of memory) you had to create overlay files for the linker. You actually had to tell the linker which modules needed to be in memory at the same time and which ones could be switched out of memory to make room for them. What an education in memory management and program organization that was. It forced programmers to organize their code and to be very cognizant about dependencies between modules.

But you know I am not so sure we want to go back to that. We are content to let compilers, linkers and the operating system worry about all of that today. I would assume that at some point students learn a lot of that stuff, perhaps in an operating system class, but it is less important for the average programmer today. Likewise compiler options are less important until you are ready to produce code with real performance requirements.

I can see a need to teach students about compiler options and what they mean. Is that easier to do with a command line compiler? I don’t know. I haven’t really tried to do that. It is an interesting question but first we have to get past the “when” to teach them.

- Alfred Thompson

  • I've always compiled from the command-line, and recently moved over to using Visual Studio to edit my files. Intellisense just rocks and completely cuts out the "damn, now I have to google that function" step.

    As for *why* I prefer the command line... I personally find it easier to manage a makefile, and see my warnings/errors in a separate window.

    I did try to move my build config into VS but I couldn't find my way through the wizards/dialogs and the rest of the GUI.

    Another reason is that I prefer to have a unified build process, so I can compile my entire program including any help files or installation exe's, run unit tests etc, all using one batch file.

    Learning about compiler switches is important, but I don't see any particular advantage to doing this via the commandline. Any important options can also be found via the GUI. As long as the students realise there are options for things like optimisation, it doesn't really matter how they do it.

    That said, I do think it would be useful to introduce them to the commandline, some like me may just prefer to do it that way ;)
  • I think it depends on what the flags mean.

    If you are in a class teaching people debugging skills, a lot of compiler options can actually help. Most people don't have good debugging skills and it would be nice to see some more emphasis on these and software test in most curiculum. This would be a good time to teach about flags that aid in debugging and some of the ways you can find out what is going wrong with a program.

    Code optimization is also an art and one that was not taught where I went to school. The opininion is usually that students innate desire to create the fastest code coupled with training on how to develop algorithms or use existing algorithms will end with the students knowing how to write fast code. However, as Knuth says "premature optimization is the root of all evil" and students should be trained to find hotspots and then know ways they can tune code by finding better algorithms, enhancing the performance of existing algorithms, or using compiler flags. There is a lot of room here for a course but I don't see many courses.

    This is kind of off topic but another thing that is becoming increasingly important in the industry is multithreaded programming. Most of this is usually picked up in an operating systems course. However, there are good industry indicators that most programmers do not have adequate knowledge to develop programs for multiple processor machines. As the industry moves to Thread Level Parallelism they definitely should. There are languages for this like OpenMP or MPI but I am not sure these languages really solve the problems any better than a good built in thread library like Java. Yes, they usually allow for existing problems to be broke down into threads by exploiting loops, etc. but they don't emphasize multithreaded design. Don't get me wrong a lot of good mathematical divide and conquer algorithms work great with OpenMP or MPI but most people are not going to be working strictly on mathematical problems and the days where multiprocessors were limited to supercomputers are gone.

    Maybe eventually some flags will be used for multithreading. I am not sure I buy into the silver bullet but at the PDC this year, Intel talked about developing a compiler that would allow existing programs to utilize multiple threads. This is definitely a very interesting research topic.
  • Shaun:

    your comments RE: teaching code optimization is an argument that I have had with many faculty. Most faculty care about graduation "computer scientists". Let's be real--most CS students are going to get jobs and not continue pursuing the study of the "science". The overwhelming majority of students will graduate to get a job and a paycheck right? They will be hired for the practicality and applicability of their skills. IMO, the focus should be on helping students be better *developers*--which means teaching them how to optimize. Performance matters in the real world...period.
Page 1 of 1 (3 items)