Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it, follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!

PA Programming Thread :: PAdev.net - Need hosting for a service of yours? Check it out.

19495969799

Posts

  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    Java doesn't even have function objects or even pointers. It's like, blarg.

    This is a feature that C has.

    :|

    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • GnomeTankGnomeTank Registered User regular
    Java doesn't have delegates/function pointers?

    Well jesus...I knew it was behind, but not that behind.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
  • GnomeTankGnomeTank Registered User regular
    Also, everyone should go back and read this BOTP post http://forums.penny-arcade.com/discussion/comment/22120795#Comment_22120795

    Because I was actually eliciting opinion, and I hate it when a post I actually want to get responses for BOTP's.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
  • urahonkyurahonky Registered User regular
    Forgive my insolence, but aren't pointers just a reference to an object in memory? Objects in Java are almost always passed by reference rather than value. If I'm remembering right..

  • InfidelInfidel Heretic Registered User regular
    How do you pass a method as a parameter?

    That is what a function pointer is and Java lacks.

    TwitchTV channel: OrokosPA OrokosPA
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • GnomeTankGnomeTank Registered User regular
    Pointers are just a memory address, they have nothing to do with objects. They point to an address in memory, what happens to be at that address could be anything.

    C++ makes pointers somewhat more type safe, but you can still take any random pointer to an object, cast it to void* and then write random data to that memory block.

    What Monkey Ball means is that Java doesn't have first order functions, meaning you can't pass functions around, or assign them to variables. C# supports this via a concept called delegates (basically function pointers with instance information hung off of them), while C has "the original", function pointers, which are simply pointers to a function, because remember, code is just data that is in a different place in memory.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
  • InfidelInfidel Heretic Registered User regular
    GnomeTank wrote:
    because remember, code is just data that is in a different place in memory.

    But my favourite code is the kind in the same place as your data! :rotate:

    r00t ololol

    TwitchTV channel: OrokosPA OrokosPA
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • urahonkyurahonky Registered User regular
    Oohhh okay. That makes sense... I'm not sure if I've ever wanted/needed to pass a method as a parameter. But now I'll see its uses everywhere and not be able to do anything about it... Thanks a lot! :(

  • bowenbowen Registered User regular
    Function pointers are fantastic to play around with, sooooo many things to shoot yourself in the foot with.

  • InfidelInfidel Heretic Registered User regular
    bowen wrote:
    Function pointers are fantastic to play around with, sooooo many things to shoot yourself in the foot with.

    They're hardly dangerous, given the use case. Regular pointer "fun" can cause headaches for those not used to em, but you're unlikely to be doing pointer arithmetic etc. with functions. You just have a pointer and you call it when you want to, it's a common concept and Java has a bunch of shit to get around its lack of supporting it. (Listeners etc. UGLY)

    Function pointers are about as dangerous as integer division.

    TwitchTV channel: OrokosPA OrokosPA
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • GnomeTankGnomeTank Registered User regular
    edited February 2012
    urahonky wrote:
    Oohhh okay. That makes sense... I'm not sure if I've ever wanted/needed to pass a method as a parameter. But now I'll see its uses everywhere and not be able to do anything about it... Thanks a lot! :(

    I am notorious for writing super generic code that takes action predicates as method parameters, allowing me to write 99% of the code completely generic, then let the caller specify that 1% it needs to be different.

    The best option you have in Java is functors (objects whose sole purpose is to expose a single point of callable functionality).

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited February 2012
    GnomeTank wrote:
    because remember, code is just data that is in a different place in memory.

    Unless it is a Harvard architecture, in which case everything is truly fucked.
    urahonky wrote:
    Forgive my insolence, but aren't pointers just a reference to an object in memory? Objects in Java are almost always passed by reference rather than value. If I'm remembering right..

    Yes, and this is the work around for writing quasi-functional code in Java: You use a Callable interface that has one method, .call(). It is a dirty hack.

    Monkey Ball Warrior on
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • InfidelInfidel Heretic Registered User regular
    GnomeTank wrote:
    because remember, code is just data that is in a different place in memory.

    Unless it is a Harvard architecture, in which case everything is truly fucked.

    My Harvard sim had an interactive debugger! 8-)

    TwitchTV channel: OrokosPA OrokosPA
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • bowenbowen Registered User regular
    Infidel wrote:
    bowen wrote:
    Function pointers are fantastic to play around with, sooooo many things to shoot yourself in the foot with.

    They're hardly dangerous, given the use case. Regular pointer "fun" can cause headaches for those not used to em, but you're unlikely to be doing pointer arithmetic etc. with functions. You just have a pointer and you call it when you want to, it's a common concept and Java has a bunch of shit to get around its lack of supporting it. (Listeners etc. UGLY)

    Function pointers are about as dangerous as integer division.

    Yeah I misspoke. I meant "MINDFUCK."

    Especially junior programmers that don't know you can point to functions, and member functions.

    C# has an okay solution to this, though. I haven't really tried to make delegates in java.

  • GnomeTankGnomeTank Registered User regular
    Yes, and this is the work around for writing quasi-functional code in Java: You use a Callable interface that has one method, .call(). It is a dirty hack.

    Functors. They are made even worse by the fact that Java can't override the call operator, so you can't actually say "myFunctor()", you have to do "myFunctor.call()" which just looks dirty, though is functionally equivalent.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    That wouldn't be the first time I failed my CS vocabulary roll.

    I'm just now learning C++ and operator overriding seems fundamentally sketchy. I mean yeh, I can see how it can make things prettier, but I don't like the idea of futzing around with the syntax of the language itself, which seems kind of like what you are doing when you mess with operators. I could support it if there was a specific operator that was undefined unless it was overridden, so that it was specifically for the purpose of overriding.

    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • bowenbowen Registered User regular
    edited February 2012
    Generally you only overload if there is a specific function you need to emulate. Adding fractions, matrices are the most common of the CS degree examples.

    If I made a "money" class, I'd probably want to overload many of the operators.

    Other than the obvious ones, it's usually considered bad form. I think = is the most common for a copy constructor that you want to specify behavior for.

    bowen on
  • urahonkyurahonky Registered User regular
    This is the first time I've ever heard of a Functor and I feel like you guys are trolling me. :P

  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    That wouldn't be the first time I failed my CS vocabulary roll.

    I'm just now learning C++ and operator overriding seems fundamentally sketchy. I mean yeh, I can see how it can make things prettier, but I don't like the idea of futzing around with the syntax of the language itself, which seems kind of like what you are doing when you mess with operators. I could support it if there was a specific operator that was undefined unless it was overridden, so that it was specifically for the purpose of overriding.

    As a bonus, overriding certain operators can change the semantics of the language as well by removing short circuit evaluation!

  • baronfelbaronfel Registered User regular
    edited February 2012
    @gnometank I read your BOTP, but for some reason it's greek to me. I think I'm a little blitzed due to work, but I'll take a peek when I get home and see if I can noodle over it a bit more in depth.

    baronfel on
  • urahonkyurahonky Registered User regular
    InstallAnywhere is trash.. I've spent the last two hours wrestling with it to get it to work... Turns out it's actually Zangief. I'm tapping out.

  • LindenLinden Registered User regular
    urahonky wrote:
    This is the first time I've ever heard of a Functor and I feel like you guys are trolling me. :P

    It's a common enough idiom, but calling it a functor is bothersome. It's overloaded already (Prolog's name for 'functions', although that kind of misses the point; category theory)

    What if this weren't a rhetorical question?
  • zeenyzeeny Registered User regular
    urahonky wrote:
    This is the first time I've ever heard of a Functor and I feel like you guys are trolling me. :P


    I've seen chapters in books titled "Functors". Was not amused.

  • CantidoCantido Registered User regular
    I need to relearn PHP/SQL. I already made the database and need to learn to make properly functioning forms. It makes me delighted to see that Dreamweaver has improved so much on detecting PHP errors that I don't need to buy Zend Studio.

    Does anyone have suggestions on relearning form communication? Sorry, noob question.

    steam_sig.png
  • zeenyzeeny Registered User regular
    edited February 2012
    bowen wrote:
    Infidel wrote:
    bowen wrote:
    Function pointers are fantastic to play around with, sooooo many things to shoot yourself in the foot with.

    They're hardly dangerous, given the use case. Regular pointer "fun" can cause headaches for those not used to em, but you're unlikely to be doing pointer arithmetic etc. with functions. You just have a pointer and you call it when you want to, it's a common concept and Java has a bunch of shit to get around its lack of supporting it. (Listeners etc. UGLY)

    Function pointers are about as dangerous as integer division.

    Yeah I misspoke. I meant "MINDFUCK."

    Especially junior programmers that don't know you can point to functions, and member functions.

    C# has an okay solution to this, though. I haven't really tried to make delegates in java.

    That's why you should always teach functional programming first(or at least soon after introductory programming...). Once people are used to manipulate functions as objects, it becomes just a matter of being careful with the specific.

    zeeny on
  • zeenyzeeny Registered User regular
    Cantido wrote:
    I need to relearn PHP/SQL. I already made the database and need to learn to make properly functioning forms. It makes me delighted to see that Dreamweaver has improved so much on detecting PHP errors that I don't need to buy Zend Studio.

    Does anyone have suggestions on relearning form communication? Sorry, noob question.

    What exactly are you asking for, because when I see "forms", I automatically think of html forms and this automatically leads to "You are doing it with ajax, right?".

  • GnomeTankGnomeTank Registered User regular
    edited February 2012
    urahonky wrote:
    This is the first time I've ever heard of a Functor and I feel like you guys are trolling me. :P

    We aren't trolling you, it's a thing. http://en.wikipedia.org/wiki/Functor.

    They are a mathematical construct in category theory, and a synonym for "function object" (http://en.wikipedia.org/wiki/Function_object) in compsci.

    e: From that function object article "Java has no first-class functions", poor Java :(

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
  • CantidoCantido Registered User regular
    zeeny wrote:
    Cantido wrote:
    I need to relearn PHP/SQL. I already made the database and need to learn to make properly functioning forms. It makes me delighted to see that Dreamweaver has improved so much on detecting PHP errors that I don't need to buy Zend Studio.

    Does anyone have suggestions on relearning form communication? Sorry, noob question.

    What exactly are you asking for, because when I see "forms", I automatically think of html forms and this automatically leads to "You are doing it with ajax, right?".

    Come to think of it, yes, I'd like to relearn AJAX too, and yes, I'm just using html forms.

    I'm trying to make a website that can control an air conditioner for senior design :D

    steam_sig.png
  • admanbadmanb the bored genie Seattle, WARegistered User regular
    Cantido wrote:
    zeeny wrote:
    Cantido wrote:
    I need to relearn PHP/SQL. I already made the database and need to learn to make properly functioning forms. It makes me delighted to see that Dreamweaver has improved so much on detecting PHP errors that I don't need to buy Zend Studio.

    Does anyone have suggestions on relearning form communication? Sorry, noob question.

    What exactly are you asking for, because when I see "forms", I automatically think of html forms and this automatically leads to "You are doing it with ajax, right?".

    Come to think of it, yes, I'd like to relearn AJAX too, and yes, I'm just using html forms.

    I'm trying to make a website that can control an air conditioner for senior design :D

    Time for some tasty jQuery.

    twitter, github, resume/portfolio, if you like to play or host boardgames online, check out handtracker
  • GnomeTankGnomeTank Registered User regular
    edited February 2012
    If you're going to use AJAX, learn jQuery and save yourself a ton of time.

    e: Damnit, beaten.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
  • CantidoCantido Registered User regular
    Wow, I have never ever heard of jQuery. But that's because I'm five years out of practice. Sweet!

    steam_sig.png
  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited February 2012
    GnomeTank wrote:
    urahonky wrote:
    This is the first time I've ever heard of a Functor and I feel like you guys are trolling me. :P

    We aren't trolling you, it's a thing. http://en.wikipedia.org/wiki/Functor.

    They are a mathematical construct in category theory, and a synonym for "function object" (http://en.wikipedia.org/wiki/Function_object) in compsci.

    e: From that function object article "Java has no first-class functions", poor Java :(

    Why Java is still the de facto teaching language is beyond me. C#, javascript (probably via Node.js), Python, Golang, hell even C++11, apparently. These are all improvements. Also java is owned by nazis communists unrepentant assholes now.

    It is time to move on.

    Cantido wrote:
    Wow, I have never ever heard of jQuery. But that's because I'm five years out of practice. Sweet!

    Oh yeh that is almost synonymous with javascript to me. It makes the DOM not (as much of) a horrible nightmare. Until you throw in some ASP.NET, then it becomes silent hill in your IDE.

    Monkey Ball Warrior on
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • GnomeTankGnomeTank Registered User regular
    Unless you are using ASP.NET MVC 2+, which has perfectly fine jQuery integration. Then it's no big deal.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
  • InfidelInfidel Heretic Registered User regular
    Funny enough, education is starting to look into dropping Java, just as the industry is starting to take it more seriously due to Oracle. :rotate:

    I personally think they'd all be better off without!

    TwitchTV channel: OrokosPA OrokosPA
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • admanbadmanb the bored genie Seattle, WARegistered User regular
    re: jQuery

    And then you think, "Man, this is powerful. I could build a fully-dynamic client-side web application with this and a light backend only used for serving data from the db to the front-end."

    No sir, no you should not do this.

    twitter, github, resume/portfolio, if you like to play or host boardgames online, check out handtracker
  • GnomeTankGnomeTank Registered User regular
    I don't know that the industry is taking it more seriously. Maybe inside Java circles, people are less doom and gloom about it since Oracle took over, but outside Java circles it's not gaining any popularity. The Java language committees refusal to add really anything modern to the language has hurt it in the long run.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited February 2012
    Yeh, from what I heard, I would have liked MVC. But none of that during my internship. We still had mission critical VB6 code running around; .NET in general was considered "fancy new stuff".

    Monkey Ball Warrior on
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • InfidelInfidel Heretic Registered User regular
    GnomeTank wrote:
    I don't know that the industry is taking it more seriously. Maybe inside Java circles, people are less doom and gloom about it since Oracle took over, but outside Java circles it's not gaining any popularity. The Java language committees refusal to add really anything modern to the language has hurt it in the long run.

    Enterprise and large industry are fans of vendor packages. For new application projects, Microsoft can provide the main components and now so can Oracle. This isn't developer decisions, this is architect and executive decisions. Doesn't matter if the technical is the same as it used to be, the marketing and support contracts change things big time.

    TwitchTV channel: OrokosPA OrokosPA
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • InfidelInfidel Heretic Registered User regular
    TwitchTV channel: OrokosPA OrokosPA
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • GnomeTankGnomeTank Registered User regular
    Infidel wrote:
    GnomeTank wrote:
    I don't know that the industry is taking it more seriously. Maybe inside Java circles, people are less doom and gloom about it since Oracle took over, but outside Java circles it's not gaining any popularity. The Java language committees refusal to add really anything modern to the language has hurt it in the long run.

    Enterprise and large industry are fans of vendor packages. For new application projects, Microsoft can provide the main components and now so can Oracle. This isn't developer decisions, this is architect and executive decisions. Doesn't matter if the technical is the same as it used to be, the marketing and support contracts change things big time.

    You aren't going to have any primarily Microsoft shops changing to Java though, support contracts or otherwise. For UNIX shops, or shops that don't know what they are yet, perhaps Java is appealing, but it's not winning a ton of converts.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh
This discussion has been closed.