°Junoland.de HOME     www.Junoland.de     Valid HTML 4.01 Transitional     (c) Copyright 2003 °Andreas Klotz, Cologne, Germany [upd.Oct.2008]     AKL@Junoland.de

Which Language Should I Learn?

intro Mainstream Groups WebBrowser WebServer DB Academic Cobol
Delphi|VB C++ Java C# SpeedTest! Conclusion OOP Links

Now with enhanced speedtest for Java, C# and C++ - number-crunchning and GUI!


Don't think I think I got it made!

In every programmers's life there's one question that doesn't let him live in peace no more: What is the best programming language?

To say it clear, you won't get an final answer from me, but I try my best to help you if you are a beginner - my knowledge is not good enough to discuss with the experts. But perhaps this is the reason why you may understand me. I won't tease you too much with technical terms, buddy!

And please, don't you mock my German Pidgin English - I never have been in UK or USA (New Zealand, Ireland, Australia, Canada...) to learn it right. I'm using it anyway because there are about 30 millions german-speaking people today in the internet, but 150 millions that speak english natively and 200 millions others that use it nearly every day - greetings to India...

Criteria:
How is a good language ?

In my eyes a programming language is not a invention to speed up the CPU - then you have to do it in Machine Code - nothing can be faster. It is more a system to arrange data and the way to access and use them in a specific way. You can imagine more than one way:

For those purposes I'm ready to give some CPU-speed and a little bit of convenience.

↑ top

Stay on the Scene:
Why you should go Mainstream

A programming language is a system of conventions to do the same things in the same way using the same    background-repeat: repeat-x names for it. You need some degree of order to understand your own code and then you must make an arrangement with yourself to a system of notation. So, you can use the ideas of other people and that's why you better write your code in a style that other programmers can underatnd you. The more people write in one language the more examples, discussions and ideas you will receive while browsing the internet or talking with your programming friends. I don't have to belong to the avantgarde!

A good programming language is a big toolbox. You can do anything with it. It will be a phantastic walk on the wild side. If A is better than B, nothing of that kind matters. The thing is that you can go on building your program! It is possible with about 10 languages, take that one that you like and then start coding! Don't you waste your time by discussing too much about the right tool - just use it and then look for some days if some other tool is better and then go on writing....

I often read when the programmers first debate is running, that there is no sense in discussing because for every purpose ther is a special language - nonsense! You never have the time to remember all the terms and functions of so many languages! If I see the currriculum vitae of applicants for an IT-job I have to lol! If that superman really knows all about the 20 languages, OSes and other systems - how can he really know them well! On the other side, isn't it ridiculous, what skills a company that is looking for IT-people is demanding: Have they a data-organization in there company which provides really 10 languages? If they have a new job to be done do they buy a new sytem on a new server with a new language - instead of putting it together with the existing systems?

Okay, if I could not prevent you to go the avantgarde-way, we could be friends anyway, I hope. I'm an old Atari-junkie, so I know all about the best way and the othre stupid persons that don't see it, but after a while we Atari-people were nothing but a strange sect.

Why is the Personel Computer so successfull? It is perhaps not the best system but it was open for the competition of all the others that made peripheric devices and wrote programs for it. Apple has been better for a long while, but they never can't win because there are a closed shop. They always must be more expensive for a worse performance! They only live because they are for some people a modern myth of technical dominance, but that dream will be soon over, I guess.

Linux and the open source movement - without them we had a monopolist MS that's ruling the world. So I wish good luck for these guys. But I don't know not any person who is using Linux alone without Windows- except the Apache-web-server! Why? Because it is still too difficult to setup the system. Now it is getting easier but one thing remains: Games are running Windows (or Nintendo, Sega, Sony-consoles) but not Linux! Devices like scanners, video-cutters are running often only Windows. For me Windows is not a religion. I am often annoyed of it, but I use it. I want to have a tool to make my dreams come true (writing a composing-program with random-patterns that generates music that really sounds like music). If it is Linux or Windows or any other Operating System - it doesn't matter! It doesn't matter if the cat is gray or the cat is black - the main thing is it's catching mices (chinese proverb).

↑ top

Groups of Languages
What is the programming world using?

I don't know exactly. I only focus on PC -languages, because you wouldn't read this essay if you have to learn some special mainframe-server-language or something for scientific matters.
There are languages (or script-languages) for:
Let's have a closer look at them:

Controlling a machine, writing a driver, writing an OS:
Machine Code, Assembler, C

Machine Code - a list of processor-commands with their parameters; command (e.g. fill register x, add register y to it, put it to some place in the RAM, if there is value=100 then jump back to the 3rd command) followed by direct values or by RAM-adresses where you have values or to another number of your command-list.

Assembler - a program that makes it easier to talk to the processor; e.g. you mustn't say : jump to the command-number 345 of my list, you can use a name that denotes that place.

