The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

using(PennyArcade.Forum){Threads.push(ProgrammingThread())}

JasconiusJasconius sword criminalmad onlineRegistered User regular
OK guys programming.

We are going to do OP by committee! Talk about your favorite languages/frameworks and why they are better than everyone else's.

Algorithms and Data Structures: http://www.itl.nist.gov/div897/sqg/dads/
Jasconius wrote:
Here's what I am working with these days in no important order:

Language: Python
Framework: Django
Purpose: Web Development++


Summary: Django is what PHP contributors wish for in their darkest dreams. Django provides intensely incredible functionality to generate small to medium data driven web applications in minutes. A pretty decent ORM provides a healthy layer of abstraction from database development and allows people who are most comfortable with a traditional scripting environment (read: me) to compete with that 14 year old from Slovenia who got a MySQL book for their birthday. I'm trying to close my first official Django development freelance contract this week.

Python is what it is. A simple, slick programming language with a light syntax and flexible rules that I think is a great language for new programmers. Python does everything including exploring Mars.

Other Links and Reading: http://djangobook.com/ && The Definitive Guide to Django, 2nd Edition

Language: Objective-C
Framework: Cocoa/UIKit
Purpose: iPhone/OS X development


Summary: Obj-C is a thin veneer over ANSI-C enabling OOP and other neat features. Cocoa is the framework upon which all depends when it comes to Mac development, much like Win32 for Windows. My feelings on Cocoa are mixed, the learning curve is steep. I am currently enjoying the tiny bit of abstraction it provides for OpenGL. I am developing an iPhone application for the retail chain I work in-house for, and I just got taken on as a contractor for an iPhone game developer.

Language: Actionscript 3
Framework: Flash
Purpose: Multimedia on the web


Summary: This got me a job, all my jobs really. Flash has evolved in the last decade from an annoying trend to an underground success in the world of RIA's thanks to Flex. ATG, the worlds leading eCommerce engine, just redid their entire commerce administration tool in Flex and I hear great things about it. Traditional Flash (what I do) is in steady decline as non-proprietary web technologies evolve and become mainstream, but with a high dollar creative team, nothing can compare for raw presentation value.

Other reading: GoToAndLearn.com
ASimPerson wrote: »
Language: C
Framework: Aahahahaha
Purpose: My job

