Allegro's relevance makes me happy
Bruce Perry

Background

I clearly remember my journey into the world of Allegro. Up until 1999, I was using QuickBASIC with a few assembly language routines for key state detection, sprite plotting and a few other things. I'd tried C once but couldn't do anything except a boring console app, but I think I started to hit QuickBASIC's real-mode memory limits and thought it might be worth looking into C again. I found DJGPP and, with that (via the zip picker), Allegro. My first version of Allegro was version 3.11, and it had all my assembly language routines, and much, much more, already implemented. I wasn't sure whether to be happy or sad about this.

Nevertheless, I used it to make some fully-fledged games such as Line Wars and Rock 'n' Spin. I joined the Allegro mailing lists and was able to contribute some fixes and improvements of my own; there was something to do with off-by-one polygon rendering, and something else to do with colour maps, I seem to recall. While looking for somewhere to put my games, I came across the emerging Allegro Games Depot, which soon became Allegro.cc, and posted a rather embarrassing advert for Rock 'n' Spin in the main news column. (I was trying to sell it as Shareware at the time with no knowledge of marketing; no one bought it or probably even found it.) After a while, Matthew put the current forum discussions in the left-hand column, and I met more fun people like Sp0oN and Nicholle.

Thanks to Allegro, I even started writing a Portal-based 3D engine, complete with editor. I had tried Half-Life once on someone else's computer and knew I could create better input controls. My engine went on to be a very popular game. OK, maybe not. Actually I ran into serious performance problems, possibly as a result of my decision to build everything up from tetrahedra and treat every single tetrahedron face as a portal, with no optimisations for adjacent tetrahedra. I could probably do a better job these days, if such a style of engine were still relevant! (Actually I don't even know - maybe it still is?)

I notice Steve++ had quite a similar experience.

The point of this post

I just wanted to say I still occasionally find time to work on a game at home, and I absolutely use Allegro to do it. While Allegro 4 (and perhaps the software-rendered, 256-colour days in general) had a certain charm that I sometimes miss (who remembers the grabber?), I do think Allegro 5 is a good modern-day equivalent, in the sense that it makes it really easy to develop for traditional PC-shaped things without neglecting any minority groups (you know - the ones with X's in their names), at a low enough level that you can really be creative with the implementation and make your game look distinctive. (Case in point: I wonder how many of these quick game-making frameworks people talk about could have led to Braid.)

Allegro is great, and it continues to make progress. It may not be very well known, but they say it's all about marketing. When people come to the forums and see a thread about "Allegro's irrelevance", they think, "Oh, is that what people think? Maybe it's true." But now they'll see a thread about "Allegro's relevance" instead, and they'll think Allegro is worth talking about.

So, whoever said it's all about marketing but didn't post this thread (instead of me), you have my permission to kick yourself.

By the way, the fact that I can write my code in D these days (having now used Java a lot and realised just how much time C and C++ waste) makes Allegro even better.

Go Allegro! :D

Thomas Fjellstrom

TL;DR[1]

References

  1. Ironically I did read it. All of it.
RickyLee

I see what you did there :)

Erin Maus

I'm porting my game over to D using SiegeLord's DAllegro5 wrapper. So pretty; I cry tears of joy :'(.

Karadoc ~~

When people come to the forums and see a thread about "Allegro's irrelevance", they think, "Oh, is that what people think? Maybe it's true." But now they'll see a thread about "Allegro's relevance" instead, and they'll think Allegro is worth talking about.

I think this is one of the fundamental weaknesses of forums as a form of communication. Chatter is what puts threads at the top of the page; and the relative strengths of threads is not taken into account.

When someone posts something controversial, it tends to start a long running argument which stays at the top of the forum for a long time, gaining a lot of publicity. This can happen even if there is only one person supporting one side of the argument against the rest of the forum memebers. That one person's voice is made unproportionally loud.

When someone posts something that most people agree on, it can be held up for a little while by people posting trivial things like "I agree", but ultimately it will gain less air-time than the controversial posts. And when someone posts a complex argument that not many people have the time or skills to respond to - not many people will respond, and so again the thread falls off the top of the forum.

(I suppose reddit is pretty popular because it solves the problem I'm describing - but reddit has different problems instead.)

furinkan

Used A5 and C on my programming final, which had to be presented. Didn't run very well on Win64 come to find out (due to MingW32 nuances), but the very concept and the fact that it DID run was enough to blow most other projects out of the water.

Also, I've been lurking throughout the entire other thread, and I think Allegro is very relevant. Its relevant to me, and that's what matters. Who cares about SDL? Haters gonna hate! ;)

