Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Flat Daddy posted:

there wasn't enough OOP

lol

Adbot
ADBOT LOVES YOU

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

BattleMaster posted:

well if the function doesn't ever return null then the problem being discussed wouldn't happen so there's no reason to check it in that case
:shepface:

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

BattleMaster posted:

it's up to you to know what a function is supposed to return before you call it, like i don't see how this is controversial, how do you even program if you just go "durr hurr i don't know what this function does *calls it anyway*"

well duh, it's so loving easy!

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

BattleMaster posted:

yep

edit: unironically yep, in over a decade of this poo poo i haven't had any particular issues in figuring out if a function can return null and if so, making sure it's not null before proceeding

like gently caress it i've written winapi poo poo which is notoriously poorly documented and they're pretty explicit about that, if your project's or api's docs are worse than that then my condolences

are you saying that your code has never had a nullpointerexception?

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

BattleMaster posted:

i've never programmed anything serious in a language with exceptions

if you mean the general case of "have I ever accidentally dereferenced a null pointer" no one's perfect but i don't think it's a tall order to do your best to find out what a function will return

:rolleyes:

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
Java code:
//Butt.java
import org.jetbrains.annotations.NotNull;

public interface Butt {
    /**
     * @return Turd, which must not be null
     */
    public @NotNull Turd poop();
}
// Turd.java
public interface Turd {
    public int getFirmnessOnBristolStoolScale();
}

//NoncompliantButt.java
public class NoncompliantButt implements Butt {
    @Override
    public Turd poop() {
        return null;
    }
}

// ButtMain.java
public class ButtMain {
    public static void main(String[] args) {
        Butt b = new NoncompliantButt();
        Turd t = b.poop();
        t.getFirmnessOnBristolStoolScale();
    }
}
am i allowed to call getFirmnessOnBristolStoolScale() without explicitly checking for null if both the documentation and the annotation org.jetbrains.annotations.NotNull say that Turd is never null?

i mean i guess i have to after it bites me, but what is the level of due diligence here when implementing a TurdConsumer for the first time?

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

CRIP EATIN BREAD posted:

intellij will yell at you that a implementor of the interface doesnt also have the @NotNull annotation.

the IDE will yell at you. findbugs will also.

the compiler will not.

i know, but i was kind of implying that the non-compliant butt comes from some external source, even though i just implemented and instantiated one myself in the example.

i really didn't feel like creating a di framework just for another yospos turd joke.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

CPColin posted:

^^^ If you defensively check for null anyway, Eclipse will complain about unnecessary code. :shobon:

so does idea


which you can then suppress with
//noinspection ConstantConditions

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Bloody posted:

what the gently caress

you can exit the do-block early using break

code:
do {
   if(somethingIsFucked) {
         break;
   } 
   actuallyDoTheThing();

}while(false);

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

CRIP EATIN BREAD posted:

thats a pretty common pattern when you dont have goto.

then again i really only use goto when writing kernel device drivers.

also if you have goto, but have heard the phrase "Go To Statement Considered Harmful" from the year 1968

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

BattleMaster posted:

i've used goto twice in embedded applications. the first was in a parser and was essentially identical to the do { } while (false) thing so that it could exit with common cleanup code even if there was an error (this saved a nontrivial amount of program space on my 8-bit micro with 32 kb of program space over other solutions, and i actually needed those bytes for other things). the other was to break out of nested switch blocks in the command packet handler for a usb device stack.

i'm not going to whitewash the latter case since it could probably have been done without nested switch-cases, but i would rather use goto in the former case over the do { } while (false)

on the other hand my cs grad boyfriend refuses to accept goto because he learned in school it was bad and he wanted to disown me after i showed him those things back to back

just use gotos when you need them. back when dijkstra wrote his letter, goto was the only choice, there was no do-while loop to use instead.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

eschaton posted:

there were plenty of real structured languages by then, not just Lisp but also languages like Algol-60

oh yeah?

well gently caress you and your "facts"

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Soricidus posted:

for example, right now i'm parsing html with regular expressions

mods, ban this chucklefuck

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
hey speaking of terrible uis, can you recommend any mockup/wireframe tool? i looked at moqups, since it was the first hit on google, and it seems pretty good.

well, better than our current process of "draw colored rectangles on a powerpoint slide" at least.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Maluco Marinero posted:

