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
FamDav
Mar 29, 2008

Cybernetic Vermin posted:

i have quit programming outside of occasional fun projects, in professional programming i went for overly elaborate solutions that weren't really suited for their purpose and was inefficient with my time. mediocre lob 9-5 java programmers, who are aided by the restraints of java style and practice *are* real programmers and are doing an important job. you obviously have high ideas of what programming is and are trying to apply them to what i am saying, but the facts are quite the opposite

i am good programmer because i create ridiculously elaborate solutions that are useless

is what you are saying

what did you switch to that was a more efficient use of your time

Adbot
ADBOT LOVES YOU

Cybernetic Vermin
Apr 18, 2005

how on earth did you read that post and conclude that i am calling myself a good programmer? do you comprehend written english at all?

it was plenty efficient time spent for me on account of getting well paid, but if you don't feel you are doing a good job it is better to switch for everyones benefit

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Subjunctive posted:

recoverability is pretty rare in practice, because it means you need to be effectively transactional in all your operations, or a thrown exception leaves you inconsistent. there are relatively few places in a program where you can throw away meaningful chunks and be in a consistent state; many fewer places than there are method calls.

the "have to type something to shut up the compiler" ergonomics are really bad, and leads to way more swallowing IMO. if the exception specification told you more about the context of the failure to guide recovery it might work better, but the Java type system isn't really expressive enough to do a good job there. it might be a better situation if type erasure didn't mean this:

Java code:
try {
  throw new MyException<PolicyBob>();
} catch (MyException<PolicyAlice>) {
  // this will catch all MyException<>s
} catch (MyException<PolicyBob>) {
  // won't run, ever
}
(not being able to parameterize a class' error model the same way you parameterize the class is another gripe)

this means you end up with a billion useless little classes whose only purpose is to have a different type signature, and wrapping exceptions all over in bespoke ways. take Runnable.run (please): everything is forced through RuntimeException because you can't be more descriptive in the signature of your own implementation. the prevalence of things like Guava's Throwable.propagate is a sign that the checked-exception experiment is a failure, IMO. maybe with grownup generics it would be OK, because then the type system would help you distinguish RemoteException<HostNotFound> from RemoteException<VersionMismatch>.

coffeetable posted:

so the end-to-end principle means that in a communications protocol, the intermediate nodes should be ignorant as to the meaning of the data being passed through them.

in the case of checked exceptions, every function in the stack between the throw() and the catch() needs to know about the exception, which means if the type of the exception is altered at the throw() end then every function up to the catch() needs to be altered.

a form of checked exceptions that'd satisfy the end-to-end principle (at least from the programmer's perspective) would be if the compiler automatically inferred the checked exceptions a function could throw, and only complained if any of them would be able to reach the bottom of the stack without being caught.

Both of these are good posts about checked exceptions and I wish there was more of this discussion going on in the Java spec.

Juul-Whip
Mar 10, 2008

Symbolic Butt posted:

are you really talking about duck typing or is it really dynamic typing

probably yeah

FamDav
Mar 29, 2008

Cybernetic Vermin posted:

how on earth did you read that post and conclude that i am calling myself a good programmer? do you comprehend written english at all?

it was plenty efficient time spent for me on account of getting well paid, but if you don't feel you are doing a good job it is better to switch for everyones benefit

what were you if the mediocre programmers are the ones churning out lob apps in java

what are good programmers

what are bad programmers

what are

Cybernetic Vermin
Apr 18, 2005

this is not loving complicated stuff, but i will try to break it down and use small words and hope you understand:

that first bit where i list some bad things about my own programming that made me quit? that means i was *bad*

that other bit where i say that mediocre programmers who put in their 9-5 and have tools that help them do a good enough job despite not being a rockstar idiot about it? that is *good*

there are no rockstar construction workers, since they don't actually work out well, there are just people who put in the time and are rather deliberately not tasked with understanding architecture or solid mechanics on any deep level. the same thing holds for java lob stuff, java, application servers, frameworks, and a bunch of surrounding things are there to force the work into a shape suitable for the workers who can actually be trusted to work away in roughly the right direction

Bloody
Mar 3, 2013

AlsoD posted:

What are numbers? We just don't know.

this but also birds

Stringent
Dec 22, 2004


image text goes here

Cybernetic Vermin posted:

this is not loving complicated stuff, but i will try to break it down and use small words and hope you understand:

that first bit where i list some bad things about my own programming that made me quit? that means i was *bad*

that other bit where i say that mediocre programmers who put in their 9-5 and have tools that help them do a good enough job despite not being a rockstar idiot about it? that is *good*