Working hard designing a top-down-action-RPG engine, which Allegro 5.X will be the base for. I plan to work on the ^Allegro^ wiki a smidgen, if I ever get internet at home.

Thanks for the intuitive, fast library!

Johan Halmén

who remembers the grabber?

Grabber and the built-in GUI are two reasons why I still use A4. Though I don't code very much anymore.

Peter Wang
furinkan said:

Who cares about SDL?

SDL is not the enemy. (I know that was in jest)

Bruce, I'm quite glad to hear you've tried A5!

beoran

Well, I'll also join in with the chorus: Allegro , and certainly Allegro 5 are great libraries. Well fleshed out, clean, and easy to use for people who know their C. I, for one, am very grateful for Allegro.

Furinkan, as I said in the other thread, if plain C and mruby are fine with you, we could cooperate on such an RPG engine. And Chipmunk is ideal for good collision handling and physics for action based games.

Bruce Perry

SDL is not the enemy.

Yes they are! Their licence doesn't allow us to steal their code without attribution. That makes them the enemy.

And yes, please do pick up the framework planning here - it'll look better for Allegro to have this thread survive instead of the other one :)

weapon_S
furinkan said:

but the very concept and the fact that it DID run was enough

You made me laugh >_<
If you want to talk about making an Allegro framework...

There is one kind of "framework" I'm occasionally daydreaming about. It's actually a programming environment for kids. It's supposed to use a "least context semantics" programming language I've doodled a bunch of. The language would have named return values, ECMA like classes, and knowledge of the call stack (I think that has some fancy name). The environment would feature a text output, and a graphics output that supports some primitives. I don't think I would expose Allegro, in favor of a system that uses "viewports". (Maybe I'm too influenced by QBasic.) And that's all I have on paper :-[

Everybody spout his random ideas brainstorm. ;)

Matthew Leverton

I task Mr. Perry with playing us a happy song to boost morale. >:(

Kris Asick

Over the next three years, provided I don't suffer an untimely fate and the Vogons don't decide to start building their hyperspace bypass through our solar system, I'll be making and adding FOUR commercial products to the roster of Allegro 5 games. ;)

I did indeed try to build a game engine for Allegro 4 at one point. My thinking was that having a game engine would simplify the process of game making immensely. I got about half-way done when I realized that, even if I finished this engine, it would only cut down development time of my projects slightly. :P

Instead, what I do now is: When I develop something that's generic enough to benefit more than just the game I'm working on, like a new timing system or an extremely useful mathematical function, I stuff it into its own independent code file which I can then copy and paste into any project I work on. At present, I have five such cpp/h file pairs:

g-rand.cpp/h -> My own pseudo-random number generator
g-time.cpp/h -> My own timing routines including interpolation calcuations
g-gui3.cpp/h -> The third revision of my very basic (but functional) GUI
g-frag.cpp/h -> Fragment shaders
g-misc.cpp/h -> Everything else like math functions, string functions, etc.

I also had a g-idle2.cpp/h pair for awhile for doing accurate idling in Allegro 4, but since Allegro 5 doesn't have to worry about busy waits it's been rendered obsolete. ;)

Johan Halmén

it'll look better for Allegro to have this thread survive instead of the other one

Ok. Who will win the 2014 FIFA World Cup in Brazil? What is it with atheists? Why do people still insist on using C++ instead of just plain C?

Matthew Leverton

