A Conversation for The H2G2 Programmers' Corner

Java code?

Post 81

some bloke who tried to think of a short, catchy, pithy name and spent five sleepless nights trying but couldn't think of one

The fastest computer in my house (out of five) is 300MHz, followed by 266MHz, two 486s and a 386.


Java code?

Post 82

MaW

300MHz isn't bad at all really. I only got my 800 because my K6-2 333's motherboard died (keyboard socket fell off!)


Java code?

Post 83

DoctorMO (Keeper of the Computer, Guru, Community Artist)

You know i think I've said this before, I used to have a P75 well I still do but I don't use it as much. I was stuck on that because nobody else wanted it. and I had to cope with programmers who had bubblerap for brains one day and decided it would be nice to put in MMX instructioned code with no replacments. not funny guys.

if you do programms in a 486 assebler and builpd up your database of functions you can be sure of a time saving and know that if somthing dosn't do what you want you don't have to write a whole new one you can just mod one, pluss assembler is only depentent on it's self unless you call things outside and theres not much point in assembler programming if you do.

VB --> Horse and cart
C++ ----> Jap high speed train
Asm -----------> B2 Jet fighter.

-- DoctorMO --


Java code?

Post 84

MaW

I'm not going to bother arguing with you anymore. Let's just say we have different opinions on the matter and leave it at that, shall we?


Java code?

Post 85

DoctorMO (Keeper of the Computer, Guru, Community Artist)

Ok that seems fine, I just don't like it when people can't seer the blantly obvous for speel that there mind is producing as part of a bias towards one thing or another, (it has somthing to do with the fact that if you admited to your self that asm was better of in fact anything else that you know know, you may have to end up learning some of it.)

It's somthing Adults do alot.

-- DoctorMO --


Java code?

Post 86

Dancer (put your advert here)

Cute DocMO, BUT:

Fact is that programming IS done in C and C++, NOT Assembler. There is a really good reason why Assembler is only used in EXTREAM cases (only when even a single cycle will be a good optimisation), the reason is that programming of good sophisticated programs requires maintenance of the code.

Coding for a company is mighty different then coding for fun or as a project with friends/for school.

You have to write a code that some new guy will understand after youre gone. That's hardly possible in Assembler.

smiley - hsif
Dancer


Java code?

Post 87

DoctorMO (Keeper of the Computer, Guru, Community Artist)

Ah you see now you run into the incompantance of some programmers, in assembler the useual aplyed method is 3 lines of notes for every one line of Assembler so there realy isn't anything to say on that side, I will say that I still use VB it is very usefull and very quick but surly If your going to write things like say windows and do all the functiions you know are going to be called many many many time in loops or just realy proccesor intensive like disk accesses then maby you should think about doing some embded Asm in your C++ code, Oh and I realy like the idea that you are some how suposed to learn C++ from nothing, (little note read above and understand because it works for me too)

-- DoctorMO --


Java code?

Post 88

Felonious Monk - h2g2s very own Bogeyman

(opens the can of petrol and pours it on the flames...)

I have written about ten commercial systems ALL running in VB. They have upwards of a hundred users, yet all were brought in on time and to the required specification and perform perfectly well, without falling over. They are easy to maintain and deploy. The reason most commercial IT projects fail is NOT because of a failure of performance but because they fail to deliver on time. Compare and contrast the following code for a Windows application:

'Hello, World' (VB version)

Private Sub Command1_Click()

MsgBox "Hello, World", vbOKOnly Or vbExclamation, "Hi!"

End Sub


'Hello, World' (C version)

// Stupid "Hello World" example
//
// The user clicks a command button, and a "Hello World"
// message box appears.
#include

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static char szAppName[] = "SayHello" ;
HWND hwnd ;
MSG msg ;
WNDCLASSEX wndclass ;

wndclass.cbSize = sizeof (wndclass) ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION) ;

RegisterClassEx(&wndclass) ;

hwnd = CreateWindow(szAppName, "Hello World",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL) ;

ShowWindow(hwnd, iCmdShow) ;
UpdateWindow(hwnd) ;