there are no rockstar construction workers, since they don't actually work out well, there are just people who put in the time and are rather deliberately not tasked with understanding architecture or solid mechanics on any deep level. the same thing holds for java lob stuff, java, application servers, frameworks, and a bunch of surrounding things are there to force the work into a shape suitable for the workers who can actually be trusted to work away in roughly the right direction

so basically your code was like your posting?

Cybernetic Vermin
Apr 18, 2005

p. much yeah

Damiya
Jul 3, 2012

Subjunctive posted:

(not being able to parameterize a class' error model the same way you parameterize the class is another gripe)

Sounds like somebody needs pattern matching.

FamDav
Mar 29, 2008
no i mean if good programmers are mediocre programmers, then what are bad programmers

MeruFM
Jul 27, 2010
strongly herped
weakly derped
my type is ducked, but still it worked!

Scaevolus
Apr 16, 2007

static/dynamic is just whether types are verified by the compiler or the runtime

strong/weak is how easily one type turns into another. most C derivatives have implicit numeric conversions (2 + 2.1), where numbers can convert to "bigger" numbers. C++ lets you define your own implicit conversions (even accidentally-- just by making a ctor) which can be confusing as gently caress.

casting can be considered an element of weak typing, but at least it's explicit

having numbers and strings coerce easily back and forth is terrible. `num + str => str + str` is somewhat defensible, but any time you automatically coerce a string to a number because it "seems like the right thing for the context", you're introducing non-obvious behavior. PHP is particularly bad at this, since it coerces depending on the content of the string, so you can't even look at a line of code, know the types of the values, and know what it will do.

code:
$ php -r 'var_dump("61529519452809720693702583126814" == "61529519452809720000000000000000");'
bool(false)
if you think that's cool and helpful, TBC has a spare room for you in stockholm

tl;dr: any language with both == and === is a horror

b0lt
Apr 29, 2005

Scaevolus posted:

code:
$ php -r 'var_dump("61529519452809720693702583126814" == "61529519452809720000000000000000");'
bool(false)

looks reasonable to me

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Scaevolus posted:

code:

$ php -r 'var_dump("61529519452809720693702583126814" == "61529519452809720000000000000000");'
bool(false)

if you think that's cool and helpful, TBC has a spare room for you in stockholm

tl;dr: any language with both == and === is a horror

two different strings compare as different: a horror I can handle

there are lots of different forms of equality/equivalence, many perfectly :eng101: languages express different flavours as eq and == and equals and thing.equals(other). (Is -0 equal to 0?)

Scaevolus
Apr 16, 2007

structural typing is a very nice way to simplify object hierarchies

instead of having to inherit from some IReader class, you just implement the appropriate Read method, and that object can be passed to any function wanting a Reader

it can cause unexpected behavior in dynamic languages. duck typing is the dynamic equivalent to structural typing -- just call foo.Read in your code, and if it exists, your program continues merrily along

but what if you only occasionally call one of the methods on your duck typed object? initial runs verify that yes, your duck quacks as expected, but in production suddenly it's asked to swim and you crash and die



Go is statically typed, has structural typing, and has local type inference. it's pretty sweet

Bloody
Mar 3, 2013

Scaevolus posted:

code:
$ php -r 'var_dump("61529519452809720693702583126814" == "61529519452809720000000000000000");'
bool(false)

wait whats wrongw ith this the strings are obviously not equal

Scaevolus
Apr 16, 2007

Scaevolus posted:

code:
$ php -r 'var_dump("61529519452809720693702583126814" == "61529519452809720000000000000000");'
bool(false)
:downs: I should read my own posts

this was fixed in 5.3.6, before it would return true

Bloody
Mar 3, 2013

Scaevolus posted:

:downs: I should read my own posts

this was fixed in 5.3.6, before it would return true

im the websites that were probably broken by this fix

FamDav
Mar 29, 2008

Scaevolus posted:

structural typing is a very nice way to simplify object hierarchies

instead of having to inherit from some IReader class, you just implement the appropriate Read method, and that object can be passed to any function wanting a Reader

it can cause unexpected behavior in dynamic languages. duck typing is the dynamic equivalent to structural typing -- just call foo.Read in your code, and if it exists, your program continues merrily along

but what if you only occasionally call one of the methods on your duck typed object? initial runs verify that yes, your duck quacks as expected, but in production suddenly it's asked to swim and you crash and die



Go is statically typed, has structural typing, and has local type inference. it's pretty sweet

i prefer type classes as the mechanism for this because i can separate interface instance code from the actual datatype code. i can also create new type classes instances for things that dont immediately conform to an interface

FamDav
Mar 29, 2008
oh i can make you expand and emit but there is no function that makes you fart? dont worry about that i can just create a new instance of my type class

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Scaevolus posted:

:downs: I should read my own posts

this was fixed in 5.3.6, before it would return true

yet again people harp on dumb poo poo PHP used to do in the ancient past. heck there are still people bitching about PHP 4's OO model like it's somehow relevant in 2014

"b-b-but TBC there are still some sites on 5.3.2---"

that's not PHP's problem. keep your poo poo up to date

suffix
Jul 27, 2013

Wheeee!

JewKiller 3000 posted:

nobody uses objects in ocaml because once you have algebraic data types with type inference and a real module system, you find that you don't need or want to do object-oriented programming anymore

quote:

As a side-effect of type inference in OCaml, functions (including operators) can't have overloaded definitions. OCaml defines + as the integer addition function. To add floats, use +. (note the trailing period).
lol

shrughes
Oct 11, 2008

(call/cc call/cc)

Malcolm XML posted:

ghci> "2" + (show 2)
>>> "22"

with OverloadedStrings (and Read a => IsString a) can get ur "2" + 2 = 4 as well

> "negative forty-seven" + 9
-38

suffix
Jul 27, 2013

Wheeee!

Tiny Bug Child posted:

yet again people harp on dumb poo poo PHP used to do in the ancient past. heck there are still people bitching about PHP 4's OO model like it's somehow relevant in 2014

"b-b-but TBC there are still some sites on 5.3.2---"

that's not PHP's problem. keep your poo poo up to date

code:
switch("garbage") {
case 0:
  echo "= 0\n"; break;
case 1:
  echo "= 1\n"; break;
default:
  echo "unhandled case\n";
}

= 0
thanks, rasmus

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

shrughes posted:

> "negative forty-seven" + 9
-38

with undecidable instances u get what u get

Bloody
Mar 3, 2013

suffix posted:

code:
switch("garbage") {
case 0:
  echo "= 0\n"; break;
case 1:
  echo "= 1\n"; break;
default:
  echo "unhandled case\n";
}

= 0
thanks, rasmus

lol

MeruFM
Jul 27, 2010

suffix posted:

code:
switch("garbage") {
case 0:
  echo "= 0\n"; break;
case 1:
  echo "= 1\n"; break;
default:
  echo "unhandled case\n";
}

= 0
thanks, rasmus
i didn't even believe it until i ran it

shrughes
Oct 11, 2008

(call/cc call/cc)

Malcolm XML posted:

with undecidable instances u get what u get

You don't need anything besides OverloadedStrings.

spongeh
Mar 22, 2009

BREADAGRAM OF PROTECTION
we should all just band together and use lua and luajit

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

shrughes posted:

You don't need anything besides OverloadedStrings.

ghci bitches about (read a)=>is string a without it.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

MeruFM posted:

i didn't even believe it until i ran it

what number do you think "garbage" should be

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

spongeh posted:

we should all just band together and use lua and luajit

I'm not a huge Lua fan, but Mike Pall is a straight-up badass.

Innocent Bystander
May 8, 2007
Born in the LOLbarn.

Tiny Bug Child posted:

what number do you think "garbage" should be

it shouldn't be comparable imo, the interpreter/compiler should say 'you hosed up' and then stop working. but it would probably do that with every input, so i dunno, the classic productivity vs correctness

Deacon of Delicious
Aug 20, 2007

I bet the twist ending is Dracula's dick-babies

Tiny Bug Child posted:

what number do you think "garbage" should be

219

Arcsech
Aug 5, 2008

Innocent Bystander posted:

it shouldn't be comparable imo, the interpreter/compiler should say 'you hosed up' and then stop working. but it would probably do that with every input, so i dunno, the classic productivity vs correctness

This is correct

"NaN" would be a semi-acceptable alternative if you must have weak typing

pseudorandom name
May 6, 2007

but not a string containing NaN, the actual IEEE 754 NaN. preferably signaling.

shrughes
Oct 11, 2008

(call/cc call/cc)

Malcolm XML posted:

ghci bitches about (read a)=>is string a without it.

Right, I was talking about "negative thirty-seven" or whatever -- that's not a Read a => IsString a instance.

fritz
Jul 26, 2003

coffeetable posted:

should it return 4 or "22" though

52

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

Mr Dog posted:

Java: a terrible programming language for being an insecure dunning-kruger who loves to show off as much as possible


no it just means you find it difficult to show off

and you've never worked with someone with a phd who likes dropping 25,000 lines of code into a project over a weekend.

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