Women. Guns. >:(

Kris Asick

Why do people still insist on using C++ instead of just plain C?

I use both in tandem; What does that make me? ;D

Neil Roy

Wow, your experience sounds almost identical to mine. I was using QuickBASIC and started to run into it's limits. Then I found DJGPP and a book called "QBASIC TO C" which helped me convert over (even though the book got bad reviews, it helped me immensely). I started to write my own library for C with various VGA graphics functions etc until I found Allegro (I think Allegro 2). Like you, I was sort of saddened, because my little library was starting to take shape. But that went away fast when I started programming with Allegro.

Looking back at where Allegro started and now with some of the stuff we can do with Allegro 5, it's come a long ways thanks to the dedication of some gifted programmers.

Why do people still insist on using C++ instead of just plain C?

I still program in C. Specifically, C99, although I recently learned about the C 2011 standard and may start using it. I am not a fan of C++, I think it's a lot of bloat.

P.S: I still love programming using Allegro 5 for the PC. I have had a friend bugging me to make games for Android for $$$. I enjoy programming for the PC, using Allegro. I am working on something right now with it.

The only thing that has been slowing me down with development is age I think. My enthusiasm isn't the same it used to be + various other life issues.

bamccaig

I think that Allegro is one of the best kept secrets. It is a very simple and capable library. Thanks to a relatively small active community I think that Allegro has developed one of the most friendly and helpful communities that there are (and I'm not the only one to think so; over the years I have seen several people remark the same). Honestly if there was suddenly a hoard of iOS or Android developers flooding the forums here I imagine the community would suffer. It's not possible to keep up with thousands of people at once. There's no time for that. As it is I sometimes get overwhelmed and can't keep up with interesting threads.

As for thread influence, anybody making a decision based on thread titles is judging a book by its cover and we all know the wisdom there. Unless you follow a thread you really don't know what it's about or what is being discussed (we're infamous for finishing with one topic and spiraling into branch topics). I think those super threads are also a part of what makes our community so strong. We spend so much time arguing with one another that we get to know each other pretty well. It allows us to identify and recognize each other more easily.

"Relevance" is irrelevant. Allegro exists because of the Allegro community, which will remain strong indefinitely as long as we all stick around to participate.

Thomas Fjellstrom

I stuff it into its own independent code file which I can then copy and paste into any project I work on

I'd personally turn it into a static library. And share the library between projects, so you don't have to maintain several different copies.

RickyLee
bamccaig said:

Thanks to a relatively small active community I think that Allegro has developed one of the most friendly and helpful communities that there are (and I'm not the only one to think so; over the years I have seen several people remark the same)

People say the same thing over at Leadwerks.

Quote:

I think that Allegro is one of the best kept secrets.

It's like a small hole in the wall coffee shop that you may find. Some people just like being in the minority, like fighting against the "man". When that coffee shop grows and starts gaining popularity those people all of a sudden don't like it anymore, even if the core of the coffee shop is the same.

furinkan
Quote:

Women. Guns. >:(

Ok. Who will win the 2014 FIFA World Cup in Brazil? What is it with atheists? Why do people still insist on using C++ instead of just plain C?

This thread is sure to become quite the lulzbucket here soon. ;D

This forum is oddly like an internet coffee shop! :o But that's part of its charm, there isn't thousands of squabbling masses and we don't have to divide the forum into sections and assign moderators to keep the sheeple in check. Its a small, friendly community, which is why I've just hung around for the past 4-5 years. I even miss people when I don't see their posts for a while! (*cough* Mark O, Amarillion, verthex, type568, piccolo, et al. cough)

beoran said:

Furinkan, as I said in the other thread, if plain C and mruby are fine with you, we could cooperate on such an RPG engine. And Chipmunk is ideal for good collision handling and physics for action based games.

@beoran:
You'd have to give me a good reason to program in C. I don't think I'm bamf enough to program in straight C. ;D I haven't done any coding at all on mine, I've just been white-boarding a bunch of algorithms, planning file format requirements, working out the layering system, researching libraries (which you have helped immensely with in the other thread), yada yada.

I explained mine as an RPG, but in reality that was just to explain it better without blabbering about details. I'm actually planning a LOZ: Four Swords type engine. I wasn't even going to consider a single player "campaign".

Currently, I'm writing a program to rip unique tiles out of screenshots, compensating for flipping. I could just go to The Spriters Resource, but the tiles are never in a format usable by a program. :-/

Dizzy Egg

Allegro 5 makes me sexually aroused; I'm not sure if that helps anyone.

beoran

Furinkan: If you're not "bamf enough" for C, then I fear C++, which is far more complex, will be a disaster. And there you have one good reason to use C. :) Apart from the fact that you have to be a bit more explicit in C, and do a bit more manual work, it's a much simpler and straightforward language. Single or multiplayer isn't that much different I think, the engine I have could become useful to other people too as it develops.

Dizzy Egg

I dunno....C++ is more helpful after a couple of weeks solid practice...I say if you're good in C go C++, it's 2013.

furinkan

@beoran:
What I mean is, I'm used to classes/Objects in higher languages like PHP/JS. I like the organization that a little OOP can give, and I like the terseness. I'm alright in C++. I'm just curious as to why I should only use a subset of C++ (that is: C), when the compiler eats most of the overhead anyway.

Kris Asick

I'd personally turn it into a static library. And share the library between projects, so you don't have to maintain several different copies.

I've had bad experiences with sharing libraries like that, since if you update the library for a current project, then go back and work on a previous project, you may've broken the functionality of the library for that particular project. As such, I prefer to maintain separate versions for each of the projects I work on, which is fine since I rarely work on more than one project at a time anymore.

Dizzy Egg said:

I dunno....C++ is more helpful after a couple of weeks solid practice...I say if you're good in C go C++, it's 2013.

The thing I like about C and C++ is that they mix together harmoniously. ;D

I mean, my programming style is basically what you would get if you took C and simplified it using C++ interfaces and adding a little OOP in the process, but not a lot. Just enough to sort things out better.

I comment the heck out of my code anyways. Not just for my own sake if I go a period of time without coding because I'm working on other aspects of a project, but also to remind myself what I'm trying to do with certain parts of my code.

All that said, if I need some quick calculations or algorithms tested, I still resort to QBASIC. ::)

Paul whoknows

Why do people still insist on using C++ instead of just plain C?

OOP? there is not good reason not to use it. While OOP is perfectly possible in C, it's just not the right tool for the job ;D

Matthew Leverton

2.8 Million page views at a.cc over the last 12 months.

The most popular thread continues to be no contest, working its way up to the sixth most visited page on the entire site. So relevance? That page alone potentially helped 45,207 people.

Here's where a little marketing comes in to play. If I were to actually explain what Allegro is on that page, there's 45K possible new Allegro users. 8-)

Bruce, where's that tune I asked for? >:(

Thomas Fjellstrom

I've had bad experiences with sharing libraries like that, since if you update the library for a current project, then go back and work on a previous project, you may've broken the functionality of the library for that particular project.

Testing FTW.

I find it far more annoying to deal with varying versions of the same code. I end up expecting something to be in the shared code, but it isn't since It didn't get added to this copy and it annoys the crap out of me :P

Edgar Reynaldo

Hmm. I build all my useful code into libraries and then install and link with them for my other projects. #include "Eagle5.hpp"

And yeah, I think Allegro is still very relevant. 5.1 is making some nice strides. Shaders, video, cool stuff.

Yodhe23

I have used/learnt to use Allegro since the late 90's, and I am amazed how it continues to "grow/evolve".
I think its endurance in the fleeting world of computer technology say tomes about it, and the community it attracts/nourishes.
I've spent five years of my life writing a turn based strategy squad game with Allegro(4), and it has brought me an immense sense of satisfaction as I have been able to manifest a childhood dream to write my own (half-decent, in my eyes) game.
Simply THANKS.

beoran

@furinkan
I've been using C++ as a professional programmer, and my experience is that all in all, it's one step forward and one step back over C. So I want to use classes to organize my code, but to do the memory management now I have to use virtual destructors, constructors, exceptions, templates... And C isn't a subset of C++. It's weaker typing means you can do many things that will give you warnings or errors in C++. So, I choose C as that that works best for me, and gives me the least complexity headaches.

As for OOP, I also use objects, in languages that are truly OO, like, say Ruby (or smalltalk, or objective C). C++ isn't OO, just ask Alan Kay who invented the term: http://programmers.stackexchange.com/questions/46592/so-what-did-alan-kay-really-mean-by-the-term-object-oriented. C++'s classes are simply suitable for proper OO. And the problem is most people don't even realize it!

In fact, I'd love to be able to use Objective C, to get C with real OOP, but unfortunately when last investigated, there seemed to be problems with the portability, and the license of the Objective C library (Gnustep). But I'll be using mruby as the scripring language so I'll be able to program the higher level part of the game in a proper OOP language. And binding with mruby language is IMO much easier with C than with C++.

So, I do have my reasons, but I'm well aware others may not agree. To each their own. :)

Mark Oates

And yeah, I think Allegro is still very relevant. 5.1 is making some nice strides. Shaders, video, cool stuff.

I think adding touch input is a particularly bold move. :)

beoran

More on topic, I'd love to contribute force feedback to Allegro, but to be honest my own project takes priority, so it will be a while before I get anywhere with it.

Johan Halmén

Why do people still insist on using C++ instead of just plain C?

Hahahaha! It worked 8-)
Still waiting for the religious and the football sidetracks.

james_lohr

That's the biggest issue with Allegro. C and C++ are dated, and the bindings for modern languages (e.g. C#) are crappy compared to stuff that was actually built for modern languages (e.g. OpenTK for C#, or Libgdx for Java).

It's taken me 15 years as a programmer to appreciate what clean code is really about, and C/C++ makes it far too much effort to maintain cleanliness.

bamccaig

I've had bad experiences with sharing libraries like that, since if you update the library for a current project, then go back and work on a previous project, you may've broken the functionality of the library for that particular project. As such, I prefer to maintain separate versions for each of the projects I work on, which is fine since I rarely work on more than one project at a time anymore.

I think you're doing it wrong if the semantics of a function change like that. :P A function should do one thing and the outcome should be well defined in all cases. If you need a similar function with different semantics then it's a different function and should be named differently.

If a previous game happens to work around a bug before it was discovered then I can see it breaking the previous game, but that will only affect the game if the game is rebuilt against the newer version of the library. You can have multiple versions of the same library (even dynamically linked, let alone statically linked). :P If you decide that you need newer functionality from the library in the old game then it's time to remove the workarounds in the old game for the now fixed bugs. The important thing is that going forward all bug fixes for the shared code are in one place.

At j0rb I introduced "class libraries" in an attempt to begin sharing code between projects to save us time and effort. The brillant(tm) team leader started copying/pasting the class library project into every program "solution". So now we have 3 or 4 copies of the library and each of them has diverged. Why would you do that?! It baffles the mind! Now we never really know how the semantics of the library work because they're different in each project. It doesn't help that the semantics are changed willy-nilly without an understanding of why they were the way they were in the first place... Ugh.

Thomas Fjellstrom

I just have to say, ObjC and its runtime is absolutely horrible. Especially how it treats nil. Don't get me started >:(

Bruce Perry

You could start a company of your own, and be the team leader yourself :)

