2007年 09月 14日 的归档
[转帖]一位程序员的演变历程
来源: http://sunsite.nus.edu.sg/pub/humour/prog-evolve.html
The Evolution of a Programmer
High School/Junior High
代码: |
10 PRINT “HELLO WORLD” 20 END |
First year in College
代码: |
program Hello(input, output) begin writeln(‘Hello World’) end. |
Senior year in College
代码: |
(defun hello (cons ‘Hello (list ‘World)))) |
New professional
代码: |
#include <stdio.h> void main(void) { char *message[] = {“Hello “, “World”}; int i; for(i = 0; i < 2; ++i) |
Seasoned professional
代码: |
#include <iostream.h> #include <string.h> class string public: string(const string &s) : size(s.size) ~string() friend ostream &operator <<(ostream &, const string &); ostream &operator<<(ostream &stream, const string &s) string &string::operator=(const char *chrs) int main() str = “Hello World”; return(0); |
Master Programmer
代码: |
[ uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820) ] library LHello { // bring in the master library importlib(“actimp.tlb”); importlib(“actexp.tlb”); // bring in my interfaces [ [ // some code related header files // needed typelibs [ #include “ipfix.hxx” extern HANDLE hEvent; class CHello : public CHelloBase CHello(IUnknown *pUnk); HRESULT __stdcall PrintSz(LPWSTR pwszString); private: #include <windows.h> int CHello::cObjRef = 0; CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk) HRESULT __stdcall CHello::PrintSz(LPWSTR pwszString) CHello::~CHello(void) // when the object count goes to zero, stop the server return; #include <windows.h> HANDLE hEvent; int _cdecl main( hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); // Initialize the OLE libraries CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER, // wait on an event to stop // revoke and release the class object // Tell OLE we are going away. return(0); } extern CLSID CLSID_CHello; CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */ UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */ #include <windows.h> int _cdecl main( // get object path // get print string printf(“Linking to object %ws\n”, wcsPath); // Initialize the OLE libraries if(SUCCEEDED(hRslt)) { hRslt = CreateFileMoniker(wcsPath, &pmk); if(SUCCEEDED(hRslt)) { // print a string out Sleep(2000); // Tell OLE we are going away. return(0); |
Apprentice Hacker
代码: |
#!/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; |
Experienced Hacker
代码: |
#include <stdio.h> #define S “Hello, World\n” main(){exit(printf(S) == strlen(S) ? 0 : 1);} |
Seasoned Hacker
代码: |
% cc -o a.out ~/src/misc/hw/hw.c % a.out |
Guru Hacker
代码: |
% cat Hello, world. ^D |
New Manager
代码: |
10 PRINT “HELLO WORLD” 20 END |
Middle Manager
代码: |
mail -s “Hello, world.” bob@b12 Bob, could you please write me a program that prints “Hello, world.”? I need it by tomorrow. ^D |
Senior Manager
代码: |
% zmail jim I need a “Hello, world.” program by this afternoon. |
Chief Executive
代码: |
% letter letter: Command not found. To: ^X ^F ^C % help mail help: Command not found. % damn! !: Event unrecognized % logout |
High School/Junior High 高中阶段是 basic
First year in College 到了大一 成了pascal
Senior year in College 大二成了 lisp,这个比较少见
New professional 是C
Seasoned professional 成了C++
Master Programmer 这个我也还不确定,不过应该是传说中的 C#
Apprentice Hacker 是perl,没得说了
Experienced Hacker 还是C,不过水平显然不一样了
Seasoned Hacker 只会编译了。。。
Guru Hacker 直接用现成的工具了
New Manager 回归basic了
Middle Manager 发个邮件给手下,说明天要个程序
Senior Manager 邮件更简单了,直接下午要
Chief Executive 不会打命令了,经常打错,后来直接logout了,估计直接找手下对话去了。。。。