Docsity

Language Evaluation Criterion - Programming Languages - Lecture Slides, Slides of Programming Languages

Partial preview of the text

Download Language Evaluation Criterion - Programming Languages - Lecture Slides and more Slides Programming Languages in PDF only on Docsity!

Language Evaluation Criterion

Programming Languages Table

Capers Jones

Language Level Relationship to Productivity

LANGUAGE LEVEL PRODUCTIVITY AVERAGE PER STAFF MONTH

1 - 3 5 to 10 Function Points

4 - 8 10 to 20 Function Points

9 - 15 16 to 23 Function Points

16 - 23 15 to 30 Function Points

24 - 55 30 to 50 Function Points

Above 55 40 to 100 Function Points

Assembly(1), C(2.5), Pascal(3.5), LISP(5), BASIC(5), C++(6)

First year in College โ€“ Pascal

4 lines

program Hello(input, output) begin writeln('Hello World') end.

Senior year in College - LISP

3 lines

(defun hello (print (cons 'Hello (list 'World))))

Seasoned professional โ€“ C++

#include

#include

int main()

String str;

str = "Hello World";

cout << str << endl;

return(0);

Master Programmer โ€“ Distributed Computing โ€“ 1/ 224 lines

[
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;

Master Programmer โ€“ Distributed Computing โ€“ 3/ [ uuid(2573F891-CFEE-101A-9A9F- 00AA00342820), aggregatable ] coclass CHello { cotype THello; }; }; #include "ipfix.hxx" extern HANDLE hEvent;

Master Programmer โ€“ Distributed Computing โ€“ 4/ class CHello : public CHelloBase { public: IPFIX(CLSID_CHello); CHello(IUnknown *pUnk); ~CHello(); HRESULT __stdcall PrintSz(LPWSTR pwszString); private: static int cObjRef; };

Master Programmer โ€“ Distributed Computing โ€“ 6/ 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; }

Master Programmer โ€“ Distributed Computing โ€“ 7/ 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.

Master Programmer โ€“ Distributed Computing โ€“ 9/ #include #include #include #include #include #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];

Master Programmer โ€“ Distributed Computing โ€“ 10/ // 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);

Language Evaluation Criteria

I have reaffirmed a long-standing and strongly

held view: Language comparisons are rarely

meaningful and even less often fair. A good

comparison of major programming languages

requires more effort than most people are willing

to spend, experience in a wide range of

application areas, a rigid maintenance of a

detached and impartial point of view, and a

sense of fairness.

Bjarne Stroustrup

Language Evaluation Criterion

โ€ข How to compare and examine languages?

โ€ข Base Criteria:

โ€“ Readability

โ€“ Writability

โ€“ Reliability