I've spent all weekend trying to get GDC to work instead of DMD. I've now given up. DMD produces slower code than GDC, but it also produces a much smaller executable, and it works. I've decided to buy the DMD runtime library source and fix the one bug that prompted all this. Now I'm waiting for the automated download instructions, and beginning to think they're probably not automated. What a waste of time!

Bob Keane
ML said:

The most popular thread continues to be no contest,

What now? I have not seriously used Allegro, but from what I've seen, it is not irrelavent. Think of how bogged down your programs would be without Allegro's drawing routines.

Matthew Leverton

ObjC and its runtime is absolutely horrible. Especially how it treats nil.

// valid:
    NSObject *obj = nil;
    [obj performSelector:@selector(wtf_I_am_nothing)];

// crash:
    NSArray *array = [[NSArray alloc] init];
    if ([array objectAtIndex:0] == nil) { }

Bob Keane said:

What now? I have not seriously used Allegro, but from what I've seen, it is not irrelavent.

I'm saying without Allegro, this site wouldn't exist, and those poor fellows would have never found your thread to get the help they needed to launch their careers as excellent software engineers.

Specter Phoenix
Dizzy Egg said:

Allegro 5 makes me sexually aroused; I'm not sure if that helps anyone.

/me puts chasity belt on A5.

I learned ... and then I learned ... errr.. yeah!