moqups ain't so bad, it's good because it forces low fidelity, so you can focus on the ideas rather than the exact execution (which you'd do in sketch or something)

yes, that's one reason why i like it. like you can see that the element is a date field, but people don't think that it's basically done.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

uncurable mlady posted:

I use balsamiq for wireframes

off to a great start

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Bloody posted:

holy poo poo i parsed a line

:toot:

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

HoboMan posted:

oh god, if you forget the var in your variable declaration javascript not only doesn't complain but assumes you want a global variable?
who would ever think that's a good idea?

"use strict";

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

HappyHippo posted:

dont do this, just do if(buttFunc === undefined)

only do this if you have to check that buttFunc is specifically undefined.

you can't call it anyway if it's null, false, 0 (edit: or NaN), so you are probably not interested in it being undefined, but "falsy"

Wheany fucked around with this message at 06:08 on Apr 5, 2016

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
I don't know if javascript: the good parts has had newer editions, but if it hasn't, remember that it describes the situation like 5 years ago. a lot has happened since then.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Jabor posted:

Though to be fair, you also can't call it if it's like, 2.

true. but if(something) is idiomatic.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

JawnV6 posted:

of all the goofy corners of C to copy

well it's not like c where everything is actually an int, it's just that everything coerces into any other type automatically

(not really)

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
:shrug:

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
i love c hashtag

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

akadajet posted:

js devs don't like to document poo poo, so i'm always trudging through source code to figure out what api's are available

or they document poo poo only superficially, so it looks like good documentation at first

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
hey speaking of Car extends Vehicle, i remember people talking about nethack's creature types and how one creature can polymorph into another type with different weaknesses and strenghts and such, and because of that, CaveTroll extends Troll extends Creature doesn't really work.

so how would you check for a monster's weakness for petrification when the player hits it with a cockatrice corpse without going all
code:
switch(attack_type) {
	case ATTACK_TYPE_COCKATRICE_CORPSE:
		switch(target_creature_type):
			case CREATURE_TYPE_CAVE_TROLL:
in the year 2016?

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
oh, and i meant to say that you are allowed to use any language you want.

the discussion back in prehistoric days was about reimplenemting it in c++ using oop because that was a relatively new and hot thing.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
whoops, too slow

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

MononcQc posted:

I agree with this post. Acceptable/Tolerable is easy; if you're lucky enough your users are going to dive in the source and be ready to do work to get the information they need. If you have decent docs, the users can find everything in there, but they have to read through stuff. But that's just decent.

There's a really difficult threshold to cross where you have to conciliate brevity and completeness or just find your place on a spectrum between two extremes, where you get comments like:

- I want simple examples / I want examples that are not just trivial stuff
- the content is too generic for me to imagine using it / the content is too specific for me to figure out how to apply it to my problem
- I don't feel like I have the right background for this / there's too much time spent showing the very basics
- the tone is too dry / the text feels patronizing
- there's too much code / not enough code being shown
- the documentation is too long / the documentation does not have enough details

and so on. Finding how to properly balance that is, in my experience, very hard, and I'm still not sure there's any solution other than "define your target audience, pick one way to do it and stick with it; someone else will write docs for the other audiences". This creates hit-and-miss approaches, but trying to do all of it at once is a very tricky affair.

communication usually fails, except by accident

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
i managed to draw a bunch of textured rectangles in opengl es on android after spending about 3 days on it.

ama

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

HoboMan posted:

i mean i can just google poo poo, but i am getting the creeping feeling i have some unknown unknowns here.

imagine a blinking gif that says "just code"

be interested enough in programming that you sometimes read a book or watch a video

learn from you mistakes. have facepalm moments when looking at code.

make something for yourself, even if it's some dumb thing like a greasemonkey script that alerts you when a thread on sa is ripe for snypin'.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
#justprogrammerthings

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Bloody posted:

lol if u cant just leave when ur sick of the poo poo

we use punchcards. well not literally, but a web form where you have to click on a button when you arrive and leave.

this is separate from the timesheets where you still need to go type your hours

you can be drat sure that i loving beeline for the login button as soon as i come in from the front door. and after i click the logout button, i leave behind a cartoonesque dust cloud where i was standing.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Maluco Marinero posted:

Javascript frameworks never change.

the exact opposite, really :grin:

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
If it needs structural changes to the db, rest interface and ui, the default estimate is 2 weeks.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
#noestimates

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
i like functions that return functions
JavaScript code:
var makeClickHandler = function (type) {
	return function () {
		alert('you touched ' + type);
	}
}

document.getElementById('bonerButton').addEventListener('click', makeClickHandler('boner'), false);
document.getElementById('boobsButton').addEventListener('click', makeClickHandler('boobs'), false);
document.getElementById('buttButton').addEventListener('click', makeClickHandler('butt'), false);

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
farts.reduce(function() {return "toot"})

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Notorious QIG posted:

again because it's a simple example to demonstrate the general gist of what im talking about

christ almighty do i have to write unit tests for example code too

you have to use "butt" and "fart" as your variable names or us terrible yospos programmers will think you're posting production code.

Adbot
ADBOT LOVES YOU

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Notorious QIG posted:

what if i write enterprise code for the fartbutt industry

are you hiring? i'm willing to relocate

  • Locked thread