C - is a complete language for all purposes that is in its speed as nearest to the machine as a language could be; without object-oriented overhead like in C++; most of the operating systems and most of the device-drivers are written in C for the biggest parts (for some few parts that take the most CPU-time they use often a little bit machine-code). C has few commands with mighty power. It is also dangerous: you allocate and disallocate the place in the RAM manually with pointers - so you can make a bad access and the whole system breaks down. As old Pascal-Zealot, I know what's pointer is about, I have seen many frozen screens in my developer-life. The newer languages mostly control RAM-access and provide garbage-collecting for the release of unused parts of the memory.

Internet-Browser:
HTML (XML) and Javascript , Java-Applets, VBscript, ActiveX

HTML - is not a real language with loops and if-jumps - it is a format to say to the browser that it should make the characters on the screen bigger or smaller or in another color; you can place a picture into your text-sheet; the most important feature is that you can set a link to another place of your text-sheet or to another html-page of yours or to some other address of the web.

If I talk of internet-browser I mean not only browsing really through the world wide web. I also mean that you can use it standalone on your local diskdrive or from your company's server (intranet). Browser are increasingly substituting propietary formats of data. You don't write an application as exe-file with your own-data-format, but you make an add-in for the internet-browser.

XML is one means for that purpose. I don't know exactly, but I think you can load XML-data with your browser and show them in one manner in a HTML-table and additional the user can use the same data without reloading for another sorted order of displaying it... I hope that this was right! Plus, you can export the data from one program to XML-format and load it into another program. So XML will be Lingua Franca between programs that in former times had generated their own proprietary format.

Javascript - is embedded in the HTML-code as addition; it is also not a real language like C++ or Java. Though you can use a loop and make if-decisons, you can't control the programflow totally. You can not say, first show me some HTML-lines, then - if the user is not already logged in - ask him something, then show the same old lines once more, but don't show the last one, if he is not 18 years old, and so on...

You can generate HTML-lines by Javascript comands, but you can't edit them exactly when and where you want (really? you can generate with Javascript's write-command HTML-code, so you could make it completely without direct use of HTML, but would it be a benefit?) The most important thing: You can't read any files nor write any files ! That is good, because the user that accepts Javascript in a HTML-page can be sure that you don't mess him anything on his/her computer. You also can be sure that he can't spy you, reading your emails, looking for your name and password. But it is bad, too, because if you can't use files, what can you do at all? writing a painting-program in Javascript without saving the pictures? That doesn't make it!

Many people confuse JavaScript with Java. With Java you can do nearly all ! With JavaScript you can bring a little bit more action to the browser. Let jump a colorfull ball from one angle of your screen to the other, haha! But one thing in Javascript is useful and important: You can validate forms that are filled by the user, you can control the content before sending it to the server (no traffic at all is best traffic), you can give him list-selector-boxes, you can respond to the click of a button, let popup a window when he moves with the mouse over some parts of your screen and so on.

Javascript runs with the browser. It is forwarded from the server to the browser inside a HTML-page. It extends the features of pure HTML with some reactions to user-actions. It (or is it HTML doing this) can send it back to the server, but then its performance is over.

Java-Applets - is one way to use Java. You can build little program-parts that are embedded in the HTML-script. You can do it without threatening the user because you are working in a sandbox whith no uncontrolled access to the RAM and with not any access to files.

So, you can demonstrate your application in your website and if the user wants to really use it he can download a Java-Application that is for use with full file-rights to save and load the data which he generates with it.

Many banks and assurance companies use java-applets for a high safety transfer of data. But also many people play with that applets wasting user's time with boring animations when entering the website. If I go to a homepage with a Java-applet I have to wait for a few seconds until it has been loaded completely. But if I go to another site and then want to use the old applet again, I have always to wait! All the promises of smart caching doesn't work! If you loose more than 15 seconds while the user is staring on a lightgray window waiting for the action, you're annoying him/her and you will loose her forever! I guess, that is the reason why this applet-hype is fading.

VBscript -from Microsoft is something like Javascript (VBscript for server is called "JScript"). There are only a few people that use it, I heard that it is not for all browsers. Something for the pure MS-geeks but whith no further importance in the internet-discussions. But VBscript stands close to ActiveX - i.e. Microsoft's answer to Java-Applets. Working with ActiveX allows total control of the files on the user's PC! ActiveX and the use of Outlook as EMail-program and automatic executing of email-attachments are the main reasons for virus, worms, unrequested dialers and all the things of that kind you never want !

↑ top

Internet-Server:
PHP, ASP, ASP.Net, Perl, CGI ,JSP

Javascript (neither HTML) can't read something of a file from the user's PC nor from the server, it can't make a query on the servers's database to show some special calculated answers. For that purpose you must use a webserver language. I only can tell you more exactly what's about PHP - about the other ones I can report what I heard from other programmers.