Fishcake

// valid:
    NSObject *obj = nil;
    [obj performSelector:@selector(wtf_I_am_nothing)];

// crash:
    NSArray *array = [[NSArray alloc] init];
    if ([array objectAtIndex:0] == nil) { }

I personally like the first one. Having used Objective-C for a year, I grew to hate having to check if an object is null before calling a method. :P As for the second one, isn't it the same case for C++?

// crash:
vector<MyClass *> array;
if (array.at(0) == NULL) { } // throws an out_of_range exception 

// But..
if (array[0] == NULL) { } // undefined according to cplusplus.com

And how is it better to have the array return nil/NULL in this situation?

Matthew Leverton
Fishcake said:

And how is it better to have the array return nil/NULL in this situation?

It's inconsistent behavior. If the array somehow got nil'd out it would not crash. But if the array exists and is empty, it does crash. I fully understand the technical reasons of the behavior, but the split personality can be maddening.

Thomas Fjellstrom
// crash:
    NSArray *array = [[NSArray alloc] init];
    if ([array objectAtIndex:0] == nil) { }

Actually, that's an exception which you can catch and ignore if you see fit.

But yes, it is really annoying. Also annoying is that you can't store actual nil values in containers. Instead you have to deal with NSNull, so now you have to check for nil, AND [NSNull null].... Which is maddening.

Fishcake said:

I personally like the first one.

I hate you.

It's a horrible idea. It papers over fatal errors as if they don't exist, and its hard to track down what went wrong.

NULL/nil values should crash when you try to dereference them. period. It is the only sane option.

Edgar Reynaldo
bamccaig said:

At j0rb I introduced "class libraries" in an attempt to begin sharing code between projects to save us time and effort. The brillant(tm) team leader started copying/pasting the class library project into every program "solution". So now we have 3 or 4 copies of the library and each of them has diverged. Why would you do that?! It baffles the mind! Now we never really know how the semantics of the library work because they're different in each project. It doesn't help that the semantics are changed willy-nilly without an understanding of why they were the way they were in the first place... Ugh.

