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.
 
  • Post
  • Reply
Sapozhnik
Jan 2, 2005

Nap Ghost

rotor posted:

remediating

fixing.

the word you're looking for is fixing.

Adbot
ADBOT LOVES YOU

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Mr Dog posted:

fixing.

the word you're looking for is fixing.

no, it's definitely not "fixing," they're pretty emphatic on that point

"remediation" to me has always had the flavor of striking a balance between repair and repair costs. so it's definitely not fixed, but it's better than it was, and that's apparently usuall good enough.

brap
Aug 23, 2004

Grimey Drawer
but my lovely plangs let me iterate through sprints in an agile manner :confused:
or sprint through iterations I forget how it goes

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

ive never actually used rails. i made it until last week without installing ruby on any computer, and that was just to use some crappy tool i needed to use for a one off thing

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

im way more productive in haskell than i ever was in python, at the cost of being forced to spend marginally more time thinking through my problem before i start making GBS threads out code

tef
May 30, 2004

-> some l-system crap ->

Tiny Bug Child posted:

nah. PHP arrays do what "arrays" in other languages do but even better, so there's no reason to rename them. if PHP implemented regular "arrays" they should have a different name, like ShittyArray or maybe even SplFixedArray

fwiw lua arrays also do this, but they call them "tables" instead of "arrays", which tbh seems like a better name because it stops the whining

then again, maybe arrays is the better name for exactly the same reason

tef
May 30, 2004

-> some l-system crap ->

Tiny Bug Child posted:

what exactly is it that you're bitching about here? that they made a faster interpreter? that's exactly what they should be doing.

code should always be written in the clearest, most straightforward manner possible. if you're worried about performance you're not going to do that; instead you're going to add all kinds of little hacks and "optimizations". (and of course most developers rely on nothing but the power of belief when it comes to these optimizations. what are benchmarks?? i learned about this in my CS class, it must be faster!)

i readily admit that PHP's performance needs to be improved. the only place that can happen is the interpreter. and PHPNG, by all accounts, looks like it's going to be a quantum leap in terms of performance. the future of PHP has never been brighter :)

Shaggar posted:

if writing clear code makes ur code slower, something in ur language or tools is bad.

it's a christmas miracle

Dylan16807
May 12, 2010

tef posted:

fwiw lua arrays also do this, but they call them "tables" instead of "arrays", which tbh seems like a better name because it stops the whining

then again, maybe arrays is the better name for exactly the same reason

seems simpler to me to just call them maps

the way php remembers insertion order interests me, though. does any other language do that? I think some browsers do but not others.

CPColin
Sep 9, 2003

Big ol' smile.
Yes: http://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html

Bloody
Mar 3, 2013


Ugh not named array what a piece of loving garbage

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
Hey Bloody, Shaggar, c# folks, etc.

what's the best way to deal with event handler spaghetti?

i'm doing a wpf project using the voice recognition api and i want to maintain all the delegation logic in the viewmodel and have each component (i.e. audioinput, audiooutput, recognizer) do its own task

the way i want to do it is to have an audioinput class manage the input audio stream then when it captures data, feed it through the recognizer then send the output to my audiooutput class

i'm using naudio to make audio io a little easier, but now when i get input data i have to do something with it in my WaveIn.DataAvailable event which seems like it encapsulates it in the audioinput class and doesn't let me control delegation in my viewmodel

am i thinking about this the wrong way?

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
that probably should have gone in the terrible programmer hideout thread

FamDav
Mar 29, 2008
re: rails is slow as poo poo

here's a pointless framework comparison that shouldn't be expected to tell you much of anything besides rails being ridiculously, incredulously slow

https://www.techempower.com/benchmarks/#section=data-r9&hw=peak&test=fortune

havelock
Jan 20, 2004

IGNORE ME
Soiled Meat

Blinkz0rz posted:

Hey Bloody, Shaggar, c# folks, etc.

what's the best way to deal with event handler spaghetti?

i'm doing a wpf project using the voice recognition api and i want to maintain all the delegation logic in the viewmodel and have each component (i.e. audioinput, audiooutput, recognizer) do its own task

the way i want to do it is to have an audioinput class manage the input audio stream then when it captures data, feed it through the recognizer then send the output to my audiooutput class