PHP is also embedded in a HTML-page. But the file-extension is written ".PHP" instead of ".HTML", that's all. If the user has filled a form in its browser-page and send it back to the server per Javascript-button-click, you can say what page (e.g. "answerxy.php") should respond to it. The concerned PHP-page takes over the textes of the filled-form and can calculate an answer by generating some HTML-lines. PHP works with MySQL-Database, a for private use free database from Sweden. It can search something out of the database or save something in it (e.g. the user's name and adress and order of an article).

So the cycle is closed now! We can program interactions between webclient and webserver. But! It is a little bit a hack. Some stupid things that shouldn't be allowed pass through. It isn't that consequent. This way PHP is not so clear a I would like it, it is a little bit like a joker, free and fresh and carefreeand so quick tht you can't remember why that peice of code is working well.

Nevertheless, this my homepage is written with PHP and MySQL, and you will not need more than 4 weeks to do your first server-job.

ASP in its old version is something like PHP, but it is not so popular, perhaps because it is made by Microsoft, perhaps it is really bad - I don't know, but that question is obsolete, because MS has created ASP.Net.

ASP.Net is much faster than ASP. It is no real language of its own, but some add-in to C# to do webservices. Like Java, C# is a language for many purposese: browser-controls, web-controls and stand-alone-PC-apps. But, the first glance that I took on it didn't impress me that much, because there are too many steps to do to let the server run for your website! Maybe I didn't understand it good enough - so, in about 3 monthes I will begin checking it and then I wil tell you about it if you like.

Perl is a complete language in C-manner that is often used as server-language like PHP. I guess you can also draw graphics, where a click in some special part is evaluated as selection and the server gives you answer to that. Perl is interpreted like Basic and not compiled like C - so it is not so quick. With Perl you can not write a device-driver or a OS but anything else.

Working as server-language, it uses CGI-scripts. CGI is a format to take over user-input. With CGI-scripts you can bring the server to his knees. Many providers of webspace that allow CGI, make restrictions in use to prevent server's drop-out. Perl zealots say that you can develop rapidly with Perl but you can write spaghetti-code as you like. Nothing in the language forces you to a clear style. So what? That wouldn't embarass me too much. I have some practical reason to take PHP instead: I can find more reliable provider of webspace for my homepage offering PHP with MySQL than Perl/CGI, that's all.

It's the same with ASP: where can I build a web-application using ASP as a private person that is not so expensive like a professional web-server?

JSP (Java Server Pages) is simply Java and that is quite good! So Java is in the browser as applet and on the webserver and on many other servers and as stand-alone-program for PC-applications. One language for very much purposes! But my impression is, that the JSP-websites are running slowly... Perhaps it is, because very big traffic-sites are managed with JSP. Many forum-sites are using PHP in a very quick way - but perhaps they got only few traffic. Is PHP also good for biggest traffic ? - I often heard that not. But it seems to be not so easy to control your webserver in JSP.

↑ top

Database-Language:
SQL

SQL is one of the best means I've ever seen in the computering world!
Unless its name (Structured Query Language or so) it is more than a pure database-query-language (you can also create ne tables, insrt records etc.), it is the quasi-standard for database-programming, invented in the early seventies (of the 20th century) by IBM.
With SQL you need only a few commands to build incredible mighty queries. From simple basic questions to extremely sophisticated constructions. It is sometimes like a chess-game! Pure logic without stupid learning of thousand functions is demanded if you want to do a good database job. Write some lines and you can replace many lines that you had to write in other languages to get the same effect.