Hahaha that would make a nice daily WTF. 4 versions of the same library. Nice.

Matthew Leverton

Actually, that's an exception which you can catch and ignore if you see fit.

The nil messaging behavior reminds me of this classic from Visual Basic:

ON ERROR RESUME NEXT

???

Thomas Fjellstrom

Heh. Yeah. I don't even.

Bruce Perry
int checkPassword(String password) {
  try {
    if (password != "bacon")
      throw new SecurityException("invalid username or pasword");

  }finally
  {
    return 0; //fix for reutrn at end of method error
    }
}

...

What? I'm sure this code exists somewhere.

Oh and the stuff I bought came through :) Must ... do ... housework ... ARGH CAN'T RESIST DMD <3 T_T ... work ... tomorrow ... BUT DMD T_T ... :'( [EDIT: slight correction: it's actually the DMC runtime library I bought the source for. The DMD one is open source :) ]

I forgot Matthew wanted an uplifting song! Here:

video

amarillion

By the way, the fact that I can write my code in D these days (having now used Java a lot and realised just how much time C and C++ waste) makes Allegro even better.

I feel the same way. I've started playing with D + allegro 5 now.

One day you wake up, and suddenly you realise what an abomination C++ really is :D

Thomas Fjellstrom

Call me when I don't have to hack the runtime just to get it to work properly ;)

Bruce Perry

In fairness, this is a very obscure bug I'm fixing. DLLs crash during unload if the thread that loaded them has terminated. :)

Fishcake

I hate you.

;D

Thomas Fjellstrom said:

It's a horrible idea. It papers over fatal errors as if they don't exist, and its hard to track down what went wrong.

NULL/nil values should crash when you try to dereference them. period. It is the only sane option.

It's true that this behavior can be the source of hard-to-track bugs. But I've trained myself to always assert the preconditions of my functions (i.e. programming by contract), so I guess I'm safe (for now). :P

amarillion

Call me when I don't have to hack the runtime just to get it to work properly

With D, you'll never get accused of re-inventing the wheel. The wheel doesn't exist yet, so invent away! I'm going to write my own XML library, and after that, my own GUI.

Thomas Fjellstrom
Fishcake said:

It's true that this behavior can be the source of hard-to-track bugs. But I've trained myself to always assert the preconditions of my functions (i.e. programming by contract), so I guess I'm safe (for now).

So you're checking for nil anyway? As you'd do without the nil feature?

So what's the point? :P

Fishcake

So you're checking for nil anyway? As you'd do without the nil feature?

So what's the point?

It's a practice that I carry over across programming languages (C++, C, Objective-C, C#). I was told (from a video lecture) that it's a bad practice to rely on the implementation of a language (might be wrong, because I'm not sure how to word what he said). If one day, Apple decided to change the runtime and make sending message to a nil object crash, I will still keep my assert statements. :)

To be honest, the very reason I like having nil eat my messages is because I use the delegation pattern a lot, and it's more pleasant to write this:

[delegate doStuff];

than this:

if (delegate) {
   [delegate doStuff];
}

Other than the usage above, I agree that the nil behavior results in hard-to-track bugs without proper coding discipline. :)

Thomas Fjellstrom

I've actually had errors happen when I didn't check for the delegate, so I always do now. What can you do ;D

Fishcake said:

Other than the usage above, I agree that the nil behavior results in hard-to-track bugs without proper coding discipline.

IMO that makes it pointless in my eyes. Mistakes happen. And I want to be notified as soon as possible that I've made a mistake, rather than having to hunt down a hard to find condition some place that nils out a value on me.

Matthew Leverton
Fishcake said:

To be honest, the very reason I like having nil eat my messages is because I use the delegation pattern a lot, and it's more pleasant to write this:

Yes, that's appropriate given how Obj-C works. Your delegates should (usually) be weak pointers, or else you'll get circular references that don't want to go away. >:(

Given that the language works the way that it does, it's silly to add nil checks. It's Obj-C, you might as well use it as such.

The reason I don't like it is that it becomes an invisible side effect and it is not immediately clear if nil is an expected behavior or not. In C++ if this crashes, you know (assuming the programmer is not a complete fool) that the bug is that foo should not be null:

this->foo(bar);

Whereas if you have this:

if (this->foo) {
  this->foo(bar);
}

then you know that foo is expected to sometimes be null.

Bruce Perry

...or false, if it were JavaScript or Lua or something. :)

bamccaig

JavaScript doesn't have a -> operator, but ignoring that also "" and the undefined value. :P Maybe also 0, but I forget (I generally don't mix types like that). VBScript is exceptionally special in this regard. You have False, 0, "", Empty, Null, Nothing (object concept of Null) (IIRC). Some of these values are considered equal to one another, and others are not. I don't even play that. I created a library of conversion functions that generally assert a specific type, or Null. The horrific On Error Resume Next is used to recover from type errors within. Then for variables that represent objects I always initialize them to Nothing so they are always either Nothing or an object. VBScript actually becomes kind of sane (albeit, still overly verbose and relatively ugly) once you do something like that. :P

