Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran / Visual Basic ?

  1. Jun 10, 2013 #1
    Fortran / Visual Basic ??

    I wrote more then few dosens programs in all flavors of Basics, mostly in DOS. Unfortunatelly with the new Windows systems, 32, 64 bit they are no longer usable. I would like to rewrite some of them. It is mostly structural engineering, cams, linkages. The codes are not that huge, from 120 up to 500 lines. Should I go for Fortran, I have to relearn it, or go with Visual Basic. I would like to compile it as the stand alone and be able to run it on Windows 7 and 8, both 32 and 64 bit systems.
    Thanks for the advise.
     
  2. jcsd
  3. Jun 10, 2013 #2

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

  4. Jun 10, 2013 #3
    Yeah, I like Fortran too...

    ...but, for the same reasons that an old fortran program can simply be re-compiled with a current compiler to get it working again...what's wrong with just getting a current BASIC runtime?

    You don't even need a DOS emulator, just get BASIC for today's computers and you may be up and running with minimal changes...wouldn't you? Here is one.

    my 2 cents.
     
  5. Jun 10, 2013 #4

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    If you've decided to go through the trouble of re-implementing your programs in a modern language, don't go halfway! Visual Basic is a dying language, along with the rest of Microsoft's grubby attempts. FORTRAN has already been dead for decades.

    Python, along with libraries like numpy, scipy, and matplotlib, will provide an environment where you can probably write your programs in 10 lines instead of 500. Your programs will be simple, easy-to-read, and cross-platform, and will run virtually anywhere (any version of Windows 7/8, any version of Mac OSX, any Linux machine).

    If you want to play with some Python, check out sagemath.org. Sagemath pulls together a huge number of mathematical and scientific libraries into a single interface, and you can run it entirely in a web browser. You may find that your programs can be implemented very simply as notebooks in Sagemath.

    Your desire to compile the program into a single executable is understandable, but real-world situations rarely demand it. Design your code so that it is easy to read and easy to maintain, and you'll avoid having to go through this same battle again in a few years.

    - Warren
     
  6. Jun 10, 2013 #5

    jim mcnamara

    User Avatar

    Staff: Mentor

    http://sourceforge.net/projects/fbc/ -it is called FreeBASIC

    was a replacement for qbasic. Although chroot's idea has a lot of merit, if you are not a programmer you probably would rather just use your code rather than learn python and redevelop "dozens" of programs.

    It is now a compiler, so the compiled code runs pretty fast compared to qbasic which was originally interpreted.
     
  7. Jun 10, 2013 #6

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    Don't believe everything the Python fanboys say. Fortran has been evolving for over 50 years and has quite a large code base developed. I prefer F77, but there are F90/95 compilers out there as well.

    I frankly am puzzled about the animus against Fortran. First, BASIC and Algol were developed to replace Fortran, but they fell by the wayside. Forth was kind of a flash in the pan, here today and gone tomorrow (30 years ago at least). Then, ADA was the next big thing, along with Pascal. C and all of its variants are making a valiant attempt, but Fortran is not dead yet. With the advent of the internet, Java, Python, and a whole host of other languages are playing king of the hill. Which will survive, and for how long?

    When today's Python fans move into assisted living, there will still be some kind of Fortran knocking around.
     
  8. Jun 10, 2013 #7

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Compared to modern languages, it's difficult to read, write, and maintain.

    Python uses NumPy, which is based on LAPACK, which is written in Fortran 90... so please bear in mind that I'm not suggesting that all Fortran code should be abandoned. I just think that, for casual users, languages like Python are easier to learn and provide greater productivity.

    - Warren
     
  9. Jun 10, 2013 #8
    Yeah, I was surprised by chroot's attack, too.

    Around forums for sometime, I have learned not put down anything when uncalled for...just present what you like and stay away from putting down something else...chances are you do not know everything about it, because you don't like it, because you don't use it.

    And, yes, Fortran is very much alive. No, it is not a systems programming language and it was not invented to write operating systems or control hardware; it was invented for number crunching and handle giant arrays, etc...and it's been doing that, very well, for over 5 decades.
     
  10. Jun 10, 2013 #9
    I am all for Python, too...with everything in it and the kitchen sink
     
  11. Jun 10, 2013 #10
    and f2py :-)
     
  12. Jun 10, 2013 #11

    rcgldr

    User Avatar
    Homework Helper

    Although this may not apply to the type of basic programs you currently have, some of my co-workers use visual basic since it's very easy to create chart and graph type user inteface stuff (the programmer drags / drops / edits graphical stuff on the development screen, and visual basic generates code).
     
  13. Jun 12, 2013 #12
    For this situation, I would highly recommend FreeBasic.
     
  14. Jun 12, 2013 #13
    VB .Net is of course well suited for component-centric design and implementation.

    So if the apps are meant to cooperate with one another AND possibly with other yet-to-be-written MS-platform specific apps (.Net Server e.g.) migrating to VB .Net should be seriously considered.

    In any other cases I would recommend Fortran 95, because that's yet still sort-of lingua franca for numerics and works fine with MPI.
     
  15. Jun 12, 2013 #14
    I like Python a lot and have used it regularly for over a decade, BUT I don't understand why Python and pythonic wrappers are apparently considered the solves-it-all tools¹ by some.

    ---

    Look at scipy's scipy.optimize.curve_fit for instance:

    That's for sure a most handy interface, seemingly much more enjoyable that minpack's lmdif, lmder, lmstr et al.

    But now look at p. 13 of the minpack User Guide ch 1-3.

    If I know the Jacobian, and in many cases I will "know" it, because it's often trivial to calculate it, I have a more analytically oriented interface.

    ---

    From experience I can also tell that Fortran modules I write often have a degree of re-usability and code stability that is unprecedented by any Python stuff I ever wrote. Of course one may argue that this totally depends on the programmer, but in this case the Fortran coder and the Python coder of the stuff I'm talking about is the same person (which happens to be me).


    ¹Look at p. 6 of the supplemental slides of http://channel9.msdn.com/Events/Goi...te-Bjarne-Stroustrup-Cpp11-Style?format=flash for a rigorous definition of "tool" :smile:
     
    Last edited: Jun 12, 2013
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Fortran / Visual Basic ?
  1. Compaq Visual Fortran (Replies: 1)

Loading...