编程老鸟、黑客与CEO的进化阶段

[ 2004-07-10 14:52:46 | 作者: yixia ]
字体大小: | |
很有道理的一篇文章,一定要看到底,越看越有味道,最后才是精髓

一般来说, 一个软件工程师将按如下几个阶段成长下去:
*****中学阶段*****
10 PRINT "HELLO WORLD"
20 END
*****大学一年级*****
program Hello(input, output)
begin
writeln('Hello World')
end.
*****大学高年级*****
(defun hello
(print
(cons 'Hello (list 'World))))
*****初级程序员*****
#include
void main(void)
{
  char *message[] = {"Hello ", "World"};
  int i;
  for(i = 0; i < 2; ++i)
  printf("%s", message[i]);
  printf("\n");
}
*****编程老鸟*****
#include
#include
class string {
  private:
  int size;
  char *ptr;
  public:
  string() : size(0),
  ptr(new char('\0')) {}
  string(const string &s) : size(s.size)
  {
    ptr = new char[size + 1];
    strcpy(ptr, s.ptr);
  }
  ~string()
  {
    delete [] ptr;
  }
  friend ostream &operator <<(ostream &, const string &);
  string &operator=(const char *);
};
ostream &operator<<(ostream &stream, const string &s)
{
  return(stream << s.ptr);
}
string &string::operator=(const char *chrs)
{
  if (this != &chrs)
  {
    delete [] ptr;
    size = strlen(chrs);
    ptr = new char[size + 1];
    strcpy(ptr, chrs);
  }
  return(*this);
}
int main()
{
  string str;
  str = "Hello World";
  cout << str << endl;
  return(0);
}
*****黑客初阶*****
#!/usr/local/bin/perl
$msg="Hello, world.\n";
if ($#ARGV >= 0) {
  while(defined($arg=shift(@ARGV))) {
  $outfilename = $arg;
  open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";
  print (FILE $msg);
  close(FILE) || die "Can't close $arg: $!\n";
  }
}
else
{
  print ($msg);
}
1;
*****黑客有成*****
#include
#define S "Hello, World\n"
main()
{exit(printf(S) == strlen(S) ? 0 : 1);}
*****黑客高手*****
% cc -o a.out ~/src/misc/hw/hw.c
% a.out
*****黑客大虾*****
% cat
Hello, world.
^D
*****项目组长*****
10 PRINT "HELLO WORLD"
20 END
*****部门经理*****
mail -s "Hello, world." bob@b12
Bob, could you please write me a program that prints "Hello, world."?
I need it by tomorrow.
^D
*****高级经理*****
% zmail jim
I need a "Hello, world." program by this afternoon.
*****首席执行官*****
% letter
letter: Command not found.
% mail
To: ^X ^F ^C
% help mail
help: Command not found.
% 他妈的!
!: Event unrecognized
% logout

浏览模式: 显示全部 | 评论: 1 | 引用: 0 | 排序 | 浏览: 597
forcey
[ 2005-06-07 17:22:11 ]
为啥 < ... > 都被吃掉了