Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Oct 2003
    Location
    Essex/Greater London
    Posts
    167
    Member #
    3433
    What on Earth does it mean?

    I realise that this is most likely an extremely basic question, but I can't find the answer anywhere.

    Search functions don't even seem to register the characters, even in quotation marks. Perusing related web sites haven't turned anything up either.

    If anyone can shed any light onto what -> means, I would be eternally grateful.

    Thanks.

  2.  

  3. #2
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    137 times
    What does "->" mean? In what context?

    Could mean pointer, could mean inferrence of data, could mean look right!
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  4. #3
    Senior Member
    Join Date
    Oct 2003
    Location
    Essex/Greater London
    Posts
    167
    Member #
    3433
    Lol! Here's an example of where it is used-

    Code:
    $db->get_results
    I'm trying to steamline my database queries, as my method is rather... bloated. I checked the phpBB source to see how they did it, and it's similar to this, but I was totally baffled. I found a tutorial on the subject, which seems to fullfil my needs, but I can't understand this apparently basic, somewhat pivotal symbol!

  5. #4
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    Are you familiar with the term Object Oriented programming?
    If not, you have a lot of ground to cover.

    The symbol "->" is a way of accessing object members. $person->name accesses the name property of the $person object.
    Object members can be properties (variables), methods (functions), structs (data structures), fields etc...


    In essence:
    Object oriented programming enables you to reuse programming code by just referring to the object containing the neccessary code. The object itself, encapsulates the internal workings. Meaning you can alter the value of a property named "var" in object A without it affecting a similarliy named property "var" in object B. Some object members cannot be accessed from the outside at all, but can only be used internally by the object itself.

    Anything can be an object. A resultset can be returned as an object, as in your tutorial example. However, most objects that are used to process data, are instantiated from a class. The class holds the blueprint for the object. That means you can not normally interact directly with the class, but have to instantiate an object first.
    As an example, you cannot drive the blueprints for a Toyota, but you can drive the car derived from them.
    (This is not totally true though. You can have static classes, whos members can be accessed directly.)
    You can also design a class B that inherits all inner workings of class A.
    As an example, you can have a class that describes all the essentials of a combustion car. Then you can make a custom class built on that class that specifies all the extras needed to instantiate a BMW-roadster object.

    OO-programming is a necessity when building complex programs (read application programming). If you work in a programming team, you would have to utilize modules buildt by other members of the team, that performs certain tasks necessary for your part of the project to work. You won't necessarily need to know how these modules work internally, only what the input format should be, and what type of output to expect.
    This would be very difficult to achieve, using a procedural approach.
    OO-programming, makes for very robust code. As objects are 'tamper proof', you can build your code from thoroghly tested components, instead of re-constructing elements of code as you go along.
    An object can be extremely complex inside, but have a simple interface externally.

    As a wrap up of this short and shallow intro, I can give you two examples that illustrates the benefits of OO programming. (Both are examples from books I've read, I can't remember which ones though)

    Imagine a program beeing like a business.
    You work as an engineer for a car company. You are in need of some reports and data from the vast archives of your company. Instead of going down to the archieves themselves, learning all about how it's structured and organized, learning to use it's IT equipment, and then go and retrieve the actual papers you need, you simply call the archives 'secretary-object', and ask her to send report 10A-001423C66F-04 to your office.
    While you know all about how the electronic fuel control works in your design project, but nothing about how the archives are structured, the secretary knows all the ropes around the archives, but nothing about electronic fuel control units.
    Together you fulfill each other, and are two of thousands of "objects" that in sum makes the company work.

    Object interfaces and encapsulation:
    A large building will often have a lot of elevators. To optimize the service offered by the elevators, a program controls them. Not all elevators run from the ground floor all the way to the top. The majority serves floor 8 through 22. During business hours, 85% of the traffic is between floor 12 and floor 18.
    After hours, the traffic is more spread out, but with varying load between different floors. As the day goes by, traffic load varies from hour to hour, but following a certain pre-determined scheme.
    The different elevators have different load capacity, and different speed.
    The control programs role is to know all this, and position the empty elevators where they are most likely to be called next. To have a strategy for how to answer an 'up' call from floor 14 at the same time a 'down' call is made from floor 17. The program also issues an alert if to many people enter a lift at the same time, exceeding its design limit, etc etc.

    Users of the elevator need not worry about these things. They only have to know about the "call elevator to my floor" button, and the numbered floor buttons inside the elevator. The control program keeps track of the rest. The control program is 'encapsulated'. Imagine what chaos would result, if all travellers were given full access to the lifts control structures. You could override the priority list of the lift and force it to your floor even though it would be more economic for the elevator to pass your floor to pick up 6 guests waiting one floor below you first. You could override the maximum design limit speed, you could override it's load capacity, and so on. The control buttons inside the elevator would have to cover all available space, and be a very confusing mess. Additionally, all travellers would have the same access as yourself. Most people would be unable to navigate the button mess, and those who could, would give conflicting inputs that soon would grind the whole system to a halt.
    Encapsulation of the important control structures, protects the delicate inner workings from erronous inputs, and the simple buttons in the 'elevator object' makes for an easy user interface, whilst still beeing able to communicate with the complex inner workings of the control center.
    S. Rosland

  6. #5
    Senior Member
    Join Date
    Oct 2003
    Location
    Essex/Greater London
    Posts
    167
    Member #
    3433
    Wow, thank you very much for your detailed reply. I liked the analogy of the different departments of a business interacting, and it explains things pretty clearly. I can see I have a lot of reading to do though! :classic:

    I'm hoping I'll be able to read through the code in that tutorial to get an idea of how the db queries will work. I just want to get the site running, and then learn more about programming as I add more advanced features.

    Thanks again for your help, it was very informative!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:08 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com