Announcement

Collapse
No announcement yet.

Programming.....where to start?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Programming.....where to start?

    Ive been encouraged by a friend to start learning basic programming of some kind. What language would be most useful for writing small Linux apps with GUIs? Im pretty familiar with bash so my first task is going to be transfering a few simple bash programs over to another language and hopefully building basic GUIs for said programs. What would best suit this?

    #2
    C++ in combination with Qt.
    "Just keep on learning. Little by little... If you're empty, then you can take in anything. If you want to be reborn, then it's in your best interest to become empty." - Vinland Saga

    Comment


      #3
      I think Python would be a good starting choice. It has a nice "simple" syntax with a whole slew of libraries. Another advantage is, since it is an interpretive language, immediate feedback as to typing and syntax errors

      Comment


        #4
        Hi whatthefunk

        The "thing" about "programming" is to learn the "logic" of programming.

        An example would be what was called a "for-next" loop in B.A.S.I.C. programming.

        "For this action......

        a thing happens
        another thing happens
        another third thing happens
        and on and so forth

        Next.....

        And it goes on to to repeat.

        Or an "if then" statement.

        "If the user does this...pushes the key that is on the middle row, second from the left, then the string "a" will be produced on the screen.

        Now this "could" be done with many of the versions of B.A.S.I.C. that were extant at the time, but the C-64 simplified the "hardware stuff" mightily by having certain actions hard wired to certain keys.

        And it gave visual and auditory feedback immediately.

        My oldest boy is now one of the top tier of programmers in the U.S.

        He, well all of the family except the wify, actually, started using a "truncated" B.A.S.I.C. on the old timex sinclair which was truncated in that it stored information linearly instead of in an array.

        We then went to the Commodore 64 which stored data in arrays.

        The point behind this is that the C-64 had "things" hard wired into the keyboard itself, such as colours, sounds etc.

        One got IMMEDIATE feeback in the form of sound, or motion, or light or a pixel moving, etc. and one could see the STRUCTURE of the lines of the program that produced it.

        Nowadays it is considered to be "simplistic" ...and "beneath consideration".....

        We are now "more sophisticated" than that...

        But.... most of the present generation of older, senior, programmers started in just such a fashion.

        People "learned" B.A.S.I.C. "at school" in a year long class or....

        they learned B.A.S.I.C. at home by copying into the C-64 memory another person's programs from a magazine, or a letter that somebody sent them from another country.

        The programs back then were very "small".

        The program for putting your name onto a screen in several different ways was contained in, I don't remember exactly, three or four lines with just one thing changed in one line to place the name on the screen in different ways.

        Now, the chances of getting a working 6-64 and an old t.v. for a monitor and a tape player or hard drive for storage is probably very small.

        But, the "type your own from a magazine" programs are still available in library archives, the magazines themselves, etc.

        So, I'd get an "emulator" of some kind for "B.A.S.I.C." and scrounge up a very old book or magazines with some of the older smaller programs that can be typed into the emulator in a short period of time so that you get immediate results.

        You can then "sit back" and contemplate the STRUCTURE of how "programming" works.

        You will learn to look at a small forest and SEE all of the trees.

        After that you can then try programming in a larger, more abstract and also more inclusive, structure; and will have a better perspective instead of looking at a big forest and getting LOST in the number of trees.

        http://en.wikipedia.org/wiki/BASIC_Programming

        woodsmoke
        Last edited by woodsmoke; Oct 14, 2012, 12:58 PM.
        sigpic
        Love Thy Neighbor Baby!

        Comment


          #5
          I also recomend starting with python, there are kde and qt bindings for it if you want to write gui applications and it has a very simple syntax so is not hard to learn.

          C++ with qt is also a good way to go but can be more complicated to get into.

          Comment


            #6
            Python it is. How do I get started? Do I need to install libraries, compilers etc? Can anybody recommend a good online source?

            Comment


              #7
              Python is an interperted language, which means it does not need to be compiled. It should already be installed on your system, if not just run "sudo apt-get install python". You can run the interperter by just running "python" inside a terminal or you can run a python script by running "python /path/to/script".

              Running the interperter is a good way to test short commands and is thus a good place to start.

              You should also know what version of python you are running by running "python --version" as I think kubuntu is switching over to python3 which changes the syntax abit. I would recomend learning python3 over 2 these days as everything is starting to switch over to it now and for the most part python3 scripts are backwards commpatable with 2.7 (most of the time ^^ ).

              This seems like a good place to start if you have python3.

              I don't recomend looking at the gui side of things until you know how to write a basic command line program. But when you feel ready try reading the toturials list on here.

              Comment


                #8
                Thanks! That should keep me busy for the next month or two.

                Comment


                  #9
                  Originally posted by whatthefunk View Post
                  Python it is. How do I get started? Do I need to install libraries, compilers etc? Can anybody recommend a good online source?
                  Personally, I think Python is a poor choice for learning how to program. It is in the middle of a major version change, it is not strongly typed, it is not very cross-platform, it has no native GUI dev forms or db back ends. It does make a great glue, much like Pearl, but is easier to read than Pearl. There are a lot of version compatibility problems between version of Python and 3rd party components that make it useful for GUI apps. That's why some distros have more than one version of Python installed. I tested Boa-Constructor, probably the best GUI IDE for Python, and found it wanting.

                  Disclaimer: I LOVE Qt and used it professionally for the last 6 or 7 years of my programming career. In fact, I learned C++ at the same time I learned Qt. While learning C++ with Qt would be a good idea for someone with programming experience in other languages and APIs, I don't think it would be a good idea for someone with no programming experience to try and learn both at the same time. Therefore, my recommendation is this:

                  1) Install Kate, the text editor, and set its markup to "C++". I recommend Kate instead of Emacs or Eclipse or QtCreator or other GUI RADs because you don't want to get bogged down into learning the in's and out's of such advanced tools while trying to master C++. They are NOT necessary in learning how to program in C++. They only make things easier for the experienced coder by hiding a lot of stuff that the coder already knows how to do but a rookie wouldn't, thus making them a "black box". What you want to do is start by learning how to write simple apps for the console. Kate is perfect for this. It not only highlights C++ reserved words, it also creates a memory pool of phrases the help it create a form of "auto complete", which helps immeasurably in recalling the names of variables, functions, etc..., that you create when writing a program. It also has a console panel which you can keep open and use to compile your source. It will list the line numbers where errors occur and when you click on an error line the source will be redisplayed making that line the center of the code window.
                  2) Make sure you have "build-essential" and "g++" installed. (Use Muon).
                  3) Get a good book, like Tom Swan's "GNU C++ For Linux". http://www.amazon.com/Swans-Linux-Pr...g=651998669-20
                  Supplement it with short tutorials like http://www.cplusplus.com/files/tutorial.pdf which are found on the web.
                  YouTube has some excellent Linux C++ console programming.
                  Re-read the texts and re-do the examples until you can do the examples without reading the text or consulting the code. IOW, it's in your mind.

                  When you feel comfortable with C++ on the console using Kate it is time to advance to a GUI RAD tool. Qtcreator ("qtcreator") is in the repository. Install it and all it's dependencies. There are excellent video tutorials on YouTube. Make sure they were published using Qt 4.8 or later.
                  "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                  – John F. Kennedy, February 26, 1962.

                  Comment


                    #10
                    @GreyGeek - gonna have to nit-pick a couple of things:
                    it is not strongly typed, it is not very cross-platform
                    Wikipedia disagrees:
                    Despite being dynamically typed, Python is strongly typed, forbidding operations that are not well-defined (for example, adding a number to a string) rather than silently attempting to make sense of them.
                    As for cross-platform, python can be used on a huge number of platforms, including Linux, Windows, OS X, OS/2, Solaris, the various BSDs, iOS, Android, Xbox, Playstation 2 & 3, OS/390, z/OS and many more.

                    See http://en.wikipedia.org/wiki/CPython for a comprehensive list of supported platforms.

                    One other thing... yes, Python is going through a major version change with all that that entails... but so is C++, with the transition to the recently (August of this year) ISO approved C++11.
                    Last edited by HalationEffect; Oct 15, 2012, 08:00 PM.
                    sigpic
                    "Let us think the unthinkable, let us do the undoable, let us prepare to grapple with the ineffable itself, and see if we may not eff it after all."
                    -- Douglas Adams

                    Comment


                      #11
                      I was looking at this, and it says it has a Python Check here

                      Learn to code | Codeacademy
                      \\\
                      Python Syntax | Codeacademy
                      Last edited by Snowhog; Oct 15, 2012, 10:10 PM.
                      Rob

                      Comment


                        #12
                        Regardless of what you read in Wikipedia, there is no such thing as "variable declaration" or "variable initialization" in Python, like there is in C++.


                        There is simply what is called "assignment", but should probably just call "naming". Assignment means "this name on the left-hand side now refers to the result of evaluating the right-hand side, regardless of what it referred to before (if anything)".

                        Ergo, you do NOT see STRONG TYPING statements in Python like

                        int n;
                        which declares "n" to be of type integer. In C++ you do. After that declaration a subsequent statement like
                        n = "some string";
                        will cause a g++ compiler error which will identify the error and the line it occurs on.

                        In Python (at least when I was testing it for in-house application creation several years ago) you can do things like this:

                        foo = 'bar' # the name 'foo' is now a name for the string 'bar'(one or many lines later...)
                        foo = 2 * 3 # the name 'foo' stops being a name for the string 'bar',
                        # and starts being a name for the integer 6, resulting from the multiplicationYou can, of course, use Python builtins to test a name to see what type data it is holding at that moment, but in C++ you only have to read the declarations in the header files or function declarations. AND, more importantly, you can be assured that within the scope of a variable it will not change its data type.
                        "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                        – John F. Kennedy, February 26, 1962.

                        Comment


                          #13
                          http://en.wikipedia.org/wiki/Dynamic...nd_weak_typing
                          A computer language that implements strong typing will prevent the successful execution of an operation on arguments that have the wrong type.
                          Python complies with the quoted statement above.

                          You're describing static typing vs dynamic typing, rather than strong typing vs weak typing. My nit-pick was about that mix up.

                          I would tend to agree that the first programming language one should learn probably ought to be a statically typed language.
                          sigpic
                          "Let us think the unthinkable, let us do the undoable, let us prepare to grapple with the ineffable itself, and see if we may not eff it after all."
                          -- Douglas Adams

                          Comment


                            #14
                            Originally posted by whatthefunk View Post
                            Python it is.
                            Excellent!

                            Originally posted by whatthefunk View Post
                            That should keep me busy for the next month or two.
                            The official tutorial, and a good one: The Python Tutorial

                            Another, somewhat briefer: Python tutorial

                            Worth reviewing: Python For Beginners - Getting Started

                            When you feel the need for the definitive answer on a specific point: The Python Language Reference and The Python Standard Library.
                            I'd rather be locked out than locked in.

                            Comment


                              #15
                              Originally posted by SecretCode View Post
                              The official tutorial, and a good one: The Python Tutorial
                              I would suggest the offcial 3.3 one with the migrations towards 3.x being made it is better to start learning that.

                              You might also want to read this and decide if you need python 2 or 3. But I would recomend learning the syntax for python3 as most of it also works in python2 (but the syntax for 2 doesn't work in 3...).

                              For example the old python 2 way of printing:
                              Code:
                              print "hello world"
                              doesn't work for python 3, but the new way:
                              Code:
                              print("hello world")
                              does work in python 2.7

                              Comment

                              Working...
                              X