while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg) ;
DispatchMessage(&msg) ;
}
return msg.wParam ;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam,
LPARAM lParam)
{
int wNotifyCode ;
HWND hwndCtl ;
static HWND hwndButton ;
static RECT rect ;
static int cxChar, cyChar ;
HDC hdc ;
PAINTSTRUCT ps ;
TEXTMETRIC tm ;

switch (iMsg)
{
case WM_CREATE :
hdc = GetDC(hwnd) ;
SelectObject(hdc, GetStockObject (SYSTEM_FIXED_FONT)) ;
GetTextMetrics(hdc, &tm) ;
cxChar = tm.tmAveCharWidth ;
cyChar = tm.tmHeight + tm.tmExternalLeading ;
ReleaseDC(hwnd, hdc) ;
GetClientRect( hwnd, &rect ) ;

hwndButton = CreateWindow("BUTTON", "&Say Hello",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
(rect.right-rect.left)/20*9,
(rect.bottom-rect.top)/10*4,
14 * cxChar, 3 * cyChar,
(HWND) hwnd, 1,
((LPCREATESTRUCT) lParam) -> hInstance, NULL) ;

return 0 ;

case WM_SIZE :
rect.left = 24 * cxChar ;
rect.top = 2 * cyChar ;
rect.right = LOWORD (lParam) ;
rect.bottom = HIWORD (lParam) ;
return 0 ;

case WM_PAINT :
InvalidateRect(hwnd, &rect, TRUE) ;

hdc = BeginPaint(hwnd, &ps) ;
EndPaint(hwnd, &ps) ;
return 0 ;

case WM_DRAWITEM :
case WM_COMMAND :
wNotifyCode = HIWORD(wParam) ;
hwndCtl = (HWND) lParam ;

if ((hwndCtl == hwndButton) && (wNotifyCode == BN_CLICKED))
MessageBox(hwnd, "Hello, World!", "Greetings", MB_OK) ;

ValidateRect(hwnd, &rect) ;

break ;

case WM_DESTROY :
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, iMsg, wParam, lParam) ;
}

If you thought it was tedious reading through that last example, try coding it.

Anybody who recommends C++ over VB as a default tool for a Windows project is, quite frankly, an idiot. If you want to become a developer of viable, cost-effective solutions for the Windows platform, learn VB. If you wish to take three times as long and and you think it more important to squeeze the last tenth of a percent out of the processor, learn C++.

Make Life easy for yourself: it's too short.


Java code?

Post 89

DoctorMO (Keeper of the Computer, Guru, Community Artist)

smiley - biggrin

I like it.

Now if we could just get microsoft to speed up some of the VB DLLs we would be laughing.

-- DoctorMO --


Java code?

Post 90

Felonious Monk - h2g2s very own Bogeyman

I've never really found speed to be a problem after VB 5.0, certainly not with VB6.0. The argument about compiled vs. native code is a bit of a red herring as most of the time VB spends is in the 'plumbing' code, as you quite rightly point out. The .NET framework seems to have addressed performance issues, and allows you to virtually anything you can do with C++.


Java code?

Post 91

Sir John Luke, Jedi Knight, Keeper of the Black Stuff (no, not marmite), dark disciple #5

(Interjects) - ...and try using the power of the .NET framework from Assembler smiley - smiley. I'd be very interested to know if there is ANY Assembler code left in the .NET framework - or even in Windows itself - and I speak as one weaned on ICL 1900, System 4 and PDP/11 Assemblers (shows age).


Java code?

Post 92

DoctorMO (Keeper of the Computer, Guru, Community Artist)

I hope .NET is everything people have said it is, We know the only way to acumplish true speed is native code, so if microsft and Borland can write there software compiliers to comply more to fast code then it would be fast performance, although when programming I always program for the lowest spec available to buy and at the moment thats a P500. smiley - smiley

-- DoctorMO --


Java code?

Post 93

Felonious Monk - h2g2s very own Bogeyman