But SQL is not SQL - there are many derivatives, each Database-vendor uses its own dialect for special things like triggers (e.g. if a new record is inserted or if it is 9 o'clock a.m., make a query of sums and averages of the whole table and transfer the result to another table). But the principles remain the same. If you know SQL on one system (e.g. Oracle, DB2, Informix, MySQL, MS-SQL-Server) you can start working immediately with an other Database for the first basic steps.

If you want to find the best database-query-language, the anser is simple: SQL - for there is not any other known language. If you want to find the beste Database-System the answer is not so easy. For the private use take MySQL - and not Microsoft Access. MySQL is free for the private use and if you make a test on this my hompage you will be amazed by its speed! MySQL is between the light-database-program Access and the big expansive Databases like Oracle, Ms-SQL-Server or DB2.

↑ top

for merely Academic reasons:
Eiffel, Lisp, Prolog, Python, Ruby, Oberon...

I will tell you something, my friend: Don't waste your time with them! Go Mainstream!

If you go to Rome do what the Romans do. All the progress that we have in the computering world was made because people has invented new languages and others used it to produce good programs and they talked to eachother showing their examples, demonstrating their sourcecode and discussing the better way. If you have a very new idea in how getting the things programmed you will be heard of some smart people and they will check it and tell it to their pals and trying to play with that new thing. Don't think that there are no reasons why these academic languages have no success in the real world. You have a plenty of languages you could test but you never will have the time to get ready with all of them.

↑ top

for good old fellows of bank and assurance:
Cobol

I don't know anything about it and I don't want to. I know, that many companies worried if the finance-programs on their mainframes would work right when the Year 2000 is there. Many old fellows were called back to their company to change the sourcecode of the old cobol-progs. - But: Have these people done a good job some years ago when they uses only 2 numbers to display the year instead of 4 (also 4 is running til the year 9999) ? I've seeen mainframe-programs that has been written 1993 and still the coders used 2 numbers! But I don't want to be no longer argue.

↑ top

For general-purpose

general:
Delphi versus Visual Basic

The most important reason for the usage of Delphi: It is much faster than VB! Because Delphi is compiled and VB is interpreted. A second argument: it is full object oriented - VB isn't. A reason for VB: It now can act on the new DotNet-framework from MS as one of many languages; another reason: MS-Office-macros-language is a subset of VB, called VBA (Visual Basic for Application).

Delphi started beeing first TurboPascal, the first good IDE for programming the PC in times of 286-CPU. In the early days there already has been some way to code for more than windows-OS, like nowadays Java and C#. It has been created in big parts by Anders Hejlsberg, now chief-software-tool-designer at Microsoft for the .Net-framework (C#). As it is known as the computer-language for schools, many people don't know how mighty this language can be! As I got it for the first time in the early eighties, it put a spell on me. It was also the first popular language with object-orientation, a big package of books with good examples were added to the setup-disks. Many of the DOS-progs of this time took the elements of Turbo Vision, DOS-controls like listboxes that you could mouseclick.

It was much better than the newer Visual Basic form Microsoft. But MS started poor and improved their product step by step. TurboPascal turned to be a Windows-developper and then adopt the new name "Delphi". They build a complete Windows-Library that also is used by Borland's C-Builder - without loss of speed. Anyway, MS ruled with its VB the popular market for program-developing languages. I guess, there are 4 times more VB-programmer than Delphi-coder (about 25 and 6 percent).

Like C and C++, Delphi handles with pointers. Using the big common library of Borland's VCL (that is written in Delphi and not in C++!) the differences between C++ and Delphi are not so big.

Delphi is built with Delphi, VB is built with C++. That means, with VB you can't create a fast-running IDE, with Delphi you can!

Delphi produces small and compact executables, if you wish you must not install dll's. You can build true stand-alone applications, not sharing it to other progs that would change common parts with the next update. With Delphi you can build components, with VB you must use VC++ for it. With VB you can't play in a full object-oriented manner, you only can use existing classes that MS has written- with Delphi you can act OO ad lib. With VB you must go through ODBC to database-servers, with Delphi you can use native drivers for some databases - that makes it faster and easier. Often it is Borland's Delphi and not MS's VB that is accessing Window's apps right.

Both of them got a excellent IDE, with command-word-completion, sith Helfiles, examples, very best search-functions and all a coder could wish, telepathie excepted. Surprising for me is the fact that many companies in the USA use the popular VB instead of C++ or Java. Not surprising is that MS with an inferior product started and then takes over the better one. They have a very good management.

↑ top

general:
C++

C++ is a superset of C with object-oriented-programming-functions (OO). You're not forced to use it. So, when many programmer say the code in C++ they often use C in the same procedural manner as they did in the good old days before OO has risen. All that you can do with C you can do also with C++. So most people take C++, whether they need the OO-functions really or not.
I tried 3 C++- IDE's :
The GNU C++ is free; everyone says it works well, but I could not say that it is too easy; perhaps I made some mistakes in installing it.
Borland's C++ 5.02 - (1 install-file about 86 MB). I think it is free, but I'm not sure, it is not the same with Borland's C++ Builder, which is expensive (Borland C++ 6.0 Enterprise Edition 1 install-file with 170 MB).
Microsoft Visual Studio 6 SE (1 install-file with 70 MB).
(the bigger one is called: Visual Studio Enterprise 6.0 - 1 file about 170 MB; It is the last one before DotNet came.)

I made the test: I renamed some exe-files to .txt and then I read with an editor what words are there that could tell me how the prog has been coded. And I saw that most of the c++-progs were written with Visual Studio from MS (the word "visual lib" detected). If you check user-forums in the internet most of the questions refer to Visual Studio and not to GNU or Borland's Builder, I guess 4 times more. That's bad for Borland. I'm really deep concerned and I hope that they stay the great competitor that can challenge MS for a long time!

Why did I try C++ not longer ?
I can't say why; I heard that the most important thing is the library. If you take MS Visual-Studio for C++, you have the MFC-library. Some things in that library are not so logical constructed, because there has been changes of paradigm in the windows-app. The component-technology doesn't work so good, I heard. MS-people make tabula rasa and establish the new DotNet-framework with a well-designed library that has also access to some old parts. So I first wanted to see, if C# is working well with that new library. The most amazing thing for me was the fact that C# is not slower than C++ ! And now I'm testing C# and have much fun with that new language. But perhaps once I will go back to C++, who knows....

↑ top

general:
Java



Java is somewhere in the middle between compiled and interpreted language; source code is compiled into an intermediate format which is then interpreted on the Java Virtual Machine. For each OS you need an own JVM. So it is possible to write once your sourcecode and compile it on your PC and then let it run on all computers that have a JVM - that is the theory! Often you must install a JVM with the newest version of Java and some other libraries. Don't let fool you by Java-apologists: It is indeed running slower if you use it as pure Java. There is a way to program Java with native commands for the target-OS - but then you give up the big advantage of Java that is : Write Once Run Anywhere !

Java-Applets run in a sandbox - a big, big boon for security. The user hasn't to worry if the program will kill him files or something else.

People say that Java forces you to program object-oriented. When I look at my own first exercises in JAva Ican't admit to it. I can also code in the same old procedural manner as before in C ! But with Java you have all the means to do it right in OO-manner.

what you need to try it: Download the newest Java-SDK (30 MB, perhaps also the newest JVM for your OS) from www.Sun.com. You can take any editor to write the sourcefile. Then you let him compile to the intermediate code. Then you let it run with the JVM. To help you to make these steps from one Integrated Development Environment (IDE) you can try first some Java-Editors, e.g.: -> REALJN .

You also can take the Forte-IDE from Sun for free (about 15 MB). But I think it is very slow, for it has been programmed in Jva itself! This way, you see how slow Java is! You need much RAM to run it - about 60 MB and more.

Java developer say that they use it at their companies for great projects where the OOP is the best means of Java to keep the people and the program-modules together. It works on many different machines (scalable for PC, server..) - that are the benefits of Java! Plus, you work with your Java-programs against the nearby-monopole of MS. But, I don't think that Sun as Java-owner (it is still under licence of Sun, not of the GNU) would act different if they had the power of MS.

IBM is sitting between the both and tries to enforce the Java-group with some actions. But they are IBM and they stay IBM: I think, they want to make their own thing with Java, the same way they played with the MS/IBM-project OS2, until the project died. The Java-version for Enterprises from IBM is said to be not compatible to the J2EE - Sun One form Sun and others. But I am too far from that scene that I could tell what there is right.

↑ top

general:
C#

C# (spoken 'C-sharp' in english, in other languages spoken 'Cis') is the newest of the popular languages. Like Java it works in creating an intermediate Code (called IL) that runs on the DotNet-framework (like the JVM)

Microsoft .Net-Framework (runonly) (20 MB-setup-file)

For coding C#.net or VB.net you need:
the full Microsoft .Net SDK for developpers (130 MB-install-file)

A free IDE SharpDevelop 4 MB you can get here
the developper will answer themselves your question at the forum!

If I didn't made my speed-test i never thought that I would fiddle with C#! But all that I tried was finished 2 times quicker than my first Java-steps and so I wnt on, just looking where the trap is.. But I found no cons but many pros.

You can generate C-code in an unsafe mode without garbage-collecting and without type-checking and without control of memory-access. That way you can use the convenient and comfortable developping-machine that consists of the good IDE from MS (about 4 CD [89 US$ Amazon] Visual Studio C#.Net SE) and the good library and each time you really need best speed you can use the unsafe C-mode!

All the people of the vast VB-community will meet us. MS invested a lot of money to promote the DotNet strategy - and I guess they won't fail. The great Anders Heijlsberg from the genial TurboPascal-project plays at the MS-team. Why not trying C# ? I said I'm trying. I do it until I see that I can get further on with it - then maybe I look back to Java or C++.

What is astonishing to me: Among 4 people that buy .net-languages, 2 take VB.net and 1 takes C.net and also 1 takes C++.net! What the hell are they doing with C++ for DotNet? The main road to .net is C#. VB.net is wight working when you change your code to OO like in C#. Sun's Java-developper said that all the languages that you can use for .Net (Also Perl, Eiffel, Objective Pascal....) are completely changed that you can recognize just a few features of your old language - so why trying something different?

I never believe that MS takes the promise of multi-language-framework really serious. They are good marketing-people, but I think that's okay. Their monopolistic efficiency could be regarded as a benefit: the more people talk in one language the more examples and exercises and discussions we have and that can not be that bad. Do you remember the time when eah and every progrm needed an own printer installation? Since Windows that kind of problems are rduced to a minimum.

Surely, you need no mastermind to come to that idea that all the poeple should use the same tools, but MS had made it, when ohters were busy with other ideas. Bad is when we will be at the point of no return, when MS dominates the programming-language-market completely. But this I don't believe. There are too many good people with good ideas that are making the world go round ....


↑ top


SpeedTest

I made some speedtests with MS-Visual Studio C++, with Borland's C++ 5.02, Java 1.3 and C# 2002.

Simple Counting +7


The task: counting 1 millions an integer +7 (7,14,21..699'999'993, 700'000'000), make this 50 times, that's all.
do it in the dos-console - no graphical window, no graphical control.

in C++ it reads:
#include <iostream.h>
#include <string>

main()
{ int x; int y;
char z = 9; string s;

//cout << "input any char + enter!"; cin >> s;
cout << "start 50 times increment 100'000'000 int +7 (AMD-Duron 1000 needs 16 sec 0.6 MB) ..." << endl;
for(x=1;x<=50;x++) {
for(y=0;(y<=700000000);y=y+7) { }
cout << x << " ; ";
}
cout << endl;
cout << " y=" << y << " x=" << x << " --- input any char + enter!"; cin >> s;
}

in Java it reads:
import java.awt.*;

class speedtest1 {
public static void main(String args[])
{
System.out.println(
"start 50 times increment 100'000'000 int +7 (AMD Duron 1000 needs 22 sec, 4.2 MB)... ");
int x=0; int y=0;
for(x=1;x<=50;x++) {
for(y=0;y<=700000000;y+=7) { }
System.out.print(x + " ; ");
}
System.out.println("");
System.out.println("y=" + y + " x=" + x + "..........finished counting. ");
}
}

and in C# (C-Sharp .Net) it reads:
using System;
class Hello {
static void Main() {
Console.WriteLine("start 50 times increment 100'000'000 int +7 (AMD-Duron 1000 needs 16 sec 3.3 MB)...");

int x=0;
int y=0;
for (x=1;x<=50;x++) {
for (y=0;y<=700000000;y+=7) { }
Console.Write(x + " ; ");
}
Console.WriteLine();
Console.WriteLine(" y=" +y + " x=" +x + " --- input any number + enter!");
string any1 = Console.ReadLine();
}
}



So, what is the result?
on a PC AMD Duron 1000 MHz :

  1. Borland-C++Builder5.02 : 16 seconds; 0.6 MB
  2. MS Visual C++ 6.0 : 17 seconds 0.6 MB;
  3. Java 1.3 SDK (console) : 22 seconds 4.2 MB
  4. C# 1 (console) written in SharpDevelop-GNU : 16 seconds 3.3 MB
Much to my surprise C# was among the best!

This little test give me a kick to go deeper into C#, and there I am.



Prime Number Crunching
But meanwhile, I've made this prime-number-test that is:
calculating prime-numbers until 200'000 and putting it in an array and reading this array 10'000 times.

The results - here they are - the big three needing nearly the same runtime:

  1. Borland-C++Builder5.02 : 26 + 24 (array-read) seconds; 1.4 MB
  2. Java 1.3 SDK (console) : 26 + 27 seconds 5.2 MB
  3. C# 1 (console) written in SharpDevelop-GNU : 26 + 24 seconds 4.1 MB
  4. VB(A) (Excel-VBA Debug.Screen) : 75 + 150 seconds 40.7 MB
And: There is still a big, big difference (5x) between Basic (VBA) and C-like languages (C, C++, Java, C#) !

Here is the sourcecode for C++:
#include <iostream.h>
#include <string>

main()
{ //int x; int y; char z = 9;
string s;
//cout << "input any char + enter!"; cin >> s;
int n=200000;
int myar[200000];
cout << "Calculating prime-numbers 1 to 200'000 ... (AMD-Duron-1000 needs 26 sec, 1.4 MB) ..." << endl;
for (int a=3;a<n;a+=2) {
int i=3;
while((a % i) !=0 && i<(a/3)+1) {
if (a<25) cout << a << " / " << i << " = " << (a/i) << " Rest=" << a % i << endl;
i+=2;
}
if (a<25 || a>n-5) {
if (i < (a/3)+1) {myar[a]=i; cout << "for " << a << " I found " << i << endl;}
else cout << "for " << a << " I found nothing" << endl;
}
if (a==25) cout << " ---- now I will calculate invisible...., wait ...." << endl;
}

cout << endl;
cout << "Reading 10'000 times array of 100'000 numbers (AMD-Duron-1000 needs 24 sec..." << endl;
int t=0;
for (int y=1;y<10000;y++) {
for (int k=3;k<n;k+=2) {
t=myar[k];
if (y<4 && (k<25 || k>n-5) ) {
if (t==0) cout << k << " ; ";
}
}
if (y<4) cout << endl;
}

cout << "input any char + enter!"; cin >> s;
}



and here for Java:
public class primetest2 {
public static void main(String[] args) {
int n=200000; int[] myar = new int[n];
System.out.println("calculating prime-numbers 1 to 200'000 ... (AMD-Duron-1000 needs 26 sec, 5.2 MB) ...");
long anyvar=0;
for (int a=3;a<n;a+=2) {
int i=3;
while((a % i) !=0 && i<(a/3)+1) {
if (a<25) System.out.println(a + " / " + i + " = " + (a/i) + " Rest=" + a % i);
i+=2;
} if (a<25 || a>n-5) {
if (i < (a/3)+1) {myar[a]=i; System.out.println("for " + a +" I found "+i); }
else System.out.println("for " + a +" I found nothing");
} if (a==25) System.out.println(" ---- now I will calculate invisible...., wait ....");
} System.out.println("");
System.out.println("Reading 10'000 times array of 100'000 numbers (AMD-Duron-1000 needs 27 sec...");
int t=0;
for (int y=1;y<10000;y++) { for (int k=3;k<n;k+=2) {
t=myar[k]; if (y<4 && (k<25 || k>n-5) ) {
if (t==0) System.out.print(k + " ; ");
}
}
if (y<4) System.out.println(" ");
}
} // end main
} // end class
// to compile: javac -O primetest2.java
// to run: java primetest2


and here for C# (C-sharp .Net):
using System;

class Hello {

static void Main() {
string any1 ="";
Console.WriteLine("calculating prime-numbers 1 to 200'000 ... (AMD-Duron-1000 needs 26 sec, 4.1 MB) ...");
int n=200000;
int[] myar = new int[n];

for (int a=3;a<n;a+=2) {
int i=3;
while((a % i) !=0 && i<(a/3)+1) {
if (a<25) Console.WriteLine(a + " / " + i + " = " + (a/i) + " Rest=" + a % i );
i+=2;
}
if (a<25 || a>n-5) {
if (i < (a/3)+1) {myar[a]=i; Console.WriteLine("for " + a +" I found "+i);}
else Console.WriteLine("for " + a +" I found nothing");
}
if (a==25) Console.WriteLine(" ---- now I will calculate invisible...., wait ....");
}
Console.WriteLine("");
Console.WriteLine("Reading 10'000 times array of 100'000 numbers (AMD-Duron-1000 needs 24 sec...");
int t=0;
for (int y=1;y<10000;y++) {
for (int k=3;k<n;k+=2) {
t=myar[k];
if (y<4 && (k<25 || k>n-5) ) {
if (t==0) Console.Write(k + " ; ");
}
}
if (y<4) Console.WriteLine(" ");
}

Console.WriteLine("input any number + enter!"); any1 = Console.ReadLine();
}
}
and in VB(A) it reads:
Sub PrimeNumberCrunching()
Debug.Print: Debug.Print "---": Debug.Print Now
Debug.Print "calculating prime-numbers 1 to 200'000 ... (AMD-Duron-1000 needs 80 sec, 4.1 MB) ..."
Dim N As Long, A As Long, I As Long
Dim T As Long, Y As Long, K As Long
Dim myar(200000) As Long
N = 200000
For A = 3 To N Step 2
I = 3
While ((A Mod I) <> 0 And I < (A / 3) + 1)
If (A < 25) Then Debug.Print A & " / " & I & " = " & (A / I) & " Rest=" & (A Mod I)
I = I + 2
Wend
If A < 25 Or A > N - 5 Then
If (I < (A / 3) + 1) Then
myar(A) = I
Debug.Print "for " & A & " I found " & I
Else
Debug.Print "for " & A & " I found nothing"
End If
End If

If A = 25 Then Debug.Print " ---- now I will calculate invisible...., wait ...."
Next A

Debug.Print: Debug.Print "---": Debug.Print Now

Debug.Print "Reading 10'000 times array of 200'000 numbers (AMD-Duron-1000 needs 150 sec..."
T = 0
For Y = 1 To 10000
For K = 3 To N - 1 Step 2
T = myar(K)
If Y < 4 And (K < 25 Or K > N - 5) Then
If (T = 0) Then Debug.Print K & " ; ",
End If
Next K
If (Y < 4) Then Debug.Print " "
Next Y

Debug.Print: Debug.Print "---": Debug.Print Now
Beep
End Sub



GUI-Test
C++-test for GUI is missing, but I made it for Java with Swing and for C# . The task: let popup 256 little frames. The results: Java needs 6 seconds at 13.0 MB RAm-consumption, C# needs 5 seconds at 7.6 MB RAM - on a AMD-Duron 1000 with cheap NVidia grafic-adapter 32 MB.

The difference is not that much, but there is a difference, you see?

speedtest256formsincis.png

The Java-sourcecode:
import javax.swing.*;

public class helloswing100 {

public static void main(String[] args) {
JFrame framex[];
framex = new JFrame[500];
for (int i=0; i<32*8;i++) {
framex[i] = new JFrame("W"+i);
framex[i].setSize(100, 100);
framex[i].setLocation((i/32)*100, (i % 32)*20);
framex[i].setVisible(true);
//for (int t=0; t<10*1000*1000;t++) { }
}

//JFrame frame2 = new JFrame("window main");
//frame2.setSize(250, 350);
//frame2.setVisible(true);

JFrame frame = new JFrame("window main");
frame.setSize(300, 400);
final JLabel label = new JLabel("Hello - let's swing! ");
frame.getContentPane().add(label);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//frame.pack();
frame.setVisible(true);

}
}
// to compile: javac -O helloswing100.java
// to run: java helloswing100




and the C#-sourcecode:
using System;
using System.Windows.Forms;

namespace myxyform
{
public class cAnyForm : Form
{

}

public class cMyMainFormClass : Form
{

public cMyMainFormClass()
{ //<--- constructor
this.Text="Close this window to end!";
}

public static void Main()
{ // <--- Main embedded in main-class

// ordinary call quickform without a name for this instance .....
cAnyForm[] cf = new cAnyForm[500];
for (int i=0;i<256 ;i++ )
{
cf[i]=new cAnyForm(); cf[i].Text="F" + i;
//cf[i].Location=new System.Drawing.Point(i*8,20);
cf[i].Location = new System.Drawing.Point((i/32)*100, (i % 32)*20);
cf[i].StartPosition = FormStartPosition.Manual;
cf[i].Size = new System.Drawing.Size(100, 100);
cf[i].Show();
}

Application.Run(new cMyMainFormClass());
System.Console.WriteLine(" enter!"); Console.ReadLine();
}
} // end class
} // end namespace

↑ top





Conclusion

If you read my essay, you already have read my conclusion: I will test C# as long as it makes no sense no more.

Repeating my principles:

So come and be my companion in Learning C#    ==> C# Crash-Demo!



OOP

I still didn't write my OOP-essay, I will do it in a few days.



Links

Link Subject My Judgement
internetExplorer Browser If you catch the newest one (6 and more) you have to purge him from send-home-gimmicks
Opera Browser - to see another one; it's better than Netscape
Phase 5 Uli Meybohm's HTML-Editor it's quite good and it's free
HomeSite Macromedia's HTML-editor the best or one of the best, but not free (formerly from Allaire)
WS_FTP FTP-up/down-loader , in Win XP not necessary(?); it's not so easy to fill right username, server, password...
PHP4 Rasmus Lerdorf started PHP - Zend build something to make it faster download for free
Xitami Web Server, also for usage on PC, free for private that is good for testing your PHP-scripts without internet
MySQL DataBase free for private usage better than Access, superfast, not so complete like Oracle, DB2,SQLserver... localhost = 127.0.0.1; connect() (without User & passwort)
Lycos free Webspace with PHP and MySQL for free I gave up, because it's for long days down, but it's one of the few that are free
HostEurope commercial webspace provider This my homepage with PHP and MySQL is running there for 7,90 EUR/month, incl. 15 GB traffic, to cancel in 1 month. Reliable and fast as you can see (no, I take nothing for my recommendation)
Java SDK For compiling sourcecode to Java intermediate code about 30 MB - it's the compiler and nothing else
Forte Java-IDE from Sun themselves needs time and RAM and diskspace! Programmed in Java and not so fast
RealJN Java-Editor simple but free
http:jigsaw.w3.org just check here if your homepage is obeying WWW-Standard Of W3 don't be sad if you got many, many failures reportedk
.Net-Framework (runonly) 20 MB for running C#-progs don't take it, if you want to write your own code
.Net-SDK (developpers) 130 MB for get the compiler of C# and VB.Net (130 MB is much too much for a compiler, but it comes with big libraries)
SharpDevelop free IDE a little bit buggy, but free. they (Mike Krüger) improve it each week
www.iCSharpCode.Net Forum for C# with the SharpDevelop-IDE the developers of th IDE will answer your questions themselves in the forum!
(Amazon USA) buy it in the USA (Amazon 89 US$) - 4 CD to install, 1.5 GB HD needed Very good IDE, (still) better than SharpDevelop
MasterCSharp Forum for C# and ASP.Net very good made in India
. . .

Search in the web

Buy second hand*

pay attention - not money!

TurboPascal 5.5 (DOS) (search it in the web...<6 MB) As intro for Delphi - I heard it is free, maybe registration required
VBA of MS-Excel let some friend show you Visual Basic for Applications is very similiar to VB; very good IDE; (Press F11-key to switch to VBA-mode, enable view properties!)
Borland C++ 5.02 I think it is free with difficult registration-act (/search it in the web...86 MB) fast runtime-execution; it's not the same as C++-Builder.
Borland's C++-Builder Enterprise Edition (search it in the web...178 MB) if you need more comfort, high-priced
Microsoft Visual Studio 6 SE (search it in the web...70 MB) okay, it was good enough for me
Microsoft Visual Studio 6 Enterprise Edition (search it in the web...175 MB) with Database-commections and vast libraries, high-priced
. . .

Deutsch

German Language Corner

Deutsch

GuideToCSharp A big german Online-tutorial very simple, quite the right thing for the beginner
http://selfHTML.teamone.de german HTML-tutorial - the very best I ever seen!
JavaBuch big german Java-manual I think it is the best I know
Markt Und Technik german books, some of them online-readable Javascript in 21, SQL in 21 Tagen is good
Markt Und Technik Books german books, some of them online-readable Leseecke! Javascript in 21 Tagen and SQL in 21 Tagen is quite good
Galileo Books german books online-readable PHP-book from Mister Theis is good
PHP4all.de german PHP-forum okay
SelfPHP.info german PHP-forum - style lie SelfHTML okay, but SelfHTML is better

End
(to be continued)
↑ top