OldSchoolHack

Registrieren / Anmelden Deutsch

Die 14 Evolutionsstufen eines Programmierers

icon Thema: Die 14 Evolutionsstufen eines Programmierers

Anmeldungsdatum: Aug 2007

Beiträge: 8643

Benutzer-Bewertung:

199 positiv
33 negativ
TEXT Code:
  1. Stufe 1: Schüler
  2.  
  3. 10 PRINT "HELLO WORLD"
  4. 20 END
  5.  
  6.  
  7. Stufe 2: Das erste Studienjahr
  8.  
  9. program Hello(input, output)
  10. begin
  11. writeln('Hello World')
  12. end.
  13.  
  14. Stufe 3: Im Hauptstudium
  15.  
  16. (defun hello
  17. (print
  18. (cons 'Hello (list 'World))))
  19.  
  20. Stufe 4: Der 1. Job
  21.  
  22. #include <stdio.h>
  23.  
  24. void main(void)
  25. {
  26. char *message[] = {"Hello ", "World"};
  27. int i;
  28.  
  29. for(i = 0; i < 2; ++i)
  30. printf("%s", message[i]);
  31.  
  32. printf("\n");
  33. }
  34.  
  35. Stufe 5: Erfahrener Softwareentwickler
  36.  
  37. #include <iostream.h>
  38. #include <string.h>
  39.  
  40. class string
  41. {
  42. private:
  43. int size;
  44. char *ptr;
  45. public:
  46. string() : size(0), ptr(new char('\0')) {};
  47.  
  48. string(const string &s) : size(s.size)
  49. {
  50. ptr = new char[size + 1];
  51. strcpy(ptr, s.ptr);
  52. };
  53.  
  54. string()
  55. {
  56. delete [] ptr;
  57. };
  58.  
  59. friend ostream& operator <<(ostream &, const string &);
  60.  
  61. string& operator=(const char *);
  62.  
  63. ostream &operator<<(ostream &stream, const string &s)
  64. {
  65. return(stream << s.ptr);
  66. };
  67. };
  68.  
  69. string& string::operator=(const char *chrs)
  70. {
  71. if (this != &chrs)
  72. {
  73. delete[] ptr;
  74. size = strlen(chrs);
  75.  
  76. ptr = new char[size + 1];
  77. strcpy(ptr, chrs);
  78. }
  79.  
  80. return *this;
  81. }
  82.  
  83. int main(void)
  84. {
  85. string str;
  86.  
  87. str = "Hello World";
  88. cout << str << endl;
  89.  
  90. return 0;
  91. }
  92.  
  93. Stufe 6: Chefentwickler
  94.  
  95. [
  96. uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
  97. ]
  98.  
  99. library LHello
  100. {
  101. // bring in the master library
  102. importlib("actimp.tlb");
  103. importlib("actexp.tlb");
  104.  
  105. // bring in my interfaces
  106. #include "pshlo.idl"
  107.  
  108. [
  109. uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
  110. ]
  111.  
  112. cotype THello
  113. {
  114. interface IHello;
  115. interface IPersistFile;
  116. };
  117. };
  118.  
  119. [
  120. exe,
  121. uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
  122. ]
  123.  
  124. module CHelloLib
  125. {
  126. // some code related header files
  127. importheader("pshlo.h");
  128. importheader("shlo.hxx");
  129. importheader("mycls.hxx");
  130.  
  131. // needed typelibs
  132. importlib("actimp.tlb");
  133. importlib("actexp.tlb");
  134. importlib("thlo.tlb");
  135.  
  136. [
  137. uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
  138. aggregatable
  139. ]
  140.  
  141. coclass CHello
  142. {
  143. cotype THello;
  144. };
  145. };
  146.  
  147. #include "ipfix.hxx"
  148.  
  149. extern HANDLE hEvent;
  150.  
  151. class CHello : public CHelloBase
  152. {
  153. public:
  154. IPFIX(CLSID_CHello);
  155.  
  156. CHello(IUnknown *pUnk);
  157. ~CHello();
  158.  
  159. HRESULT __stdcall PrintSz(LPWSTR pwszString);
  160.  
  161. private:
  162. static int cObjRef;
  163. };
  164.  
  165. #include "thlo.h"
  166. #include "pshlo.h"
  167. #include "shlo.hxx"
  168. #include "mycls.hxx"
  169.  
  170. int CHello::cObjRef = 0;
  171.  
  172. CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
  173. {
  174. cObjRef++;
  175. }
  176.  
  177. HRESULT __stdcall CHello::PrintSz(LPWSTR pwszString)
  178. {
  179. printf("%ws\n", pwszString);
  180. return ResultFromScode(S_OK);
  181. }
  182.  
  183. CHello::~CHello()
  184. {
  185. // when the object count goes to zero, stop the server
  186. cObjRef--;
  187.  
  188. if (cObjRef == 0)
  189. PulseEvent(hEvent);
  190. }
  191.  
  192. #include "pshlo.h"
  193. #include "shlo.hxx"
  194. #include "mycls.hxx"
  195.  
  196. HANDLE hEvent;
  197.  
  198. int _cdecl main(int argc, char * argv[])
  199. {
  200. ULONG ulRef;
  201. DWORD dwRegistration;
  202.  
  203. CHelloCF *pCF = new CHelloCF();
  204. hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
  205.  
  206. // Initialize the OLE libraries
  207. CoInitializeEx(NULL, COINIT_MULTITHREADED);
  208. CoRegisterClassObject(CLSID_CHello, pCF,
  209. CLSCTX_LOCAL_SERVER,
  210. REGCLS_MULTIPLEUSE, &dwRegistration);
  211.  
  212. // wait on an event to stop
  213. WaitForSingleObject(hEvent, INFINITE);
  214.  
  215. // revoke and release the class object
  216. CoRevokeClassObject(dwRegistration);
  217. ulRef = pCF->Release();
  218.  
  219. // Tell OLE we are going away.
  220. CoUninitialize();
  221.  
  222. return 0;
  223. }
  224.  
  225. extern CLSID CLSID_CHello;
  226. extern UUID LIBID_CHelloLib;
  227. CLSID CLSID_CHello =
  228. {/* 2573F891-CFEE-101A-9A9F-00AA00342820 */
  229. 0x2573F891,
  230. 0xCFEE,
  231. 0x101A, { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
  232. };
  233.  
  234. UUID LIBID_CHelloLib =
  235. {/* 2573F890-CFEE-101A-9A9F-00AA00342820 */
  236. 0x2573F890,
  237. 0xCFEE,
  238. 0x101A, { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
  239. };
  240.  
  241. #include "pshlo.h"
  242. #include "shlo.hxx"
  243. #include "clsid.h"
  244.  
  245. int _cdecl main(int argc, char * argv[])
  246. {
  247. HRESULT hRslt;
  248. IHello* pHello;
  249. ULONG ulCnt;
  250. IMoniker* pmk;
  251. WCHAR wcsT[_MAX_PATH];
  252. WCHAR wcsPath[2 * _MAX_PATH];
  253.  
  254. // get object path
  255. wcsPath[0] = '\0';
  256. wcsT[0] = '\0';
  257.  
  258. if (argc == 1)
  259. {
  260. mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
  261. wcsupr(wcsPath);
  262. }
  263. else
  264. {
  265. fprintf(stderr, "Object path must be specified\n");
  266. return 1;
  267. }
  268.  
  269. // get print string
  270. if (argc == 2)
  271. mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1);
  272. else
  273. wcscpy(wcsT, L"Hello World");
  274.  
  275. printf("Linking to object %ws\n", wcsPath);
  276. printf("Text String %ws\n", wcsT);
  277.  
  278. // Initialize the OLE libraries
  279. hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  280.  
  281. if (SUCCEEDED(hRslt))
  282. {
  283. hRslt = CreateFileMoniker(wcsPath, &pmk);
  284.  
  285. if (SUCCEEDED(hRslt))
  286. hRslt = BindMoniker(pmk, 0, IID_IHello,
  287. (void**)&pHello);
  288.  
  289. if (SUCCEEDED(hRslt))
  290. { // print a string out
  291. pHello-PrintSz(wcsT);
  292. Sleep(2000);
  293. ulCnt = pHello->Release();
  294. }
  295. else
  296. printf("Failure to connect, status: %lx\n", hRslt);
  297.  
  298. // Tell OLE we are going away.
  299. CoUninitialize();
  300. }
  301.  
  302. return 0;
  303. }
  304.  
  305. Stufe 7: Lernender Hacker
  306.  
  307. #!/usr/local/bin/perl
  308. $msg="Hello, world.\n";
  309. if ($#ARGV = 0)
  310. {
  311. while(defined($arg=shift(@ARGV)))
  312. {
  313. $outfilename = $arg;
  314. open(FILE, "" . $outfilename) || die "Can't write
  315. $arg:$!\n";
  316. print (FILE $msg);
  317. close(FILE) || die "Can't close $arg: $!\n";
  318. }
  319. }
  320. else
  321. {
  322. print ($msg);
  323. }
  324. 1;
  325.  
  326. Stufe 8: Erfahrener Hacker
  327.  
  328. #include <stdio.h>
  329. #define S "Hello, World\n"
  330. main(){exit(printf(S) == strlen(S) ? 0 : 1);}
  331.  
  332. Stufe 9: Ausgebuffter Hacker
  333.  
  334. % cc -o a.out /src/misc/hw/hw.c
  335. % a.out
  336.  
  337. Stufe 10: Guru Hacker
  338.  
  339. % cat
  340. Hello, world.
  341.  
  342. Stufe 11: Neuer Manager
  343.  
  344. 10 PRINT "HELLO WORLD"
  345. 20 END
  346.  
  347. Stufe 12: Mittleres Management
  348.  
  349. mail -s "Hello, world." bob@b12
  350. Bob, could you please write me a program that prints "Hello
  351. world."?
  352.  
  353. I need it by tomorrow.
  354.  
  355. Stufe 13: Gehobenes Management
  356.  
  357. % zmail jim
  358. I need a "Hello, world." program by this afternoon.
  359.  
  360. Stufe 14: Geschäftsführer
  361.  
  362. % letter
  363. letter: Command not found.
  364. % mail
  365. To: ^X ^F ^C
  366. % help mail
  367. help: Command not found.
  368. % damn!
  369. !: Event unrecognized
  370. % logout


__________________

Hallo