Schyfis

The thing I didn't like about D when I tried it a few weeks back was that there is pretty much no support for it outside the D homepage and official D forums. If you have yourself a cryptic error, you're probably not going to be able to figure it out.

furinkan
bamccaig said:

The brillant(tm) team leader started copying/pasting the class library project into every program "solution". So now we have 3 or 4 copies of the library and each of them has diverged.

Like I've probably explained before, at my place they've been literally copying and modifying similar projects since around 2006. Its to the point where none of the current developers have a good idea how stuff works, because there is no documentation and the guy who wrote most of our code got fired years ago. ;D

My boss just doesn't understand why it takes so long to do 'simple' modifications. Unfortunately, even simple modifications take a long time when you have three layers of code from three different coders using three different coding styles. :-/

Bruce Perry
Schyfis said:

If you have yourself a cryptic error, you're probably not going to be able to figure it out.

There's an element of that, I agree; and Google isn't very good at recognising searches for either 'D' or 'dlang'. On the other hand, the D.learn forum (or newsgroup if you prefer viewing it that way) is very good, full of people ready and willing to help newbies, and the community has a real culture of wanting people to use the language, so they (probably) won't drive anyone away! Also, you do find some D questions and answers on StackOverflow.

[EDIT]
furinkan, why was he fired? For bad code? For enjoying himself with the boss's daughter (who of course still has her job)?

Let's hope they're at least better at coding than the boss's new grandkid :) (No offence to the kid, it's just that he or she is young and probably can't write code yet.)

furinkan

@Bruce Perry:
He was fired for milking his hours. Surfing the net all day, wanking, I donno, but he's long gone and everything was just copied from him.

Funny thing is, boss actually thinks the guys coding is fine. Does this look fine to you? It took me several minutes to discern what he was doing; It never even occurred to me that somebody would solve a problem like that.

<?php
//$due_date is in the format YYYY-MM-DD, as is common in SQL DB's
$date = date('m', strtotime($due_date)).'/'.date('d', strtotime($due_date)).'/'.date('Y', strtotime($due_date));
?>

Bruce Perry

Took me about 30 seconds, but that's under the conditions of being challenged quiz-style with an isolated problem. I can imagine it taking longer when you're in the thick of it all day.

Look on the plus side: if he'd worked all those hours, you'd have even more of that code :)

Matthew Leverton
furinkan said:

It took me several minutes to discern what he was doing;

It took me 0.00001 seconds. And then a few minutes of laughing.

$date = (new DateTime($date))->format('m/d/Y');

Besides the WTF of how he wrote the code, PHP programmers' love for strtotime() and 86400 is comical.

bamccaig

Didn't take me long either. At first it was like blah, but I verified the repeated strtotime expression, and once I did that it was easy to guess what it was doing. I happen to be faced with code like that on a regular basis though i.e., entire server-side pages duplicated to handle a little flag:

if(flag)
{
    /* 300 lines of code */
}
else
{
    /* same 300 lines of code with about 15 bytes difference */
}

