Solved

Evolution of a programmer

Posted on 2002-04-23
10
626 Views
Last Modified: 2010-04-04
This is an old one... and most of it is C/C++... but it is still a good one!


The Evolution of a Programmer

*High School/Jr.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
(print
(cons 'Hello (list 'World))))


================================================

*New professional
#include <stdio.h>
void main(void)
{
char *message[] = {"Hello ", "World"}; int i; for(i = 0; i < 2; ++i)
printf("%s", message[i]);
printf("\n");
}
================================================


*Seasoned professional


#include <iostream.h>
#include <string.h>
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);
}



================================================



*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
#include "pshlo.idl"
[
uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820) ] cotype THello
{
interface IHello;
interface IPersistFile;
};
};
[
exe,
uuid(2573F890-CFEE-101A-9A9F-00AA00342820) ] module CHelloLib
{
// some code related header files
importheader(<windows.h>);
importheader(<ole2.h>);
importheader(<except.hxx>);
importheader("pshlo.h");
importheader("shlo.hxx");
importheader("mycls.hxx");
// needed typelibs
importlib("actimp.tlb");
importlib("actexp.tlb");
importlib("thlo.tlb");
[
uuid(2573F891-CFEE-101A-9A9F-00AA00342820), aggregatable ]
coclass CHello
{
cotype THello;
};
};
#include "ipfix.hxx"
extern HANDLE hEvent;
class CHello : public CHelloBase
{
public:
IPFIX(CLSID_CHello);
CHello(IUnknown *pUnk);
~CHello();
HRESULT  __stdcall PrintSz(LPWSTR pwszString); private:
static int cObjRef;
};
#include <windows.h>
#include <ole2.h>
#include <stdio.h>
#include <stdlib.h>
#include "thlo.h"
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"
int CHello::cObjRef = 0;
CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk) {
cObjRef++;
return;
}
HRESULT  __stdcall  CHello::PrintSz(LPWSTR pwszString) {
printf("%ws\n", pwszString);
return(ResultFromScode(S_OK));
}
CHello::~CHello(void)
{
// when the object count goes to zero, stop the server cObjRef--;
if( cObjRef == 0 )
PulseEvent(hEvent);
return;
}
#include <windows.h>
#include <ole2.h>
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"
HANDLE hEvent;
int _cdecl main(
int argc,
char * argv[]
) {
ULONG ulRef;
DWORD dwRegistration;
CHelloCF *pCF = new CHelloCF();
hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); // Initialize
the OLE
libraries
CoInitializeEx(NULL, COINIT_MULTITHREADED); CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,
REGCLS_MULTIPLEUSE, &dwRegistration); // wait on an event to stop
WaitForSingleObject(hEvent, INFINITE); // revoke and release the class object
CoRevokeClassObject(dwRegistration); ulRef = pCF-Release(); // Tell OLE we are going away.
CoUninitialize();
return(0); }
extern CLSID CLSID_CHello;
extern UUID LIBID_CHelloLib;
CLSID CLSID_CHello = { /*
2573F891-CFEE-101A-9A9F-00AA00342820 */ 0x2573F891,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 } };
UUID LIBID_CHelloLib = { /*
2573F890-CFEE-101A-9A9F-00AA00342820 */ 0x2573F890,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 } };
#include <windows.h>
#include <ole2.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "pshlo.h"
#include "shlo.hxx"
#include "clsid.h"
int _cdecl main(
int argc,
char * argv[]
) {
HRESULT  hRslt;
IHello        *pHello;
ULONG  ulCnt;
IMoniker * pmk;
WCHAR  wcsT[_MAX_PATH];
WCHAR  wcsPath[2 * _MAX_PATH];
// get object path
wcsPath[0] = '\0';
wcsT[0] = '\0';
if( argc  1) {
mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
wcsupr(wcsPath);
}
else {
fprintf(stderr, "Object path must be specified\n");
return(1);
}
// get print string
if(argc  2)
mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1); else
wcscpy(wcsT, L"Hello World");
printf("Linking to object %ws\n", wcsPath); printf("Text String %ws\n", wcsT);
// Initialize the OLE libraries
hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(SUCCEEDED(hRslt)) {
hRslt = CreateFileMoniker(wcsPath, &pmk); if(SUCCEEDED(hRslt))
hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello); if(SUCCEEDED(hRslt)) {
// print a string out
pHello-PrintSz(wcsT);
Sleep(2000);
ulCnt = pHello-Release();
}
else
printf("Failure to connect, status: %lx", hRslt); // Tell OLE we are going away.
CoUninitialize();
}
return(0);
}

0
Comment
Question by:DrDelphi
10 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6962714
:-)))
... and what is the question?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6962721
also an old one, but i like it

TASK: Shoot yourself in the foot.


C: You shoot yourself in the foot.

C++: You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can't tell which are bitwise copies and which are just pointing at others and saying, "That's me, over there."

FORTRAN: You shoot yourself in each toe, iteratively, until you run out of toes, then you read in the next foot and repeat. If you run out of bullets, you continue with the attempts to shoot yourself anyways because you have no exception-handling capability.

Pascal: The compiler won't let you shoot yourself in the foot.

