Unix as IDE
blog.sanctum.geek.nz
blog.sanctum.geek.nz
Unix is a development environment.
Naah... the name is just good, call it what you want - IDE, PE,
Kernighan and Pike called their book "The Unix Programming Environment" (sooo highly recommended), so I' go with "PE" instead of the high-falutin' "DE".
> Symbolics 36000 Technical Summary
> Overview
> ...
> The Symbolics 3600 is a 36-bit single-user computer designed for high-productivity software development and for the execution of large symbolic programs. ...
> The system software constitutes a large-scale programming environment ... Object-oriented programming techniques are used throughout the 3600 system to provide a reliable and extensible integrated environment without the usual division between an operating system and programming languages ...
---
There you have 'development' and ' extensible integrated environment'.
BTW: I like his use of "IDE" to convey his point succinctly. Though I had the same reaction as you, he's using it as a word, not an acronym. Also, there's a category error of application vs. OS which I think adds to the wry quirkiness.
Presumably, you've got a suite of unit tests etc that you are using to verify your code still works post-refactoring. The same test suite would of course work outside of an IDE environment, so I don't think correctness is a valid argument here (but I agree that speed of refactoring is).
You still review to make sure it was an improvement, and to make sure that the person making the changes didn't make the mistake. But you don't review the correctness of the transformation itself, at least not any more than you need to review the original code.
Until then, I fully agree with you.
* To be ahead of the haters: autocomplete isn't a trick for avoiding having to type some extra characters. It's a way for exploring an API you're only vaguely familiar with. I guess you need to be at least somewhat familiar with statically typed languages in a decent IDE to really appreciate what this can do to your productivity. I seldom need to refer to the API docs of libraries I use.
So, when life gives you lemons, you make lemonade. We're stuck with Javascript. Personally, I think running the code while you're developing it is a brilliant way of dealing with the problem of how to do proper autocomplete on a dynamic language.
Even in Java and C#, arguably the best languages re: deep IDE integration, there are edge cases where the IDE can't know everything (reflection, for instance), but it still does the trick most of the time.
Vim will autocomplete based on whatever you have in the buffers. So when writing sql I sometimes open up a new buffer and paste the output of desc table.
There are also editor-independent tools like Ensime for Scala which is basically a server that provides IDE-like tools that can be used from Emacs or Vim. Scion provides something similar for Haskell.
There are also things like CEDET for C/C++ which add very IDE-like capability to Emacs. In fact, CEDET is basically just a framework for parsing languages and using that information for things like auto-complete.
Of course, there are some languages conspicuously missing--Java and C# for example. I tried using JDEE for Java a while back and it was really bad; I've never used C# but I don't think it's well-supported either. Ironically, these are two of the languages that need an IDE the most in my experience. (And the language that needs it least--Haskell--has some support.)
So if you're doing serious Java/C# development, then you have a valid point. If you're using another language, chances are that Emacs or maybe several editors can actually support it intelligently. (Also, maybe there are options for C#/Java that I am not aware of. If so, I would appreciate being enlightened.)
Emacs, IMHO, is much closer to Visual Studio than to bash+vim.
Besides, some of the tools I listed (e.g. Scion and Ensime) are not part of Emacs but rather stand-alone IDE daemons.
IDEs have their use, Vim and Emacs have their uses, too. I'm perfectly satisfied by Vim (with omnicomplete and tags) for my JavaScript/HTML/CSS coding but I have to turn to Eclipse for AS3.
The "right" tool for the job.
cscope is very good for searching through C codebases. You can use this with vim too. It has emacs integration using xcscope, and you can use sequences like C-c s g to quickly jump to a symbol.
xrefactory (though non-free) is very good with C++ navigation and can do refactoring. I have used IntelliSense with VAX and xrefactory is much better. This less known program is something incredible for C++.
* no autocomplete... On huge projects that are not based on some predefined framework structure (think rails) this results in a lot of "what was the parameter order of that function again or how was it even called ?"
* no easy refactoring. In VS i love how i can just hit F2 on a method name, rename it, VS shows me all the places where it will rename it and pressing OK. This works flawless everytime and makes refactoring so much more painless than working with a scripting language and a text-editor only
+ numerous other things like looking up where certain methods get called, where they are defined etc.
Using vim (or sed for whole directories of files) you can do the same thing using a search and replace regex.
in vim:
:%s/<find>/<replace>/gcAnd, yes, it is very nice. Eclipse comes close with Java but, last I tried Vim and Emacs refactoring plugins, they were nowhere near as good or even very discoverable/usable).
Code review happens anyway, automated refactor or not
Hope you have very good unit tests.
See ctags/etags, cedet, ropemacs (refactoring Python), xrefactory (refactoring C and C++), wrangler (refactoring Erlang), etc.
People kludge them to fit all the time—look how older ctags implementations worked, after all—but it reminds me of a guy I who would write paragraphs so that each sentence had its own "line" and relied on implicit word wrap in LaTeX, HTML and the like to format it for human consumption. He did this so it would work better with tools like diff, patch, and version control in general. I thought "hey, worth a shot", tried it, and found it too clumsy for me during the writing process and abandoned it soon after.
git supports a --color-words option which is quite handy for text.
> I thought "hey, worth a shot", tried it, and found it too clumsy for me during the writing process and abandoned it soon after.
use auto fill and don't manually break lines :)
http://stackoverflow.com/questions/1616753/make-emacs-semant...
For refactoring, that's just an advanced text across many files manipulation feature, and emacs certainly can do it, but you might have to work on your .emacs file.
The numerous other things sound like either things you can do in gdb or valgrind, or again just advanced text search/editing.
Now all of this is not elegantly pulled together. You need to create this for yourself, make all these tools work together by developing a development environment for yourself. But once you do, you may be surprised just how elegantly everything works together.
Re-factoring is text editing, if you consider parsing to be advanced text editing(which it is not). Consider a class Foo implementing method foo, and a class Bar implementing a method of the same name foo. When I am renaming Foo.foo to Foo.bar, a refactoring tool will rename based on the semantics.
Renaming manually will always require looking through all occurrences, compared to clicking a couple of buttons in Eclipse and being assured it renamed all occurrences without any false positives or negatives.
Also, the nature of dynamic languages make it harder to refactor:
class Foo:
def foo():
pass
class Bar:
def foo():
pass
def a_func(arg):
arg.foo()
Now, in arg.foo, arg can be an instance of Foo, or Bar, or Baz...In a large codebase, manually doing it will be a night mare.I mostly use vim, linux and dynamic languages. But that doesn't change the fact that Eclipse/Java is leaps and bounds ahead when we are talking re-factoring.
Also, I use rope for Python. Though it mitigates most of the warts, it can't mitigate the issue in the snippet above. There is an `unsure` mode which renames when unsure, but that's not a smart thing to do on a large codebase.
Also, there's another strong argument I like to use: the UNIX philosophy of "Write programs to do one thing, and do it well". An IDE tries to do way too much (ie, everything) at the same time, from start to finish. That's highly inflexible and - in my opinion - terrible design.
There wasn't much new to me in the shell-focused parts, but there's some great VIM advice hidden in there.
Despite the great VIM part it covers a lot of topics that should be common knowledge for people developping on unix-like operating systems (or at least they should've heard about them).
And then I have cygwin, sometimes it's pain, for the symlinked files, as they don't run directly from cmd.exe, but a simple 'sh -c "gitk --all"' works. And now with the latest cygwin, that moved totally to X11 for tcl/tk, I need startxwin.cmd started somewhere (startup).
For places where cygwin overrides some of the CMD shell commands (and I'm quite fluent .bat file writer, and still use them a lot), I just do "call dir *.c /s/b", call, because cygwin has overriden my dir with their application, and I got tired of deleting it, rather I do "call dir" if I need the CMD shell.
grep, sed, bash, find, etc. are really awesome tools.
Lately I've been making a portable luajit distribution, and found out that BUSYBOX, being almost linux exclusive, can be compiled for Windows (mingw) and OSX. It packs a lot of the commands + shell + few other things in one executable.
And most of the time these commands would work the same way on each system. So "sed" would be the same sed on OSX, Linux and Windows... I'm thinking of moving to it, as right now my reliance on cygwin, while being good to me, makes me isolated if I want to share some of the scripts with coworkers (I can't make them install cygwin, but they won't have problems with 600kb busybox.exe)
The best IDE so far for me has been the command-line.
1. Most of the coding are done to interfaces and concrete classes are wired using factories or using spring dependency injection like,
InterfaceName obj=ObjFactory.getImpl(args)
I have to look at Class hierarchy often to go to the method that is being invoked, this is very easy in Eclipse (C+T)
2. Code completion for all methods (methods in different source files and from jars).
3. Highlight errors while editing.
4. Tracing call hierarchy
I tried Emacs some time back for shell scripting on a remote machine and I found that to be very useful and a right fit.
I would love to use Emacs for my java development if there are tools out there which can help me do things that I do with Eclipse. I already feel sluggish with Eclipse some times moving the mouse ;-)
I used to do a lot of Java in the past, and I have used eclipse and vim. Java in plain Vim is a huge PITA - auto complete, generating dummy getter setter, refactoring, fixing imports, checking errors without leaving the ide etc etc. I haphazardly fixed a couple of them using vim plugins and custom keybindings; and then I found eclim, which uses eclipse as a server and provides the functionality in Vim.
I solved the problem by not using Java, but this is obviously not an easy option for you :). Emacs does support Scala fairly well (from what I've heard) with Ensime, for it's worth.
Actually, some version control systems allow you to grep managed files specifically. E.g. in Git using git grep, including specific commits, branches, etc. Tim Pope's Fugitive git plugin for vim also does this (:Ggrep), and puts results on the quickfix list.
I sort of trusted that lots of smart people have used this environment and that I'd learn a lot trying to emulate them. So far the only major disappointment has been the vi scripting tool, vimscript just feels like a dead end.
I do imagine that there is a lot of received wisdom embedded in something like Eclipse -- just browsing the menus would probably suggest all sorts of helpful tools and practices. I keep meaning to check it out, but just haven't made the time.
This makes me wonder -- could one create something like the GUI equivalent of UNIX's modular philosophy? Desktop systems like OLE and KDE's kparts don't seem to have accomplished that goal. What about Web Intents?
When I worked in Java, I used Eclipse and hated it. Programming felt like filling out a contract.
When I worked in Common Lisp, I used Emacs and in combination with either Slime or Allegro environments. These were ideal to me. It got out of your way, but it had enough power and introspection into the code so that it could find almost anything (function/class defs, etc.) The debugger was also really good.
Still by far the best thing written about programming with Unix, and perhaps even the best programming book ever written (up there with K&R).
This may or may not be true for Vim, I don't know. But I think the majority of GNU Emacs users would view it as, to a large extent, supplanting the unix shell environment. Stallman notably didn't even use unix until he had written enough of emacs to be able to avoid ed and vi: he edited on another system and transferred the files across the network
I used to find/xargs/grep to find code snippets.
But, then, even Eclipse compares poorly to Genera, and it evolved from VisualAge for Java which was a near port of the Smalltalk product. So it isn't as though the competition is distinguishing itself through its excellence; look at how much effort in terms of code it is to integrate FindBugs with Eclipse—and all it does is some trivial static analysis!
http://servermonitoringhq.com/blog/the_ultimate_web_based_id...
Who thinks it's acceptable to do this?
/[a-z]{3,4}/iWhat does this mean:
Just another /[a-z]{3,4}/i hacker
I understand the re but I am curious about the context.EDIT: Ah, got it (I think). It's referring to being a polymath hacker: "Just another vim hacker", "Just another perl hacker", "Just another Unix hacker", etc.
But he is not a hacker of any of the following?
OS X
Linux
Emacs
C++
C
Python
Sh
Haskell
Go
Network
Computer
Prolog
Scheme
The 3,4 seems so limiting that it kind of vitiates the witty/cute aspect of the tagline...
(I know that Scheme is not the same as Lisp, and that a language is not the same as its compiler; but would you have "Just another .* hacker"? :-) )
(Also, I can't remember if 'ogle' is actually a tool in the Go language toolkit, although I seem to remember someone saying that it should be. Googling 'go ogle' doesn't have much luck, since Google thinks it knows what I really meant.)