i'm using naudio to make audio io a little easier, but now when i get input data i have to do something with it in my WaveIn.DataAvailable event which seems like it encapsulates it in the audioinput class and doesn't let me control delegation in my viewmodel

am i thinking about this the wrong way?

Rx (reactive extensions). Converts the events into effectively a stream. Then you can write .Selects etc over the stream to transform the raw input into whatever you want. Each processor can be encapsulated in an extension method.

suffix
Jul 27, 2013

Wheeee!

FamDav posted:

re: rails is slow as poo poo

here's a pointless framework comparison that shouldn't be expected to tell you much of anything besides rails being ridiculously, incredulously slow

https://www.techempower.com/benchmarks/#section=data-r9&hw=peak&test=fortune

alternative takeaway: even the slowest frameworks can handle thousands of times more requests than your lovely internal web app will get, so use whatever is quickest to develop for or easiest to maintain

necrotic
Aug 2, 2005
I owe my brother big time for this!

suffix posted:

alternative takeaway: even the slowest frameworks can handle thousands of times more requests than your lovely internal web app will get, so use whatever is quickest to develop for or easiest to maintain

yup. we use rails pretty happily for our API and it serves up ~1.2m requests per minute no problem.

Cybernetic Vermin
Apr 18, 2005

there are other reasons to not use rails though. the biggest issue of the poor performance is that it is rather indicative of the compounded poor engineering going on, which shows up in other ways

triple sulk
Sep 17, 2014



Nil is why you shouldn't use Rails.

Sapozhnik
Jan 2, 2005

Nap Ghost
I do enjoy the fact that Vala of all languages actually gets NULL handling right (i.e. you have to opt in to nullability for everything and explicitly test for it if something is nullable)

java.util.Optional is a decent retrofit compromise for the best programming language though

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Mr Dog posted:

I do enjoy the fact that Vala of all languages actually gets NULL handling right (i.e. you have to opt in to nullability for everything and explicitly test for it if something is nullable)

java.util.Optional is a decent retrofit compromise for the best programming language though

lmfao at this article title http://www.oracle.com/technetwork/articles/java/java8-optional-2175753.html

god java is stupid

Sapozhnik
Jan 2, 2005

Nap Ghost
i agree, there are a lot of stupid Java programmers out there due to Java's ill-considered use as a teaching language

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
his demonstration of "optional" is loving insane lmfao. how is that an acceptable retrofit

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
he gives much better examples implemented by other languages that use the JVM and then presents Optional and it's clear that it's just a stupid pile of poo poo for retards

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
Java code:
String version = computer?.getSoundcard()?.getUSB()?.getVersion();
vs

Java code:
String version = computer.flatMap(Computer::getSoundcard)
                   .flatMap(Soundcard::getUSB)
                   .map(USB::getVersion)
                   .orElse("UNKNOWN");
Java programmers must be too stupid to realize how terrible their lives are or they would all have committed suicide by now

brap
Aug 23, 2004

Grimey Drawer
brb im gonna go have eclipse generate some getters and setters for me, gotta encapsulate that data dontcha know

Bloody
Mar 3, 2013

I don't really get the point of encapsulation.

brap
Aug 23, 2004

Grimey Drawer
when you have an object with state and you only want its state to be changeable in certain ways from the outside, you mark certain poo poo as private. Then the only methods your object exposes are things that are actually ok to do. Mostly it's there to keep programmers from loving up.

java is a horrible language though, it's basically object-oriented before people actually figured out what the useful parts of object-oriented were.

Bloody
Mar 3, 2013

right, that makes sense. I guess I don't get the "mark everything private and give it a getter and setter" thing that seems to be popular.

Max Facetime
Apr 18, 2009

vapid cutlery posted:

Java code:
String version = computer?.getSoundcard()?.getUSB()?.getVersion();
vs

Java code:
String version = computer.flatMap(Computer::getSoundcard)
                   .flatMap(Soundcard::getUSB)
                   .map(USB::getVersion)
                   .orElse("UNKNOWN");
Java programmers must be too stupid to realize how terrible their lives are or they would all have committed suicide by now