I think that's a good measure of a programmer's quality. Show them a snippet of code with some obvious errors as well as redundancies and ask them to fix it. If they get it working without cleaning it up and eliminating the redundant code then thank them for their time and show them the door. >:(

Matthew Leverton

I know this varies a lot depending on language and project, but any function with more than 10-15 lines is probably too big for a team project. A function should do only one thing, and do it well.

Bob Keane
Bamccaig said:

Show them a snippet of code with some obvious errors as well as redundancies and ask them to fix it. If they get it working without cleaning it up and eliminating the redundant code then thank them for their time and show them the door.

I'm probably missing the point due to a hard week's night but, what happened to the old adage "If it ain't broke, don't fix it."?

Arthur Kalliokoski
Bob Keane said:

what happened to the old adage "If it ain't broke, don't fix it."?

Farmers used to plow a certain amount with an ox and small plow per day in medieval times, today we call this amount of land an "acre". They've "fixed" it for one man to be able to plow several hundred acres a day now, so most of us are something besides farmers.

Thomas Fjellstrom

Farmers used to plow a certain amount with an ox and small plow per day in medieval times, today we call this amount of land an "acre". They've "fixed" it for one man to be able to plow several hundred acres a day now, so most of us are something besides farmers.

Ah but something was broken. there wasn't enough food. or money. can never have enough money.

Arthur Kalliokoski

Scarcity is a fact of life. Nobody ever has "enough", except in the eyes of those who have even less. Why wasn't BillyGates satisfied with his first billion of ill-gotten gains?

Thomas Fjellstrom

Why wasn't BillyGates satisfied with his first billion of ill-gotten gains?

Why is he and Warren Buffet giving away most of their money?

Arthur Kalliokoski

Ah, but Gates has already "won" the game, seemingly proving he's not the nerd he really is. And those billions aren't really doing that much good after all, there's a lot of crooks in the world.

furinkan
bamccaig said:

I happen to be faced with code like that on a regular basis though i.e., entire server-side pages duplicated to handle a little flag

Yea. Lots of that too. And my favorite: nondescript includes that execute like three lines of code. I wonder sometimes if he even knew how to declare a function. :-X

It took me 0.00001 seconds. And then a few minutes of laughing.

Keep in mind I've spent a whole day muddling through jewels like that. I thought assuredly, it was doing something majestic! I'm obviously just too new at programming to understand its intricacies. ::) But no, I checked it many times over, and it's just an obfuscated (read: stupid) way to change the date format.

Imagine my surprise. >:(

Anyways, I'm going to veer back on topic, as we have a discussion about greed budding that can take my place. ;D

SDL is not the enemy.

No, its not. But its fun to peg an enemy. If I had internet other than on my phone, I'd be programming constantly.

Samuel Henderson
furinkan said:

Does this look fine to you? It took me several minutes to discern what he was doing; It never even occurred to me that somebody would solve a problem like that.

<?php
//$due_date is in the format YYYY-MM-DD, as is common in SQL DB's
$date = date('m', strtotime($due_date)).'/'.date('d', strtotime($due_date)).'/'.date('Y', strtotime($due_date));
?>

I read the comment first and then skimmed the next line. Knowing this line was likely a date formatting conversion the 'm/d/Y' jumped out at me. As quickly as I skimmed the line (0.000001 seconds... yes, even faster than our Fearless Leader!) I knew exactly what it was doing, even without having to research what strtotime did.

That's not so say what he did was elegant or wasn't a WTF.

AMCerasoli

I use to save data as timestamps, so I would have done $date = date('d/m/Y', $timestamp);

furinkan

I'm pushing to use timestamps more, but I don't have time to rewrite our entire codebase. Everything needs done yesterday, so don't waste any time! But, oh... I still expect PHP gold out of you. ;)

Trezker

Everyone has enough already.
If you're not dying you have enough. If you want anything more you're just greedy. >:(

furinkan

You're right. That fourth slice of pineapple & ham pizza, was just greedy of me. You can have it back, but you'll have to wait a while.

Johan Halmén

Bill Gates got rich by not spending money on ridiculously over priced eyeglass frames.

Arthur Kalliokoski

{"name":"billgates-saves-for-a-lamborghini.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/b\/fb68178f932e8410982c54420c71064f.png","w":550,"h":2185,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/b\/fb68178f932e8410982c54420c71064f"}billgates-saves-for-a-lamborghini.png

furinkan

{"name":"93339552-bill-gates.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/2\/124016adc95afa8488ec38ab2101a9d2.jpg","w":609,"h":480,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/2\/124016adc95afa8488ec38ab2101a9d2"}93339552-bill-gates.jpg
Frozen solid. Just like our products. <3

I decided to switch one of my projects over to python and Allegro 5 before I get too deep into it. I thought: Oh, I don't wanna compile allegro 5.0.9! :'( The most difficult part was downloading the source. I keep forgetting: I'm not on Windows anymore. I can have aptitude do all my work for me.

weapon_S

So there's:

  • C(++)

  • C#(?)

  • D

  • Objective C(?)

  • Python

  • Java

Are those up-to-date?

SiegeLord
weapon_S said:

C(++)
C#(?)
D
Objective C(?)
Python
Java

This list is for A5... answers for A4 are different:

  • C - Obvs

  • C++ - No, but you can use C headers

  • C# - No

  • D - Yes

  • Objective C - Doesn't exist afaik, but you can use C headers

  • Python - When it works... yes

  • Java - Doesn't exist afaik

Also, the newest Humble Bundle appears to have an Allegro 5 powered game: Beat Hazard Ultra.

Thread #612096. Printed from Allegro.cc