Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

ActiveX and API calls

leoprex
Beginner
426 Views
I have got no help on my problem about COM module generated from ComDlg32.ocx. My objective was to utilize the stabdard Windows dialog for opening and saving files.
Nevertheless I have discovered through the very interesting site of Jugoslav Dujic that the same result can be obtained through a single API call. On that site a complete calling sequence is available: thank you Jugoslav. I am an experienced developer in Visual Basic. I am also an old programmer in FORTRAN on mainfraimes (at the time of perforated cards). Sometimes I use presently Visual Fortran, essentially in the case of reuse and renewal of ancient codes. At contrary Jugoslav seems to use Fortran as a first choice for new programs. This does not seem to me profitable with respect to VB. Which are the advantages of such a complicated and delicate programming language?

Message Edited by intel.software.network.support on 12-09-2005 01:58 PM

0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
426 Views
Well, it's hard to separate objective from subjective reasons; I can tell you my motives, but I guess there's no general answer and any answer you can get is inavoidably biased.

Well, Fortran is primarily intended for number-crunching but new features from Fortran-90 make it rather attractive as a general-purpose language as well. Unfortunately, there is lack of good GUI libraries for it (there are good ones like GINO or Winteracter, but IMO they're expensive). On the other hand, a good knowledge of Windows API gives you deeper understanding on how the system works and feeling of exactly knowing what you're doing in every moment. However, the API is complicated and sometimes it is frustrating that one has to write quite a few lines of code for what seems to be a simple task.

To be honest, I hate VB -- for no particular reason... or for some trivial reasons... I remember my frustration (writing a Visio macro) when it took me few hours of digging through the documentation to finally discover that my line
Dim x1,y1,x2,y2 As Long
does not mean what I thought at first sight (and what I deem obvious). And I think that documentation is awful, especially compared with Win32 API. Possibly it's a matter of habit, but habits are hard to change.

On the other hand, of RAD tools I like Delphi but I've never found enough time to get used to it, and moving to a development environment with totally different philosophy can have quite a steep learning curve. I dislike MFC as well -- I think it's badly designed from the start and patched on the way. I'm reasonably proficient in C++ but it's just not 100% "in my fingers".

So, I stick to Fortran and API -- two things I'm used to and very efficient when I come to programming. I'd probably be more efficient in some tasks if I used more appropriate tools, but, hey, we're just humans and frequently affraid to step into new unknown territories.

Looking back at my post, I see I was more personal than I intended to... never mind, just my 2 cents.

Jugoslav
0 Kudos
james1
Beginner
426 Views
This is sort of a religious question to some degree, like why doesn't everyone just use C/C++ instead of these other languages? A good programmer isn't confined to a single language, some are better/more convenient than others for certain tasks, some lend themselves to better readability, etc.

When it comes to number crunching, doing non-trivial mathemetics, or anything where using arrays is algorithmically important, Fortran has a lot to offer. Of course there is a large body of existing code in Fortran that works and works well, deserves enhancement and a "new face" and no question that doing your extensions in Fortran keeps things in a single language which has its own advantages.

If you want to write code that is portable across platforms, while performing some significant function, the number of languages drops quickly. In this case VB is pretty much out, and really you are left with C/C++, Fortran and to some extent things like Perl.

I will make a general statement, that in my observations of more junior programmers and languages, that there tend to be fewer "big" errors when using Fortran than C/C++. This is because when using Fortran they tend to use arrays rather than linked lists, the former being less prone to error and memory leaks. Another big one is null terminated strings. See the vast number of Microsoft security alerts over the past couple of years, I bet the majority of them are due to the C string and seeking that sometimes elusive trailing null character.

The downside to using Fortran as a "system" language under Windows is less a technical limitation than it is a documentation and "pretty" issue. You can overcome this by understanding how things are done at a slightly lower level (particularly calling mechanisms) and by understanding C/C++ well enough to be a good translator.

So would I write new code in Fortran rather than C? Sure. Are there sometimes reasons that isn't a good idea? Yes. But avoiding Fortran for new development is done more because of people's own limitations than due to any other reason. JMO of course. :-)

James
0 Kudos
Reply