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

General "Methods/Structures" in Programming

Tags:
  1. May 22, 2015 #1

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Hi all,
    I have been teaching myself some programming by using Alice 2.3 freeware.

    My question is whether/to what degree, the structures used in Alice generalize:

    Alice's main items are : methods, events, functions, parameters, variables.

    Is this also the case for general programming environments. If so, to what extent?

    Thanks.
     
  2. jcsd
  3. May 22, 2015 #2

    FactChecker

    User Avatar
    Science Advisor
    Gold Member

    The list: methods, events, functions, parameters, variables is certainly very important in any computer language, so you are not wasting time in learning about them. But I don't think they do much to characterize different types of structures. When I think of types of data structures, I think of lists, hash arrays (aka dictionaries), linked lists, trees, etc. So just be aware that there might be more to learn about. It's an important subject dealing with how information is organized, stored, retrieved, and communicated. On the other hand, you may go a long time only encountering simple examples of these that you will understand immediately.
     
    Last edited: May 22, 2015
  4. May 22, 2015 #3
    None of what you mentioned are structures, they are just concepts.

    Methods - these are functions attached to an "object." You call it, it does some work on the object, then it returns. Used for everything.
    Event - something that may happen at any time. You register a function that gets called when something happens. Used for dealing with events that can happen in any order: mouse, keyboard, sockets...
    Functions - these are groups of code that do work, similar to a method but without an object associated with it
    Parameters - this is how you get information into a function, a function usually requires some data to do it's work
    Variables - these are just placeholders for data, just like in mathematics. They are used everywhere.
     
  5. May 23, 2015 #4
    Those are some of the main programming concepts. The list is missing "class" and "object". A method is usually a function tied to an object. A variable tied to an object is called an attribute, member, or property. The term "structure", as I think another poster mentioned, usually refers to data structure, which is different, things like trees and linked lists. But in the normal English usage of how a program is structured, those in the list are the key parts.
     
  6. May 23, 2015 #5

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Thanks, Fooality, I will look further into these concepts.
     
  7. May 23, 2015 #6

    Mark44

    Staff: Mentor

    I took a very quick look at an Oracle site that provides information and examples about the Alice programming language. My take is mixed: on one hand, you can do some pretty cool things with animation very quickly, but on the other hand, the user interface gets in the way of learning how to write programs (IMO). To get a better feel for programming, I believe that it's more beneficial to actually write code than to fill in boxes with information.

    A lot of people start out with Python, which can be downloaded for free. Another alternative is to start in with C (non-object-oriented) or C++ (which has object-oriented features). There are several free compilers that are available, including gcc and Microsoft Visual Studio Express, the latter of which can also be used if you write code in C#.

    FactChecker mentioned several data structures that are used in programming. There are also control structures, such as if/else and other branching structures, for loops and while loops, and so on, that are present in virtually all programming languages.
     
  8. May 23, 2015 #7

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Thanks all for your replies. Yes, I did use the word "structures" too loosely, my bad.

    @runner, anyone: would you plese give me a ref. on "inheritance issues" for these concepts? I

    am confused, using Alice, on when I should use a world method, or a method of any other object,
    same for events, other concepts.
     
    Last edited: May 23, 2015
  9. May 23, 2015 #8
    Hey, I looked at Alice.org, I get the impression that version 2 teaches basic programming logic, while version 3 teaches object oriented concepts (this is where you learn about objects and classes) http://www.alice.org/index.php
    Inheritance in programming exists in object oriented programming. One class is said to inherit attributes and methods from its "parent" or "base class". Its a way to reuse code.
     
  10. May 23, 2015 #9

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    I looked, too. My take was less mixed. IMO, Alice is the computer science equivalent of Physics for Poets. Just as Physics for Poets is not the way to learn physics, Alice is not the way to learn how to program a computer.
     
  11. May 24, 2015 #10

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Well, the interface is frustrating, but if you do a search for Alice , you see that it is being taught and it has been taught for many years now at "reasonable" schools, i.e., not bottom-of-the-barrel ones, so maybe there is more to it than meets the eye.
     
  12. May 24, 2015 #11

    Mark44

    Staff: Mentor

    Lots of "reasonable schools" have classes like the "Physics for Poets" that D H cited, as well as "Rocks for Jocks," a simplified course in geology. Filling in boxes is not my idea of learning how to write programs.
     
  13. May 24, 2015 #12

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Believe me, you do need to have an idea f what you are doing here. If you do not " fill your boxes" correctly, the
    program will not run. Of course, this is an intro, so you get to know and understand the main concepts, and to know
    some real programming you need you need to go beyond this into some more advanced environments. You need to
    know if/when to use different types of loops, if/else statements, what types of variables to use, how to combine different variables into
    strings (using joins, etc.). It is an intro and it does not claim to be anything more than that.
     
  14. May 24, 2015 #13
    That's like saying, drawing circuit diagrams is not my idea of learning about electronics. After all everyone knows that circuit design is all about soldering and not drawing lines and boxes on paper.
     
  15. May 24, 2015 #14

    Mark44

    Staff: Mentor

    Your analogy isn't at all apt, IMO.

    My (and D H's) complaint is more like the opposite of what you wrote. We are essentially saying that soldering bits and pieces together without the benefit of circuit diagrams isn't how to learn electronics, but drawing circuit diagrams is.
     
  16. May 24, 2015 #15
    Fine, that makes sense. But it doesn't matter whether you design your circuit diagrams by dragging boxes around and filling in the values or you design it by writing down text that describes how the components fit together. Textual vs graphical is not the important issue here.
     
  17. May 25, 2015 #16
    My two cents on the Alice-as-a-way-to-learn conversation: Java was my first language. It was a brutal learning curve, but once I was over it everything higher level: python, php, javascript etc. Came incredibly easy. Only lower level languages C/C++ came tough, and that's generally the rule: Its harder to go down in abstraction than it is to go up with learning languages. The best long term would be to start with a year of pure suffering in assembly languages and C, and then after than everything would come easy. But can people tolerate that? Its literally several months of programming without being able to produce anything interesting, whereas only a quarter of Python or Ruby would allow you to produce some little program you're proud of. The other thing is the world needs programmers at different levels. It needs lots of people who can script a solution in something simple, and it needs less people who can do breakthrough work on C algorithms, like the next video compression algorithm. So I don't think the top down approach Alice offers is totally flawed, but you have to understand you're stretching out the suffering this way too, there will be more every time you take on a lower level language that you have before.
     
  18. May 26, 2015 #17
    There is a difference between "computing", "computer science" and "programming".

    If you do a degree such as "Computing and IT" they may well teach a visual programming language like Alice because you only need to understand the concepts of how a program is a system that follows logical rules that are pre-determined when it is created. The rest of the degree will be stuff like how to setup computer networks (the IT side) and a general introduction to computing such as how to use spreadsheets and what the cloud is.

    If you do a "Computer Science" degree they will almost certainly not teach Alice, and will likely use a more traditional language like Python or Java (these are the two most common languages taught in US Computer Science university courses at the moment).

    Programming itself is creating computer programs. Alice is programming, so don't let anyone tell you it isn't. However you are NOT going to be landing computer programming jobs with Alice. There are only a few fields in which visual languages are used. Game scripting is one of them (Unreal Engine has a visual languge for level creation) but even there, you'll need some knowledge of Python or LUA.

    In my experience most of the people using visual languages such as Alice are creative artists who use computers as part of their art, because they are not "science-y people". For example, interactive installations with lamps that track your movement as you walk around the exhibit. Even then, a lot of them are using Python and C or C++ (microcontrollers).
     
  19. May 26, 2015 #18

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    I am using Alice as an introduction, not as the goal itself, and, AFAIK, this is the way it is used in many places -- as the first step towards a better understanding of programming, though I don't doubt it is also used by some who do not want to engage in the nitty-gritty. And you do need to have a reasonable conceptual understanding of when/how to use loops, what types of loops to use, and if/when you will enter a loop , you need to use if/else statements correctly, etc. Maybe not "rocket science" , but not entirely technically trivial either, you do need to have some understanding beyond just an "artsy" level. And I would like to believe I have enough training in related Mathematics that I can handle (albeit with a lot of work) into a more "nitty-gritty" level.
     
    Last edited: May 26, 2015
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: General "Methods/Structures" in Programming
  1. Root programming (Replies: 3)

  2. Explain this program. (Replies: 3)

  3. HMI programming (Replies: 1)

  4. C++ program (Replies: 2)

Loading...