not to mention that code requires rewriting the existing classes to support using an Optional, so actually it should look more like this:

Java code:
static String stupidity3(Computer computer) {
		return Optional.ofNullable(computer)
			.flatMap(Computer::getOptionalSoundcard)
			.flatMap(Soundcard::getOptionalUSB)
			.map(USB::getVersion)
			.orElse("UNKNOWN");
}
but really Optional is a really stupid class

if you want to avoid nulls, just write your own:

Java code:
class Nullsafe<T> {
	final @Nullable T t;

	Nullsafe(@Nullable T t) {
		this.t = t;
	}
	public static <U> Nullsafe<U> of(@Nullable U u) {
		return new Nullsafe<U>(u);
	}
	public <U> Nullsafe<U> then(@NonNull Function<? super @NonNull T, @Nullable U> mapper) {
		@Nullable T t2 = t;
		return new Nullsafe<U>(t2 == null ? null : mapper.apply(t2));
	}
	public T or(T value) {
		@Nullable T t2 = t;
		return t2 == null ? value : t2;
	}
}
// and call it like this:
	static String stupidity4(Computer computer) {
		return Nullsafe.of(computer)
			.then(Computer::getSoundcard)
			.then(Soundcard::getUSB)
			.then(USB::getVersion)
			.or("UNKNOWN");
	}
or just check for nulls in a less stupid way:

return computer != null && computer.getSoundcard() != null && computer.getSoundcard().getUSB() != null
? computer.getSoundcard().getUSB().getVersion() : "UNKNOWN";

god that article makes me so angry

Soricidus
Oct 21, 2010
freedom-hating statist shill

Bloody posted:

right, that makes sense. I guess I don't get the "mark everything private and give it a getter and setter" thing that seems to be popular.

that is a dumb thing done by bad programmers so it's a good sign if you don't get it, hth

pseudorandom name
May 6, 2007

future proofing against the hypothetical scenario where you replace or remove the private variable

also the setter allows you to validate inputs because your type system doesn't automatically restrict you to sanity

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Bloody posted:

right, that makes sense. I guess I don't get the "mark everything private and give it a getter and setter" thing that seems to be popular.

so when you inevitably have bugs caused by poo poo just mutating parts of an object using the getters and setters you can set breakpoints on the getters and setters, oblivious to the larger design problems in Hyderabad Hustler 2015

distortion park
Apr 25, 2011


Bloody posted:

right, that makes sense. I guess I don't get the "mark everything private and give it a getter and setter" thing that seems to be popular.

it's not a big deal in c# as you can always retrofit properties, not sure why everyone does it there either. makes sense in javaland as you'd have to change variable access to a method

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

pseudorandom name posted:

future proofing against the hypothetical scenario where you replace or remove the private variable

also the setter allows you to validate inputs because your type system doesn't automatically restrict you to sanity

what are you talking about.

pseudorandom name
May 6, 2007

why java programmers mark everything private and then add getters and setters

Max Facetime
Apr 18, 2009

vapid cutlery posted:

what are you talking about.

like you have a Person class with a name String, and in the far future our names will be generated from ID numbers assigned by a computer but thanks to wrapping the name String behind a getName method call your code is well-prepared for this scenario!

brap
Aug 23, 2004

Grimey Drawer
http://csharpindepth.com/Articles/Chapter8/PropertiesMatter.aspx
In C# it doesn't matter, just do it because it's a one liner but in Java it's a pain in the rear end

pseudorandom name
May 6, 2007

Max Facetime posted:

like you have a Person class with a name String, and in the far future our names will be generated from ID numbers assigned by a computer but thanks to wrapping the name String behind a getName method call your code is well-prepared for this scenario!

also what if somebody sets your name to U+034D COMBINING LEFT RIGHT ARROW BELOW U+FEFF BYTE ORDER MARK U+2603 SNOWMAN? what then???

more like dICK
Feb 15, 2010

This is inevitable.
in java you just mark a class with @Data though

Adbot
ADBOT LOVES YOU

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Max Facetime posted:

like you have a Person class with a name String, and in the far future our names will be generated from ID numbers assigned by a computer but thanks to wrapping the name String behind a getName method call your code is well-prepared for this scenario!

lmao

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply