OldSchoolHack

Register / Login English

Die 14 Evolutionsstufen eines Programmierers


icon Die 14 Evolutionsstufen eines Programmierers #1

Join Date: Aug 2007

Posts: 8643

User-Rating:

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

wie wahr, wie wahr

greetz KN4CK3R

__________________

Hallo
icon #2

Join Date: Jul 2009

Posts: 16

Du hast aber noch die Stufe vor "Schüler" vergessen:

TEXT Code:
  1.  
  2. Stufe 0: Schlechter und ungeduldiger und fauler Schüler
  3.  
  4. /*Quelltextschnippsel anderer kopieren, ohne zu erkennen, dass es nur Schnipsel sind*/
  5. /*Visual Express öffnen, reinkopieren, build project*/
  6. /*Fehlermeldung gereizt wahrnehmen*/
  7. /*auf www.oldschoolhack.de einloggen*/
  8. #include <mieseorthografie.h>
  9. /*gereizt fragen, wieso es nicht geht, auf programmiererfahrung verweisen*/
  10. /*unvermeidliche antwort bekommen*/
  11. cout << "Lerne die Grundlagen, sonst wird das nichts, greetz kn4ck3r" << endl;
  12.