|
I'm an ECE major, and I was talking to one of the few programming-oriented fellow ECE guys I know. His focus is embedded systems and bare-metal C, however. He's always talking about how he hates operating systems. He told me the coding philosophy of the place he worked at for his last co-op: 1. All functions take void and return void. 2. All variables are global. He said this made things easier to verify. I wasn't able to express how horrifying that was to hear.
|
# ? May 14, 2011 20:45 |
|
|
# ? May 16, 2024 21:37 |
Well, since it prevents you from writing any kind of re-entrant code, it also effectively prevents you from writing any kind of recursive code. It should be reasonably easy to reason about functions never entering a kind of call loop. When you know that never happens, you can then determine the maximum stack size that can possibly occur, and design memory layout for that. Since everything else is global you should then be able to do some kind of reasoning about total memory consumption.
|
|
# ? May 14, 2011 22:34 |
|
nielsm posted:Well, since it prevents you from writing any kind of re-entrant code, it also effectively prevents you from writing any kind of recursive code. It should be reasonably easy to reason about functions never entering a kind of call loop. When you know that never happens, you can then determine the maximum stack size that can possibly occur, and design memory layout for that. Since everything else is global you should then be able to do some kind of reasoning about total memory consumption. How does it do that? You can easily write a recursive function if you use a global variable as an accumulator and one to keep track of whatever your exit condition is.
|
# ? May 14, 2011 22:37 |
|
from a while back, but:Incoherence posted:I don't think that was quite what that post meant, but the obvious example of an empty catch statement is unit testing a method that's supposed to throw an exception.
|
# ? May 14, 2011 22:43 |
|
Janin posted:from a while back, but: An exception type can be really specific or really general. Yea, you need to check the exception contents for an SQLException, but what can you really do with a NullPointerException? Even then, his code could easily have checked for the mis-constructed state inside the catch block and thrown a fail() there as well.
|
# ? May 14, 2011 22:58 |
|
Geekner posted:An exception type can be really specific or really general. Yea, you need to check the exception contents for an SQLException, but what can you really do with a NullPointerException? Even then, his code could easily have checked for the mis-constructed state inside the catch block and thrown a fail() there as well. I'll cut the first rent-a-coder to specifically swallow NPEs.
|
# ? May 14, 2011 23:51 |
|
Janin posted:from a while back, but:
|
# ? May 15, 2011 00:01 |
|
It's not actual code but rather a language and the fact I have to use it to pass this class For my programming class we have to spend most of a year doing gml (Game Maker Language) because 90% of the dickwits in my class have never done any programming before and get bored with other languages such as delphi "coz you can't make games with them"
|
# ? May 15, 2011 05:44 |
|
Babby didn't like milliseconds so he created a library that parses strings instead. https://github.com/avk/jQuery-Chrono code:
shrughes fucked around with this message at 07:27 on May 15, 2011 |
# ? May 15, 2011 07:23 |
|
Wait, who actually uses Delphi? Wouldn't you want to use Java or C# or something at least?
|
# ? May 15, 2011 07:25 |
|
shrughes posted:Babby didn't like milliseconds so he created a library that parses strings instead. Alright, I'll be that guy. What makes this a horror? OK, it's not implemented how I would have implemented it, adding 1.7KB of someone else's code to your page doesn't seem worth it for what little is gained, and the parsing of strings isn't even done very well: code:
I guess I'm saying I have zero desire to use this guy's code but what's horror-worthy about it? Also setTimeout's arguments are backwards, so at least this guy got that right.
|
# ? May 15, 2011 09:00 |
|
Mostly it's just poorly implemented, I mean your example where having a space in the string causes it to throw an exception is _exactly_ the kind of crap that's going to gently caress with "I'm a designer oh god kill me" crowd. Not to mention the whole point of the thing is that milliseconds are un-natural to set timeouts with, but this 1.7kB of external code isn't enough to let you say "1 minute 45 seconds", though you can use "1.75minutes". Additionally - the problem of turning some string into milliseconds should be separated from the timeout setting and made available to the rest of the environment. jQuery animation durations are specified in milliseconds, for example, if I'm having trouble with setTimeout then surely I'm having trouble with those too. Finally, he clearly hasn't thought about internationalisation $.après("2heures", function(){...});
|
# ? May 15, 2011 10:04 |
|
Why you would choose string parsing over something like code:
|
# ? May 15, 2011 11:58 |
|
e: ^^^ Bored programmer looking for busy work, I suspect. Your solution is too simple to practice TDD with.dazjw posted:Finally, he clearly hasn't thought about internationalisation $.après("2heures", function(){...}); No need, English is the one true programming language. Doc Hawkins fucked around with this message at 18:36 on May 15, 2011 |
# ? May 15, 2011 16:15 |
|
shrughes posted:Babby didn't like milliseconds so he created a library that parses strings instead. Using milliseconds to specify anything larger than a few minutes is the real coding horror. Let me tell you about the time someone did this exact thing, but with days and weeks,
|
# ? May 15, 2011 16:20 |
|
GreatKesh posted:It's not actual code but rather a language and the fact I have to use it to pass this class Someone should educate them. (Comedy option: start them on Inform 7 so that they can complain it's not real programming because it doesn't use {} to delimit code blocks.) (Cruelty option: start them on C++ with OpenGL so that they no longer want to make games, learn how to program, or live.)
|
# ? May 15, 2011 20:38 |
|
ToxicFrog: I was very disappointed that none of those links involved Delphi. Apparently you can write games with it: http://delphigamedev.com/
|
# ? May 15, 2011 23:28 |
|
Doc Hawkins posted:No need, English is the one true programming language. American English, that is gently caress you CSS, the word is "colour"!
|
# ? May 15, 2011 23:51 |
|
bobthecheese posted:American English, that is And it's text-align "centre" too while we're at it I think we're stuck with the "Referer" HTTP header, though.
|
# ? May 16, 2011 00:05 |
|
qntm posted:And it's text-align "centre" too while we're at it Which isn't because American English spells it that way, it's just because the RFC had it that way
|
# ? May 16, 2011 01:07 |
|
Internet Janitor posted:ToxicFrog: I was very disappointed that none of those links involved Delphi. Apparently you can write games with it: http://delphigamedev.com/ I figured you probably could, but I don't know Delphi or any of its libraries, so I stuck to what I know.
|
# ? May 16, 2011 01:32 |
|
TasteMyHouse posted:His focus is embedded systems and bare-metal C Embedded system code is the most horrible code you will see Sometimes variables are named after the registers in memory It is poorly documented, the only thing you have to work with is only the technical manual of the system that some hardware guy wrote 3 years before the software was made The code is litterred with #DEFINE and #IFDEF, so it works on different platforms (literally an embedded system might have 3 kinds of chipsets it needs to work with) Compilers might be terribly written for the chip, they take 5 hours to compile, even running a simple test takes 10 minutes just to start.. I could go on but you get the idea Melted_Igloo fucked around with this message at 12:29 on May 16, 2011 |
# ? May 16, 2011 12:24 |
|
No Safe Word posted:Which isn't because American English spells it that way, it's just because the RFC had it that way It's poetic that a typo is literally built into the HTTP standard. I'm sure that says something profound about the Internet, though I'm not sure what.
|
# ? May 16, 2011 18:46 |
|
Monkeyseesaw posted:It's poetic that a typo is literally built into the HTTP standard. I'm sure that says something profound about the Internet, though I'm not sure what. It says something profound about software in general. APIs, once written, are forever. No, really forever. No, you won't get everyone to update their code. You better be happy with that spec now, because you're going to be living with it for the rest of your life.
|
# ? May 16, 2011 19:01 |
|
Melted_Igloo posted:Embedded system code is the most horrible code you will see That's it, I'll never hate on the "old" .NET 2.0 apps I see occasionally.
|
# ? May 16, 2011 20:38 |
|
Ryouga Inverse posted:It says something profound about software in general. APIs, once written, are forever. No, really forever. No, you won't get everyone to update their code. You better be happy with that spec now, because you're going to be living with it for the rest of your life. @deprecated since Java 1.1 e: Actually, this is one of the things that I liked about Qt when I first used it. Trolltech wasn't afraid to break backward compatibility. At least between Qt 3 and 4. I noticed it when I googled their API documentation and as hard as I tried, the IDE wouldn't autocomplete the methods that the objects supposedly had. Then I noticed I was browsing the the documentation for 3 when I was using 4. Well that's my story. Wheany fucked around with this message at 21:21 on May 16, 2011 |
# ? May 16, 2011 20:41 |
|
Wheany posted:@deprecated since Java 1.1 This sounds great until you realize that it means you have to install Qt 3 and 4 side by side on any machine that you want to run Qt apps for an arbitrary amount of time, because there's always that one rear end in a top hat who wrote his poo poo for Qt 3 and then had the audacity to die or something. I mean, there are arguments to be made for both, but you certainly can't change your API every time you have a whim, and in some cases (like the Internet) you can't ever break backward compatibility. And the problem is that those cases look exactly like the best-case success story that you only dream of. Dessert Rose fucked around with this message at 22:28 on May 16, 2011 |
# ? May 16, 2011 22:26 |
|
Ryouga Inverse posted:This sounds great until you realize that it means you have to install Qt 3 and 4 side by side on any machine that you want to run Qt apps for an arbitrary amount of time, because there's always that one rear end in a top hat who wrote his poo poo for Qt 3 and then had the audacity to die or something. Better to have multiple versioned, depreciable, isolated APIs side-by-side than some organically grown poo poo that can never die.
|
# ? May 16, 2011 23:21 |
|
code:
|
# ? May 17, 2011 04:02 |
|
decarboxylated posted:
It's handy to have that, remember back in '79 when "Two" was legally 3 for a week? Just plannin' ahead. Also, off-by-one errors can be fixed en-mass.
|
# ? May 17, 2011 04:23 |
|
wwb posted:That's it, I'll never hate on the "old" .NET 2.0 apps I see occasionally. Our enterprise .NET app is still 1.1
|
# ? May 17, 2011 04:29 |
|
Melted_Igloo posted:Embedded system code is the most horrible code you will see The tools for embedded processors are amazingly bad. If you want to program for a processor from Texas Instruments, and use a debugger, they will sell you their full-featured IDE, "Code Composer Studio" for $1000-3000 depending on licensing details. It comes with a program called "Code Composer Studio Monitor" which runs in the system tray, and when Code Composer locks up, the monitor icon turns gray, and gives you a menu option to kill all Code Composer processes. They decided it was better to make it easy to kill Code Composer when it crashes, than to fix their lovely IDE. Oh, and even when it works and you exit cleanly, it leaves a process running that prevents Windows from shutting down until you go shoot it manually from the task manager. When you use it to transfer a file to a processor via the J-Tag debug interface, the progress dialog has buttons for "stop", "pause", "rewind", and "fast-forward". I have yet to figure out what the last two do. The new release uses Eclipse as a front-end, but still only runs on Windows because it uses the same code for the debugger and such, but they now draw their UIs inside Eclipse panels. Some of the people using these tools are not too hot either. One engineer who works for a customer has been an embedded software engineer working primarily in C for over a decade. He declares strings like this... code:
And he was writing flight software for a U.S. government satellite. edit: Was missing a semicolon. aViR fucked around with this message at 07:10 on May 17, 2011 |
# ? May 17, 2011 06:55 |
|
I can't stop lauging about the Code Composer Studio Monitor. That's fantastic engineering!
|
# ? May 17, 2011 07:07 |
|
PalmTreeFun posted:Wait, who actually uses Delphi? Wouldn't you want to use Java or C# or something at least? I'm the only one in 26 including the teacher who agrees but anything is better than gml e: Delphi is the only alternative to game maker that's installed. Year 11 and I'm learning fancy drag and drop. underage at the vape shop fucked around with this message at 07:31 on May 17, 2011 |
# ? May 17, 2011 07:23 |
|
this.opera5=this.agent.indexOf("Opera 5")>-1 Opera 5 was released December 6, 2000. Opera 6 was released November 29, 2001. Way to test for a 10-year-old version of a marginal browser.
|
# ? May 17, 2011 09:52 |
|
Wheany posted:this.opera5=this.agent.indexOf("Opera 5")>-1 So...the horror is that your app is too portable?
|
# ? May 17, 2011 09:57 |
|
Jonnty posted:So...the horror is that your app is too portable? And browser sniffing is bad as-is.
|
# ? May 17, 2011 10:03 |
|
GreatKesh posted:I'm the only one in 26 including the teacher who agrees but anything is better than gml No one sane actually uses the drag and drop interface for GML other than occasionally showing it to the art guys. It mostly exists so get the noncoders to buy a license before they discover that they actually have to code or get someone to code for them. For one thing, the visual interface exposes but a tiny fraction of the features of the language so anything non-trivial will involve large segments of fairly generic C-like code. Maybe you should learn a few things about your tools before you throw fits about them. I'm not saying it's the greatest thing ever or anything, but it's alright for what it does and has a lot more to it then you're letting yourself know. At least they aren't making you use ALICE.
|
# ? May 17, 2011 10:12 |
|
Wheany posted:Yes, our app is too portable for checking for Opera 5, and not, say, any opera released after the year 2000 At the very worst, it's just old code that hasn't been taken out (I assume), but it doesn't sound like it's causing any active harm? I'd hardly call that a horror, just a bit overcautious. Unless it's checking for something that needn't be checked the first place.
|
# ? May 17, 2011 10:18 |
|
|
# ? May 16, 2024 21:37 |
|
Wheany posted:And browser sniffing is bad as-is. And why did I even stumble across that gem. Because I tested our app with IE 9 and it throws an exception "THIS BROWSER IS NOT SUPPORTED". I guess I'm adding the line code:
NOT!
|
# ? May 17, 2011 10:20 |