I hope .NET is good as well. I personally don't have any problem with Microsoft's stuff at all. It is cost effective and generally a joy to work with. VB may be an aesthetically ugly language compared to, say Java, but who gives a sick dog's dump? It's the IDE which speeds things up, and getting to grips with the API/framework/object model/whatever that slows one down. And Pure OO design is overrated, anyway. I have yet to see a commercial system that performs well and implements such a design, as I have yet to see a commercial database that runs in Third Normal Form.

Some people I know (I call them the Jaleban) maintain that *everything* should be done in Java now, on the grounds of 'platform independence'. This despite the fact that Windows dominates the desktop and file server markets, and will soon probably dominate the application server market.


Java code?

Post 94

some bloke who tried to think of a short, catchy, pithy name and spent five sleepless nights trying but couldn't think of one

I don't believe that EVERYTHING should be done in Java, however I DO believe that NOTHING should be done in a language which forces you to stick to a single OS (eg VB)


Java code?

Post 95

Felonious Monk - h2g2s very own Bogeyman

Absolutely NOTHING? Are you sure about that??! You can accomplish huge amounts on the Windows platform with VB, and let's face it, Windows is going to be around for a long time yet. Platform independence is pretty low down on the list of operating requirements for many organizations: what they'd prefer is the system in and running *on time*. You obviously haven't had too much real world experience otherwise you wouldn't be making such naive comments.

let's look at some metrics for a 2000 function point business system(which I derived using a standard industry package). Java produces a schedule of 64 staff months. VB produces a schedule of 30 staff months. Visual C++ (using wizards) produces a schedule of 57 staff months. You'd have to have a very good reason for opting for a tool that more than doubles the schedule.


Java code?

Post 96

DoctorMO (Keeper of the Computer, Guru, Community Artist)

unless your employes are stupid and need 60 months smiley - winkeye, This is why microsft is so big anyway, because big bisness guys bought into the hype and didn't want to change there systems, and look were thats goten us! a world were the PC is the top of the pile with Microsft Windows running on almost all of them.

-- DoctorMO --


Java code?

Post 97

Felonious Monk - h2g2s very own Bogeyman

The main reason why Microsoft is so big, as I recall it, was Windows 3.0. Up until then Windows was a bit of a joke. It didn't really take off until then, and Pearly Gates was as surprised as anyone by the impact it had. Microsoft then learned that they needed to produce something that people actually wanted to buy, so they applied this astute observation to their other products.

Regarding your argument about 'big bisness (sic) guys' buying into 'the hype', the alternatives then really weren't a lot better. And why SHOULD they have gone out and replace their machines with Macs (or God forbid, Amigas)? Computers cost money. So we have PC's dominating the desktop. Big deal. We have thousands of the things where I work and I have never heard my customers complain about the fact that they are running Windows as opposed to Unix or System 7. The only people who seem to get worked up about this issue are those who never actually have to program the things in anger.

On another point, Britain has one of the highest percentages of homes with computers in the world, if not THE highest. Don't try and tll me that this would have happened if we still had Archimedes, BBC Micros, Ataris, Amigas and God knows what else vying for meagre scraps of market share.


Java code?

Post 98

Peet (the Pedantic Punctuation Policeman, Muse of Lateral Programming Ideas, Eggcups-Spurtle-and-Spoonswinner, BBC Cheese Namer & Zaphodista)

Didn't we have the highest percentage of homes with computers in the days of the Spectrum and BBC 'B'? I think the Japanese have the edge on us now... smiley - geek


Java code?

Post 99

DoctorMO (Keeper of the Computer, Guru, Community Artist)

hehehehe, all I'm saying is the because the PC IBM Arch' has had money poured into it, it has improved alot to cope with the OS and other software demands, the IBM PC Arch' is a crock and just becuase people have got used to it won't make it any better.

-- DoctorMO --


Java code?

Post 100

Peet (the Pedantic Punctuation Policeman, Muse of Lateral Programming Ideas, Eggcups-Spurtle-and-Spoonswinner, BBC Cheese Namer & Zaphodista)

What's a PC Arch'...?


Key: Complain about this post

Java code?

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more