Summary: C and its descendants (C++/Java/C#/etc.) are the most popular programming languages in the world. (As co-inventor Dennis Ritchie supposedly said, "C is quirky, flawed, and an enormous success.") The web browser you're using, the OS, most of your applications, most embedded software, the software on your router, the software on your ISP's router, the software on your game console, etc., were all written in C (well, or in C++).

For my job, I write in straight C. No libraries, no frameworks, no C++, no nothin'. C is a programming language for Real Men (tm), which means that there's no memory management and you're free to crash your program in various horrific ways. The trade-off for this is speed and size, attributes which give C its staying power - though proper C is losing favor as an application development language to C++, C#, and the like, it's found a second life in embedded applications and other small devices. I also think there's a certain elegance to the syntax - it's a language from an era when you didn't have a lot of memory, so statements are terse and lack the cruft of some more modern languages (*cough*C++*cough*). And best of all, no right minded C programmer would use LongVariableNamesLikeThis.

There's no shortage of manuals and documentation for the various incarnations of C, but the best reference is still from the source: The C Programming Language, by Kernighan and Ritchie. This book is so ubiquitous and standard that it's known simply as K&R in the field.
Language: Python
Framework: Pygame/PyOpenGL
Purpose: Game Development


Summary: Pygame is an extensive wrapper of the cross-platform SDL frameworks, specifically geared toward game development. Pygame takes care of loading assets, playing back sounds and music, drawing to the screen, handling keyboard and USB gamepad input, and can even capture live images from webcams on most platforms.

Pygame is also aware of PyOpenGL, the OpenGL binding for Python, and will gladly create a window complete with OpenGL context. Add 3 lines of code and suddenly you can make OpenGL drawing calls. No fuss.

Anyone with some knowledge of Python can create a working, playable 2D game demo in under a week. With minimal effort, this game will run on Windows, Mac OS X, or Linux, even the 3D bits, with no problems.

Other Links and Reading: http://www.pygame.org/news.html
Nightslyr wrote: »
Language: PHP
Framework: None (debating between CodeIgniter and Zend Framework)
Purpose: Web Development

PHP is probably the most ubiquitous server-side language around right now, although its been besieged by others on all sides. It's a simple, but bloated language, which suffers from a convoluted past and a stubborn refusal by the devs to trim the fat.

A lot of its popularity stems from how easy it is for newcomers to get results. This low barrier to entry, and PHP's ability to change from script blocks to blocks of HTML on the fly, means that there's a ton of shitty PHP code floating around out there.

Language: JavaScript
Framework: jQuery (looking for one a bit more complex to play with)
Purpose: Web Development

JavaScript is the most widely used programming language on the planet, and one of the most misunderstood. It doesn't behave like other languages, and this difference leads to confusion and frustration. It runs on the client (web browser), and can be turned off. Despite this, it's the driving force behind most of the interactive web apps out there today. Ever use Google Maps or GMail? Yeah, that's JavaScript.

When people talk about JavaScript development today, they tend to mean AJAX, which stands for Asynchronous JavaScript and XML. Essentially, this is a programming technique that allows portions of a web page to show new data without a complete page refresh. Again, look at Google's stuff for examples in action.

Language: C#
Framework: .NET 3.5
Purpose: Web Development (although it can be used for other purposes - see: XBOX 360 Indie Games)

C# is a managed OOP programming language. The managed part means that you don't need to worry about memory management (although you can still dabble with pointers and dynamic memory if you want). I like the language a lot, as it stresses readability (at least, more than PHP). When code is written correctly, its very easy to read, and seems almost self-evident. Beyond that, it just works.

this is a discord of mostly PA people interested in fighting games: https://discord.gg/DZWa97d5rz

we also talk about other random shit and clown upon each other
Jasconius on
«13456763

Posts

  • SenjutsuSenjutsu thot enthusiast Registered User regular
    edited December 2009
    I hate flex.

    Also boo to Java style com.longname.longthing.package.foo.bar namespaces

    edt: this is clearly Infidel's fault

    Senjutsu on
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited December 2009
    I hated Flex at first. I did a redonkulously huge piece in Flex for a big client and it soured me to it at first, but the rebranding of Flex to Flash Builder 4 brings with it some promising new features that ease some of my frustrations with it.


    What I most displeased about right now is that Adobe seems to be focusing an undue amount of resources into getting Flash to compile to native iPhone applications, which I think is a total waste of time.

    Jasconius on
    this is a discord of mostly PA people interested in fighting games: https://discord.gg/DZWa97d5rz

    we also talk about other random shit and clown upon each other
  • SenjutsuSenjutsu thot enthusiast Registered User regular
    edited December 2009
    My complaints with flex boil down to:

    1) I hate flash. I hate walled-off content boxes in general. So fuck flash, silverlight, java applets et al.

    2) Adobe's tools are beyond shit. Flex/Flash Builder is terribad, and the documentation for their CLI tools, so you can just script the build&deploy, are thinner than an anorexic's fart.

    Senjutsu on
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited December 2009
    But senj it puts pretty pictures on the screen.

    Flash to me seems like the reasonable compromise between raw HTML/JS and ActiveX. We know ActiveX is bad, and like it or not, HTML and JS do not cut it for all purposes.

    I'd take it over Silverlight any day.

    Jasconius on
    this is a discord of mostly PA people interested in fighting games: https://discord.gg/DZWa97d5rz

    we also talk about other random shit and clown upon each other
  • InfidelInfidel Heretic Registered User regular
    edited December 2009
    Horrible OP!
    <3

    If you like I could always do some C/C++ stuff for OP info, I don't have much time right now to do the thread OP myself but I could add some tidbits maybe.

    Maybe I should finish my pointer tutorial! :lol:

    Infidel on
    OrokosPA.png
  • xzzyxzzy Registered User regular
    edited December 2009
    Infidel wrote: »
    Horrible OP!
    <3

    No, it's cool. It talks about python first, which is a surefire way to win.

    Python: what we always wished perl would become.

    xzzy on
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited December 2009
    Anyone can add to the OP what they want.

    I think pointers/threads would be good subjects.

    Jasconius on
    this is a discord of mostly PA people interested in fighting games: https://discord.gg/DZWa97d5rz

    we also talk about other random shit and clown upon each other
  • InfidelInfidel Heretic Registered User regular
    edited December 2009
    Senjutsu wrote: »
    Also boo to Java style com.longname.longthing.package.foo.bar namespaces

    edt: this is clearly Infidel's fault

    The thread title is a good illustration of why the package name stuff is bullshit.

    Because a perfectly valid domain like penny-arcade.com can't be used as an identifier in a programming language.

    edit: Well, I suppose the convention to change hyphens into underscores would work to serve as unique since domains cannot contain an underscore, but it still seems wrong!

    Infidel on
    OrokosPA.png
  • meatflowermeatflower Registered User regular
    edited December 2009
    Anyone want to tell me the best Java IDE? A class I'm taking in a few weeks will be using Eclipse and I'm not a fan, especially for my 10" netbook.

    It may be the best cross-platform out there though, and I was hoping to run the same program on my Windows7 desktop and Jolicloud(Ubuntu) netbook.

    Any recommendations?

    meatflower on
    archer_sig-2.jpg
  • InfidelInfidel Heretic Registered User regular
    edited December 2009
    If you don't need language reference built-in you could just use TextPad or such editors.

    It's what I use for Java if I'm not using Eclipse.

    Infidel on
    OrokosPA.png
  • Jubal77Jubal77 Registered User regular
    edited December 2009
    Notepad++ works well too.

    Jubal77 on
  • NightslyrNightslyr Registered User regular
    edited December 2009
    Language: PHP
    Framework: None (debating between CodeIgniter and Zend Framework)
    Purpose: Web Development

    PHP is probably the most ubiquitous server-side language around right now, although its been besieged by others on all sides. It's a simple, but bloated language, which suffers from a convoluted past and a stubborn refusal by the devs to trim the fat.

    A lot of its popularity stems from how easy it is for newcomers to get results. This low barrier to entry, and PHP's ability to change from script blocks to blocks of HTML on the fly, means that there's a ton of shitty PHP code floating around out there.

    Language: JavaScript
    Framework: jQuery (looking for one a bit more complex to play with)
    Purpose: Web Development

    JavaScript is the most widely used programming language on the planet, and one of the most misunderstood. It doesn't behave like other languages, and this difference leads to confusion and frustration. It runs on the client (web browser), and can be turned off. Despite this, it's the driving force behind most of the interactive web apps out there today. Ever use Google Maps or GMail? Yeah, that's JavaScript.

    When people talk about JavaScript development today, they tend to mean AJAX, which stands for Asynchronous JavaScript and XML. Essentially, this is a programming technique that allows portions of a web page to show new data without a complete page refresh. Again, look at Google's stuff for examples in action.

    Language: C#
    Framework: .NET 3.5
    Purpose: Web Development (although it can be used for other purposes - see: XBOX 360 Indie Games)

    C# is a managed OOP programming language. The managed part means that you don't need to worry about memory management (although you can still dabble with pointers and dynamic memory if you want). I like the language a lot, as it stresses readability (at least, more than PHP). When code is written correctly, its very easy to read, and seems almost self-evident. Beyond that, it just works.

    Nightslyr on
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited December 2009
    Does anyone have any experience with game engines?

    I have a good design idea for a 2d or 3D isometric multiplayer game... I could probably go from scratch (it might even be good for me, in learning the essentials), but at least for proof of concept sake, I might want to stand on the shoulders of an engine.

    Also, from scratch, I'm not as confident I could make a Windows port. Hence the engine covering my ass.

    I'm looking at Torque Game Builder, but I hear very negative things about their documentation.

    Jasconius on
    this is a discord of mostly PA people interested in fighting games: https://discord.gg/DZWa97d5rz

    we also talk about other random shit and clown upon each other
  • InfidelInfidel Heretic Registered User regular
    edited December 2009
    I've dealt with Torque on a large project.

    It's not worth it imo.

    I had to hack the graphics engine just to get it to not glitch out with AA turned on and using shaders. And it still wasn't working out.

    I prefer to use "right tool for the job" piece by piece now. Such as Ogre3D for graphics, OpenAL or such for audio, etc. Pick the libraries you need and away you go.

    Infidel on
    OrokosPA.png
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited December 2009
    Infidel wrote: »
    Ogre3D

    :O

    THIS is what I wanted.

    What would you recommend for very basic collision/physics?

    Jasconius on
    this is a discord of mostly PA people interested in fighting games: https://discord.gg/DZWa97d5rz

    we also talk about other random shit and clown upon each other
  • InfidelInfidel Heretic Registered User regular
    edited December 2009
    I usually ended up with my own system but you may want to look into BulletPhysics, it's a crossplatform library for collision detection and physics.

    You can use just the collision detection portion to keep things lightweight if that's all you care about.

    Infidel on
    OrokosPA.png
  • FodderFodder Registered User regular
    edited December 2009
    Someone should write up a brief Haskell thing for the OP. I've used it for a couple of assignments in my programming language design class, and it's pretty fun to use. Might not be terribly intuitive for people that haven't done much stuff with functional languages, but it's well worth learning if you're looking for something new and different.

    Fodder on
    steam_sig.png
  • xzzyxzzy Registered User regular
    edited December 2009
    Jasconius wrote: »
    Infidel wrote: »
    Ogre3D

    :O

    THIS is what I wanted.

    What would you recommend for very basic collision/physics?

    To give submit an option from the 'easy' angle, look at Panda3D. Lets you work in python, you spend less time dicking around with compilation.

    I've look at Ogre3D eons ago.. it's nice, but very serious. You really have to know what you're doing to get any use out of it, and if I recall properly, using ogre locks you into using their coding style to get anything to fit in their framework.

    If you're dead set on using C/C++, try giving Irrlicht a look as well. It has some very nice features. It comes off to me as a middle ground between something like Panda, and something like Ogre.

    xzzy on
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited December 2009
    Honestly the ideal library for me is in raw C, because I am most comfortable with Obj-C, I know that's not really a reality because of the very nature of C.

    I guess I'm going to have to bite the bullet and learn C++.

    Jasconius on
    this is a discord of mostly PA people interested in fighting games: https://discord.gg/DZWa97d5rz

    we also talk about other random shit and clown upon each other
  • ASimPersonASimPerson Cold... ... and hard.Registered User regular
    edited December 2009
    Language: C
    Framework: Aahahahaha
    Purpose: My job

    Summary: C and its descendants (C++/Java/C#/etc.) are the most popular programming languages in the world. (As co-inventor Dennis Ritchie supposedly said, "C is quirky, flawed, and an enormous success.") The web browser you're using, the OS, most of your applications, most embedded software, the software on your router, the software on your ISP's router, the software on your game console, etc., were all written in C (well, or in C++).

    For my job, I write in straight C. No libraries, no frameworks, no C++, no nothin'. C is a programming language for Real Men (tm), which means that there's no memory management and you're free to crash your program in various horrific ways. The trade-off for this is speed and size, attributes which give C its staying power - though proper C is losing favor as an application development language to C++, C#, and the like, it's found a second life in embedded applications and other small devices. I also think there's a certain elegance to the syntax - it's a language from an era when you didn't have a lot of memory, so statements are terse and lack the cruft of some more modern languages (*cough*C++*cough*). And best of all, no right minded C programmer would use LongVariableNamesLikeThis.

    There's no shortage of manuals and documentation for the various incarnations of C, but the best reference is still from the source: The C Programming Language, by Kernighan and Ritchie. This book is so ubiquitous and standard that it's known simply as K&R in the field.

    ASimPerson on
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited December 2009
    C++ was my first language, so I have a very intense love/hate relationship with it. However, we really just used "C with classes", so C++'s real pros didn't reveal themselves to me until I finally managed to dump my imperative programming habits.

    As for 3D engines, I just did my own for DD7, which I don't recommend doing. Irrlicht is good, but it seems a bit "stiff", if you know what I mean. It's geared toward making a Quake clone, and if that's not what you want you'll have more work to do. Still good, though.

    Ogre3D is a bit better, but I haven't tried it in nigh on 3 years. It's also more verbose in the excessively OO Java style, but I cope with that better than excessively C style, so YMMV.

    Edit:
    ASimPerson wrote: »
    And best of all, no right minded C programmer would use LongVariableNamesLikeThis.
    Oh, you're one of those, are you? The code I work with looks an awful lot like VFRG+TRCP/LABT+INST. Even provided context, I still have no idea what we're calculating here!

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited December 2009
    I'm aiming for either 2D or isometric 3D... it's not like I'm shooting for Assassins Creed 2 or anything.

    Jasconius on
    this is a discord of mostly PA people interested in fighting games: https://discord.gg/DZWa97d5rz

    we also talk about other random shit and clown upon each other
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited December 2009
    Jasconius wrote: »
    I'm aiming for either 2D or isometric 3D... it's not like I'm shooting for Assassins Creed 2 or anything.

    Is that directed at my Irrlicht comments? If so, what I meant was not that the framework is not powerful, but that it is out-of-the-box intended for a FPS-style game. There are even classes specifically for creating crates.

    What I liked about Irrlicht is that it came with both graphics and collision support.

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • CidonaBoyCidonaBoy Registered User regular
    edited December 2009
    Hi Guys

    I want to learn a programming language, I have asked two programming friends of mine, one recommended C, the other recommended Java. All I really want to do for now is amend some .CSV files (Swap around columns, insert and delete some product codes) to allow bulk import of customer data into our system (A GUI would be nice too, only a few buttons). Basically automate some of the boring stuff I do each day. :)

    I have never programmed before, and am probably that guy tech support tell stories about. Any recommendations about what language to start with? Whatever I choose, no doubt I'll be back to harass ye later. ;)

    EDIT: Forgot, if its any help. I have XP on my computer at work, OSX and Ubuntu on my lappy at home. :)

    CidonaBoy on
  • Donkey KongDonkey Kong Putting Nintendo out of business with AI nips Registered User regular
    edited December 2009
    Language: Python
    Framework: Pygame/PyOpenGL
    Purpose: Game Development


    Summary: Pygame is an extensive wrapper of the cross-platform SDL frameworks, specifically geared toward game development. Pygame takes care of loading assets, playing back sounds and music, drawing to the screen, handling keyboard and USB gamepad input, and can even capture live images from webcams on most platforms.

    Pygame is also aware of PyOpenGL, the OpenGL binding for Python, and will gladly create a window complete with OpenGL context. Add 3 lines of code and suddenly you can make OpenGL drawing calls. No fuss.

    Anyone with some knowledge of Python can create a working, playable 2D game demo in under a week. With minimal effort, this game will run on Windows, Mac OS X, or Linux, even the 3D bits, with no problems.

    Other Links and Reading: http://www.pygame.org/news.html

    Donkey Kong on
    Thousands of hot, local singles are waiting to play at bubbulon.com.
  • DaedalusDaedalus Registered User regular
    edited December 2009
    Language: C++
    Framework: OMG CORBA/OMG DDS
    Purpose: Middleware for embedded systems.

    C++ is a giant ball of shit. It's unique (as far as I've seen) in that all of its problems help reinforce other problems. (For example, the lack of real compile-time encapsulation means you need to recompile frequently, which wouldn't be so bad except that the astoundingly complicated grammar makes compile times really long, which wouldn't be so bad except...). Don't get me started on what passes for exception handling. The language was formed when somebody took C, a quirky but useful and popular language, and duct-taped shit to it until it was too bloated to move. The language will continue to surprise you, no matter how much experience you have with it (this is not a compliment). Basically, if you are starting a new project, try to avoid C++.

    Still, sometimes it's the only viable option for a project. Maybe you're working where performance is really important, but the codebase is too large to just use C. Maybe you're working on a middleware layer where the customer wants to use C++. Or whatever, sometimes you just have to use it. When you do, try and keep it simple. Approach features that you've learned about with the attitude "do we really need to use this, or is there a simpler way to accomplish what we're trying to do?", and not "Wow, we can use all this complicated bullshit to create code that can never be maintained by a human being, ever!" If you dive off the deep end into template metaprogramming or something, you're probably in trouble.

    Anyway, for a "framework" up there, we've got CORBA and DDS. CORBA was a mechanism for calling methods in different languages on different systems or whatever in a way (mostly) transparent to the programmer. It failed in the enterprise arena, but embedded systems are the technology of yesterday, today so we're only just now starting to realize how bad an idea it is. DDS, on the other hand, is pretty cool; it's an API for data transfer between programs and the implementation we have is pretty nifty and has lots of useful features. Unfortunately, the implementation we have is closed source and costs $TEXAS anytime we need the owners to get the slightest damn thing done ($$$$$ to compile it with different goddamn flags, for instance) but hey, that's above my pay grade; I'm in the trenches and not planning "product strategy" or whatever language it is that managers speak.

    Daedalus on
  • StarfuckStarfuck Registered User, ClubPA regular
    edited December 2009
    Language : AS3/Python/C#

    I'm a Flex/AS3 guy. Not a trained programmer, a geographer that just fell into doing this.
    I do some C# and Python as they are used as part of the main tools I work with. I need to brush up on my javascript skills, in particularly using dojo, and my C# is rusty at best. Right now, I'm in framework junkie mode, especially Swiz and Robotlegs.

    At the moment, I'm playing catch up to the rest of you folks with CS backgrounds, so I'm going over every OOP, Design Pattern book I can get my hands on just to ingrain basic concept stuff into my head.

    Starfuck on
    jackfaces
    "If you're going to play tiddly winks, play it with man hole covers."
    - John McCallum
  • lazerbeardlazerbeard Registered User regular
    edited December 2009
    Language: C/C++/HLSL
    APIs: I know the DirectX API pretty well, and I've done some stuff with OpenGL as well.
    Purpose: Graphics engine for games, cloth sim, school projects

    I'm a senior at DigiPen, I was the graphics programmer for this game. Though the game is submitted, I continue to research new techniques for fun. I built the graphics engine using the DirectX API, so if you have any questions on graphics implementation techniques, or the math behind it I'd like to think that I can be of some help there. I actually love talking about graphics techniques, so if anyone's got questions at any level I'm always game. I've also got some experience working on game engine architecture, some AI, and of course general C/C++ programming practices. I also wrote some of the tools for our game, a level editor in MaxScript(Terrible, terrible language, why do they make me use parenthesis like curly braces?) and a material/particle/composite object editor in Managed C++ (I just pulled everything into native code, worked with it in my traditional way, then put it back into managed code to interface with the forms)

    My favorite language has to be HLSL, has I've stated in the old thread. It's so specialized, and the shaders are so compact that it's distilled to the part of programming I love the most. You're limited by the amount of memory you have available (just a few registers per vertex, and some global constants you can send) and by the processing power available (remember this code will run on every vertex you send, or every pixel you shade depending on if you're in the Pixel Shader or the Vertex Shader) so these things have to be short, sweet, and use clever tricks to get the job done efficiently and correctly. There's little management to be done, just inputs, a problem to solve, and expected outputs. Plus the end result is usually awesome.

    Of course, being as fun as it is to write new shaders, that was about 5% of what I actually got to work on. most of the time goes to good ol' resource management, scene management, and setting up the architecture to accommodate rapid iterative development (stuff like tools, loaders, etc).

    lazerbeard on
  • zilozilo Registered User regular
    edited December 2009
    Language: C++
    Platform: SAGE
    Purpose: Fixing bugs on C&C4

    Anyone have questions about what it's like to be a software developer in the game industry? I'd be happy to answer. I've worked on quite a few systems in SAGE, an engine that's shipped a crapload of games on PC/360/PS3, and prototyped a bunch more that will never see the light of day.

    zilo on
  • DaedalusDaedalus Registered User regular
    edited December 2009
    SAGE is the Generals engine, right? Man, I loved modding Generals back in the day. Never got into the mod scene for C&C3 or RA3, though.

    Daedalus on
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited December 2009
    Okay, I have another PHP best practices question now that I actually have everything working.

    I have a "secured" config.php file above the web root, and I want to store passwords and things there. Is it acceptable to do something like define(DB_HOST,'localhost') and just use DB_HOST / USER / PASS to instantiate my Database class? It seems more natural than my previous DBConfig::$host = 'localhost' nonsense, but my experience with C[++] has taught me to fear and avoid any macro-like constructs.

    Thoughts?

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • InfidelInfidel Heretic Registered User regular
    edited December 2009
    templewulf wrote: »
    Okay, I have another PHP best practices question now that I actually have everything working.

    I have a "secured" config.php file above the web root, and I want to store passwords and things there. Is it acceptable to do something like define(DB_HOST,'localhost') and just use DB_HOST / USER / PASS to instantiate my Database class? It seems more natural than my previous DBConfig::$host = 'localhost' nonsense, but my experience with C[++] has taught me to fear and avoid any macro-like constructs.

    Thoughts?

    You don't use any #defines in C for constants ever?

    Doing it that way in PHP is pretty common and I don't really see any issues arising with it. It's not going to ever be pretty, it's intentionally supposed to be MAGIC REFERENCE so that you can set those values in an outside secured location.

    One reason you may want to do it with class encapsulation instead of a constant is that you could then undefine/redefine the variables after you connect to the DB. This protects against injection attacks that try to echo back the DB server info and password. Set the variables, connect to DB, clear the variables.

    Infidel on
    OrokosPA.png
  • Alistair HuttonAlistair Hutton Dr EdinburghRegistered User regular
    edited December 2009
    Senjutsu wrote: »
    I hate flex.

    You can't hate Flex, only get unbelievably frustrated with it's flaws. For everything it makes incredibly simple , beautiful and abstracted (data binding) it makes some horrible and disgusting (data visualisation library). I wrote my first commercial game in Flex (hint, see sig) and it simply wouldn't have got done without all the heavy lifting Flex did for me. You've got to admire it's spunky can do attitude and it's beautiful implementation of e4x, seriously, that shit makes XML trivial. You can loathe and detest trying to use a checkbox as an item renderer in a list or the fact that you can't sort time-as-millisconds using the built in sort function because of an overflow error in the native language sort implementation in the Flash player.

    Alistair Hutton on
    I have a thoughtful and infrequently updated blog about games http://whatithinkaboutwhenithinkaboutgames.wordpress.com/

    I made a game, it has penguins in it. It's pay what you like on Gumroad.

    Currently Ebaying Nothing at all but I might do in the future.
  • templewulftemplewulf The Team Chump USARegistered User regular
    edited December 2009
    Infidel wrote: »
    You don't use any #defines in C for constants ever?

    Doing it that way in PHP is pretty common and I don't really see any issues arising with it. It's not going to ever be pretty, it's intentionally supposed to be MAGIC REFERENCE so that you can set those values in an outside secured location.

    One reason you may want to do it with class encapsulation instead of a constant is that you could then undefine/redefine the variables after you connect to the DB. This protects against injection attacks that try to echo back the DB server info and password. Set the variables, connect to DB, clear the variables.

    Luckily, I've never been forced to work in pure C, as void* is an abomination unto the lord. I usually use const variables, enums, etc. to track those kinds of things. Part of it is because I've seen some truly awful things done with text-replace macros. In fact, the language I use at work has no concept of functions. If you want to modularize your code, you have to write it as a macro. Of course, there are macros that take up their own files, and macros that are written into program files as if they were functions. So, the smaller versions are called "micros". ... I think I just vomited into my mouth a little.

    Anyway, for the class encapsulated information, would you use a static function to fill out some static class members, then call that static function from /../../dbconfig.php?

    templewulf on
    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • zilozilo Registered User regular
    edited December 2009
    Daedalus wrote: »
    SAGE is the Generals engine, right? Man, I loved modding Generals back in the day. Never got into the mod scene for C&C3 or RA3, though.

    Yep, the engine began its life with C&C Generals though it's gone through quite a few major rewrites since then (new data pipeline, at least one full renderer swap, new UI/shell, all the extra console stuff, etc), plus every game we build with it adds a host of new gameplay features. The new pipeline makes it harder to mod, sadly, though it makes our lives so much easier than the old text-based setup.

    zilo on
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited December 2009
    zilo wrote: »
    Daedalus wrote: »
    SAGE is the Generals engine, right? Man, I loved modding Generals back in the day. Never got into the mod scene for C&C3 or RA3, though.

    Yep, the engine began its life with C&C Generals though it's gone through quite a few major rewrites since then (new data pipeline, at least one full renderer swap, new UI/shell, all the extra console stuff, etc), plus every game we build with it adds a host of new gameplay features. The new pipeline makes it harder to mod, sadly, though it makes our lives so much easier than the old text-based setup.

    oh shits... SAGE is a descendant of the engine that made Earth and Beyond... the best game in the history of ever.


    zilo can you make Earth and Beyond 2

    ill pay you like 100 dollars

    Jasconius on
    this is a discord of mostly PA people interested in fighting games: https://discord.gg/DZWa97d5rz

    we also talk about other random shit and clown upon each other
  • InfidelInfidel Heretic Registered User regular
    edited December 2009
    templewulf wrote: »
    Infidel wrote: »
    You don't use any #defines in C for constants ever?

    Doing it that way in PHP is pretty common and I don't really see any issues arising with it. It's not going to ever be pretty, it's intentionally supposed to be MAGIC REFERENCE so that you can set those values in an outside secured location.

    One reason you may want to do it with class encapsulation instead of a constant is that you could then undefine/redefine the variables after you connect to the DB. This protects against injection attacks that try to echo back the DB server info and password. Set the variables, connect to DB, clear the variables.

    Luckily, I've never been forced to work in pure C, as void* is an abomination unto the lord. I usually use const variables, enums, etc. to track those kinds of things. Part of it is because I've seen some truly awful things done with text-replace macros. In fact, the language I use at work has no concept of functions. If you want to modularize your code, you have to write it as a macro. Of course, there are macros that take up their own files, and macros that are written into program files as if they were functions. So, the smaller versions are called "micros". ... I think I just vomited into my mouth a little.

    Anyway, for the class encapsulated information, would you use a static function to fill out some static class members, then call that static function from /../../dbconfig.php?

    I always have a start.php which loads all the modules I write for a site, sets up the DB, etc. so that my page files don't have to have many references that may change throughout them all. It just looks up it's own path and loads the other files relative to itself, starts the auth module, cookie settings, open the DB, etc.

    You could simply have class variables in a dbconfig.php file that are assigned directly, and then in your DB open code just reference those followed by blanking them.

    Infidel on
    OrokosPA.png
  • zilozilo Registered User regular
    edited December 2009
    Jasconius wrote: »
    zilo wrote: »
    Daedalus wrote: »
    SAGE is the Generals engine, right? Man, I loved modding Generals back in the day. Never got into the mod scene for C&C3 or RA3, though.

    Yep, the engine began its life with C&C Generals though it's gone through quite a few major rewrites since then (new data pipeline, at least one full renderer swap, new UI/shell, all the extra console stuff, etc), plus every game we build with it adds a host of new gameplay features. The new pipeline makes it harder to mod, sadly, though it makes our lives so much easier than the old text-based setup.

    oh shits... SAGE is a descendant of the engine that made Earth and Beyond... the best game in the history of ever.


    zilo can you make Earth and Beyond 2

    ill pay you like 100 dollars

    It is indeed. Some of the guys here worked on it, and some of the (way old and unused) file i/o libraries have comments that say "EaB beta 2" on them.

    I miss Earth and Beyond :(

    zilo on
  • elliotw2elliotw2 Registered User regular
    edited December 2009
    So, I'm planning on relearning Python, and I'm wondering if I should stick with 2.x, or go to 3.0. I know that 2.x has more modules and such, but 3.0 is more likely to be usable in a few more years without trouble

    elliotw2 on
    camo_sig2.pngXBL:Elliotw3|PSN:elliotw2
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited December 2009
    zilo wrote: »
    Jasconius wrote: »
    zilo wrote: »
    Daedalus wrote: »
    SAGE is the Generals engine, right? Man, I loved modding Generals back in the day. Never got into the mod scene for C&C3 or RA3, though.

    Yep, the engine began its life with C&C Generals though it's gone through quite a few major rewrites since then (new data pipeline, at least one full renderer swap, new UI/shell, all the extra console stuff, etc), plus every game we build with it adds a host of new gameplay features. The new pipeline makes it harder to mod, sadly, though it makes our lives so much easier than the old text-based setup.

    oh shits... SAGE is a descendant of the engine that made Earth and Beyond... the best game in the history of ever.


    zilo can you make Earth and Beyond 2

    ill pay you like 100 dollars

    It is indeed. Some of the guys here worked on it, and some of the (way old and unused) file i/o libraries have comments that say "EaB beta 2" on them.

    I miss Earth and Beyond :(

    you have no idea how tantalizing that is to me

    Jasconius on
    this is a discord of mostly PA people interested in fighting games: https://discord.gg/DZWa97d5rz

    we also talk about other random shit and clown upon each other
Sign In or Register to comment.