Ada: After correctly packing your foot, you attempt to concurrently load the gun, pull the trigger, scream, and shoot yourself in the foot. When you try, however, you discover you can't because your foot is of the wrong type.

COBOL: Using a COLT 45 HANDGUN, AIM gun at LEG.FOOT, THEN place ARM.HAND.FINGER on HANDGUN.TRIGGER and SQUEEZE. THEN return HANDGUN to HOLSTER. CHECK whether shoelace needs to be re-tied.

LISP: You shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds...

FORTH: Foot in yourself shoot.

Prolog: You tell your program that you want to be shot in the foot. The program figures out how to do it, but the syntax doesn't permit it to explain it to you.

BASIC: Shoot yourself in the foot with a water pistol. On large systems, continue until entire lower body is waterlogged.

Visual Basic: You'll really only _appear_ to have shot yourself in the foot, but you'll have had so much fun doing it that you won't care.

HyperTalk: Put the first bullet of gun into foot left of leg of you. Answer the result.

Motif: You spend days writing a UIL description of your foot, the bullet, its trajectory, and the intricate scrollwork on the ivory handles of the gun. When you finally get around to pulling the trigger, the gun jams.

APL: You shoot yourself in the foot, then spend all day figuring out how to do it in fewer characters.

SNOBOL: If you succeed, shoot yourself in the left foot. If you fail, shoot yourself in the right foot.

Unix:
% ls
foot.c foot.h foot.o toe.c toe.o
% rm * .o
rm:.o no such file or directory
% ls
%

Concurrent Euclid: You shoot yourself in somebody else's foot.

370 JCL: You send your foot down to MIS and include a 400-page document explaining exactly how you want it to be shot. Three years later, your foot comes back deep-fried.

Paradox: Not only can you shoot yourself in the foot, your users can, too.

Access: You try to point the gun at your foot, but it shoots holes in all your Borland distribution diskettes instead.

Revelation: You're sure you're going to be able to shoot yourself in the foot, just as soon as you figure out what all these nifty little bullet-thingies are for.

Assembler: You try to shoot yourself in the foot, only to discover you must first invent the gun, the bullet, the trigger, and your foot.

Modula2: After realizing that you can't actually accomplish anything in this language, you shoot yourself in the head.  
   

meikl ;-)
0
 
LVL 6

Author Comment

by:DrDelphi
ID: 6962806
>Visual Basic: You'll really only _appear_ to have shot >yourself in the foot, but you'll have had so
>much fun doing it that you won't care.

To ACTUALLY shoot yourself in the foot, you'll need to distribute VBRUNFOOTSHOOT.DLL and then don't expect the bullet to get there anytime soon. If it doesn't arrive, as with all M$ products, call that an "undocumented feature" and charge more.
:->

0
 

Expert Comment

by:revdmv
ID: 6962927
>The Evolution of a Programmer

>*High School/Jr.High
>10 PRINT "HELLO WORLD"
>20 END

<snip>
=====================================
*Consultant

10 PRINT "HELLO WORLD"
20 END

Submit timesheet for 100 hours @150/hr
0
 
LVL 6

Author Comment

by:DrDelphi
ID: 6963279
*CMM Consultant
 
1.Take coffe break

2.Write 10 page essay on how each keystroke MUST be
  documented.

3.Take coffe break


4.Review and verify that "HELLO WORLD" is the same "HELLO  WORLD" used in previous applications and that the process of writing it followed the Maturity Model.

5.Take coffe break


6. Send out a broadcast email to all program managers and developers informing them that in the future if they are going to use "HELLO WORLD" in an application, it MUST be preceded by the number "10" and followed by the line "20 END"

7.Take coffe break

8. Verify and Document version of "HELLO WORLD"

9.Take coffe break

10. Send out a broadcast email to all program managers and developers informing them that in the future if they are going to use "HELLO WORLD" in an application, it MUST be version "10"

11.Take coffe break

12. Send email to all managers and developers informing that the development cycle is falling behind the Model's timeline.

13.Take coffe break
14.Take coffe break
15.Take coffe break
16.Take coffe break





 
 
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 9

Expert Comment

by:ITugay
ID: 6964722
:-)))

hi David,
hi meikl,
hi all.

It is really nice question. My boss can't understand why I have so happy face on workplace.

And there is another old one, seems it known for all, so, just a link:
http://pascal-central.com/top10.html

----
Igor
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6965522
=:-D
0
 
LVL 45

Expert Comment

by:aikimark
ID: 6967484
1. (hard-wired) tab equipment boards
 2. 11101010111110101001000001010011
 3. ASSEMBLER
 4. FORTRAN
 5. COBOL
 6. BASIC
 7. PASCAL
 8. PL/I
 9. RPG
10. APL
11. C
12. C++
13. JAVA
14. PERL
15. PHP
16. software configurable hardware
0
 
LVL 1

Expert Comment

by:pnh73
ID: 9004083
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/No Refund

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
0
 

Accepted Solution

by:
YensidMod earned 0 total points
ID: 9096472
Question is PAQ'd and no points refunded.

YensidMod
Community Support Moderator @Experts Exchange
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Delphi - replicating a form 8 57
oracle global variables 4 51
Working with hours 3 31
select query - oracle 16 81
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now