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

First Language?

  1. Jul 23, 2003 #1
    What would you suggest for a first computer language? Many people told me Python but equally as many said it probably wouldn't do what I wanted to. So, I was told I should try PERL or C++...what would you suggest?
  2. jcsd
  3. Jul 23, 2003 #2
    The people who told you it wouldn't do what you wanted are idiots.

    It can do practically anything.

    I suggest Python. Try it, you won't regret it.

    C and C++ are too hard to start out with for a first language. You will be more confused and it will take you longer to make worthwhile applications that are useful to you.

    The "Hello World" program is usually used to demonstrate the language and its ease of use:

    In C++:

    #include <io stream.h>

    void main()
    cout << "Hello, World." << endl;

    In Python:

    print "Hello, World"

    It is a small example, but the advantages of Python stand out.

    I am quite sure my C++ is right, but please double check. :smile:
    Last edited: Jul 23, 2003
  4. Jul 23, 2003 #3
    Python would be a nice starter language. Unfortunately it's not used alot in industry.

    For true starter languages check out trueBASIC or Pascal.

    Heck even the web languages like actionscript and javascript are great to start learning rpogramming concepts.
  5. Jul 23, 2003 #4
    Python is not used in the industry because it is steadily growing. It should be used in the industry, and is a big part of NASA and Google.

    It is powerful enough to be in the industry and I can't see it at a disadvantage against languages usually used in the industry like VB.

    It should fair just fine.

    The point of using basic is now BASICally dead . Even VB.net has minimal BASIC programming in it. Do not learn it if you want to do something with your language. Do something useful that is.

    Pascal is a good learning language, but I doubt it can be as robust as Python.

    Javascript won't take lots of learning. One should be able to learn it through webdesign. It is useful but he says that Python can't handle some of his needs, so his needs are probably much more advance than both Javascript or Actionscript can provide.

    Haskell is a language to consider.
  6. Jul 23, 2003 #5
    What is it that you want to do. That has everything to do with what language you pick up.
  7. Jul 23, 2003 #6
    I fail to see what Python offers would lack what a beginning programmer would want it to do.
  8. Jul 24, 2003 #7
    Yes, that is antoher thing I heard. Well, I dont want anything too easy because if all Python is that simple, I wont be learning much. I want something that will help me make a lot of stuff online games, websites, you know stuff like that, there is a lot I want to do with it but first I would like to see what suggestions I hear. I have seen what PERL can do, and one of my family members is a Computer Programmer, she said that PERL isnt used as much as it used to be, but that there is supposed to be a new edition coming out within the next few years so there is no telling if it will come back. Basically all I know right now is html.
  9. Jul 24, 2003 #8
    Oh so many compile errors and warnings in so little code. Should be:
    Code (Text):
    #include <[b]iostream[/b]>
    [b]int[/b] main()
        std::cout << "Hello, World.\n";
        [b]return 0;[/b]
    I code in C so i know only minimal C++. Because of that I think endl should work, but in MVC++ it throws out an error so i changed it to \n.
    Whatever language you choose, I would stay away from VB. At first you'd probably like it because you can make decent programs pretty easily, but later on you will regret it. VB is not portable at all and teaches bad habits, among other things.
    Perl might be a good language to start out with. It is basically the lazy man's C. It would be a good intro to C and C++ which is probably the most used programming langauge.
    note: i'm not sure how coherent this post will be, it is 2:16 in the morning after all ;).
  10. Jul 24, 2003 #9
    If you want to do web stuff then C and C++ aren't what you want.
  11. Jul 24, 2003 #10
    works just fine if you write iostream in 1 word....:smile:

    Shadow: you could try Java. It is a bit difficult at start but you can do everything you want in it....
  12. Jul 24, 2003 #11
    Well, personally i started with VB, and i find it a good start.
    I don't know what is meant by "VB teaches bad habits".
    I find VB an easy way to start understand the logic of programming, (if, loops, conditions, subs, function ...), and some object programming, and data types, without worrying about pointers and this kind of stuff (which i think will be something hard for a beginnner).
    After being quite well in VB, i tried to learn C, and it wasn't really hard knowing that i knew all the concepts of programming from VB.
    About actionscripts, they are very strict, and you can get lot of errors in simple code, so i personally don't recommend it as a starting point (if you are not going to face trouble in actionscripting then you are not learning, since you are not doing complicated stuff).
    I don't know about Python frankly, so i can't tell if it is a good starting point or not.
  13. Jul 24, 2003 #12
    I've only done a little programming in BASIC, but i assume the basic syntax was carried over. One of the first things i notice when i look at a BASIC program is how many goto statements there are. There is one example of VB bad habits. If you put a goto statement in a C or C++ program you need to be slapped. Furthermore:
    yes, it will work that way, but the program is still violating many ANSI standards.
  14. Jul 24, 2003 #13
    Python is simple, but it teaches many of the programming basics. You want something simple, I doubt you could hack a decent program in C.

    Python can do everything you listed. I don't see what the problem is.

    If all you know is HTML, you will have enough trouble learning Python.

    go to www.hprog.org[/URL] . They have information on Python and other languages.

    Perl doesn't do as much as Python.

    [quote] code in C so i know only minimal C++. Because of that I think endl should work, but in MVC++ it throws out an error so i changed it to [/quote]

    I double checked my code. Iostream should have been one word and it compiles just fine. The code is the exact same as mine in the book (free source/online) How To Think Like A Computer Scientist.

    Your code is clunky. Mine looks better, and works.

    I win.
    Last edited by a moderator: Apr 20, 2017
  15. Jul 24, 2003 #14
    What can Perl do that Python can't? They are both easy to learn except Perl is used more in education (Python in CS classes).

    Python can create powerful games, is portable, creates great web applications.
  16. Jul 24, 2003 #15
    I never said that perl would be better to learn than python, i mearly said that it would be a good starting language.
    Your code violates ANSI standards. "void main()" is a big no no. Using void main with no return value is bad because that has a tendancy to return random values to main and you cannot check if it exited corectly. This can cause confusion, especailly if you use makefiles. There are also various other reasons.
    You also didn't declare what namespace to use and in C++ you don't put .h at the end of a header. Readability is more important than clever tricks just so you don't have to type as much, especialy in something as trivial as a hello world program. If you are writing a kernel a few clever tricks would be excusable as long as it increases the efficiency. You especially don't want to show a person new to programming bad syntax.
  17. Jul 24, 2003 #16
    The syntax comes from "How to think like a Computer Scientist"

    Find it online. It was written by a programmer, High school teacher and CS teacher in University.

    It isn't bad syntax
  18. Jul 24, 2003 #17
    The final word on syntax comes from ANSI. They make the standards for C and C++. They say that you always need to declare "int main()" and never "void main()". Using "void main()" characterizes your program as ill-formed. You can see for yourself in section 3.6.1 of the standards. If you want a more technical explanation of why they made that standard see here: http://users.aber.ac.uk/auj/voidmain.shtml [Broken]
    I suggest you give the author of "How to think like a Computer Scientist" an email.
    Last edited by a moderator: May 1, 2017
  19. Jul 24, 2003 #18
    First, the program did what I and the writers of the book expected it to do. Demonstrate a "hello world" program.

    It worked.

    Besides that yours is longer and looks more clunky, I don't see a significant difference.
  20. Jul 24, 2003 #19
    Just because the program works does not mean it is good programming. It working is the minimal requirement. Since the hello world program is the first program a novice program writes it makes it even more essential that correct syntax is used. You don't want to be developing bad habits right off the bat.

    It doesn't matter if you think it looks clunky, the fact of the matter is it will run smoother if you use the right syntax.
  21. Jul 24, 2003 #20

    I doubt he'll go C++ though. Even if he does, they probably won't finish.

    Besides, Python includes some things from C++. Or was it C?

    Anyways, Python has some of a lot of languages.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook