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
ThePeavstenator
Dec 18, 2012

:burger::burger::burger::burger::burger:

Establish the Buns

:burger::burger::burger::burger::burger:

Soricidus posted:

java is undeniably boring

for some reason, many immature programmers see this as a disadvantage

I think starts with hearing some mega-nerdlord who's been on the 4chan technology board since 6th grade talk about how Java isn't fast and obviously you also know all about computers as a student in a high-school programming course so you start repeating and believing it. Combine that with it usually being the language that you learn first in school which means that the pitfalls of learning programming get blamed on Java.

Java is the lame parent that makes you brush your teeth before bed and checks that your homework is done.

Then cool parent JavaScript comes along and doesn't throw compiler errors and doesn't make you use all that boilerplate.

Adbot
ADBOT LOVES YOU

ThePeavstenator
Dec 18, 2012

:burger::burger::burger::burger::burger:

Establish the Buns

:burger::burger::burger::burger::burger:
be free my previous post

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

MeruFM posted:

i feel like a lot of java advice is like jquery advice when you search for a javascript question.

dogmatism rules and people are often stuck in java 1.6 thinking when a 1.7 or 1.8 method is way better.

i think that's probably just because older version of java have been around for longer and that gives the answers more visibility

VikingofRock
Aug 24, 2008




Nothing really matters
Expressive ADTs
Nothing really matters
Nothing really matters
Nothing really matters
To meeee~~~

cinci zoo sniper
Mar 15, 2013




VikingofRock posted:

Nothing really matters
Expressive ADTs
Nothing really matters
Nothing really matters
Nothing really matters
To meeee~~~

the lyrical infection from pl thread is spreading :ohdear:

VikingofRock
Aug 24, 2008




cinci zoo sniper posted:

the lyrical infection from pl thread is spreading :ohdear:

Lol crap wrong thread

gonadic io
Feb 16, 2011

>>=

VikingofRock posted:

Lol crap wrong thread

i don't blame you for making that assumption, it's always surprising when the pl thread isn't just arguing about strong vs weak typing

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

cinci zoo sniper posted:

ah, i see. ill kill it in the crib by moving repeating functions in auxiliaries then.

also, doesn't sound like a too fantastic measure of something

there's definitely a correlation between cyclomatic complexity and confusingness of a function, and the cyclomatic complexity can be thought of as the bare minimum number of tests you need to write to cover that function (if there's 20 different paths through a function, there's obviously at least 20 different cases of input).

otoh, trying to do a hard cap on the cc of your functions is obviously dumb and a terrible idea and leads to insane things like splitting a 20-case switch into two different functions and declaring it improved, and it's easy to have it not catch actually complicated things because it happens to branch via polymorphism rather than an if. overall i'd consider a high cc as just a weak indicator that that part of the code could benefit from some refactoring.

Zaxxon
Feb 14, 2004

Wir Tanzen Mekanik

ThePeavstenator posted:

I think starts with hearing some mega-nerdlord who's been on the 4chan technology board since 6th grade talk about how Java isn't fast and obviously you also know all about computers as a student in a high-school programming course so you start repeating and believing it. Combine that with it usually being the language that you learn first in school which means that the pitfalls of learning programming get blamed on Java.

Java is the lame parent that makes you brush your teeth before bed and checks that your homework is done.

Then cool parent JavaScript comes along and doesn't throw compiler errors and doesn't make you use all that boilerplate.

I think a lot of it is that your first java class is like "how to read a line from the console then spit another line back out." I mean I know you can do cool and fun stuff with java, but that's never how it's presented, so people don't pick it up until later. With javascript you can make interactive stuff, that you can share easily, so it's a bit more engaging from the get go.

MeruFM
Jul 27, 2010

Plorkyeran posted:

there's definitely a correlation between cyclomatic complexity and confusingness of a function, and the cyclomatic complexity can be thought of as the bare minimum number of tests you need to write to cover that function (if there's 20 different paths through a function, there's obviously at least 20 different cases of input).

otoh, trying to do a hard cap on the cc of your functions is obviously dumb and a terrible idea and leads to insane things like splitting a 20-case switch into two different functions and declaring it improved, and it's easy to have it not catch actually complicated things because it happens to branch via polymorphism rather than an if. overall i'd consider a high cc as just a weak indicator that that part of the code could benefit from some refactoring.

that's what ignore-lint comments are for i guess. Keep the linting up but add the ignore if you think this is the best you can do.


ThePeavstenator posted:

I think starts with hearing some mega-nerdlord who's been on the 4chan technology board since 6th grade talk about how Java isn't fast and obviously you also know all about computers as a student in a high-school programming course so you start repeating and believing it. Combine that with it usually being the language that you learn first in school which means that the pitfalls of learning programming get blamed on Java.

Java is the lame parent that makes you brush your teeth before bed and checks that your homework is done.

Then cool parent JavaScript comes along and doesn't throw compiler errors and doesn't make you use all that boilerplate.

There's an intermediate between "every class needs its own file, public static void main" and
code:
1 + 1 + '1'
> "21"
'1' + 1 + 1
> "111"

There Will Be Penalty
May 18, 2002

Makes a great pet!
i like javascript (stockholm syndrome, i know) and sometimes i wanna typescript all the things so bad.

ThePeavstenator
Dec 18, 2012

:burger::burger::burger::burger::burger:

Establish the Buns

:burger::burger::burger::burger::burger:

MeruFM posted:

There's an intermediate between "every class needs its own file, public static void main" and
code:
1 + 1 + '1'
> "21"
'1' + 1 + 1
> "111"

Yes but the first 2 languages most people learn in school are immediately on both ends of this spectrum.

my new dog
May 7, 2007

by Nyc_Tattoo

MeruFM posted:

code:
1 + 1 + '1'
> "21"
'1' + 1 + 1
> "111"

Lol

cinci zoo sniper
Mar 15, 2013




Plorkyeran posted:

there's definitely a correlation between cyclomatic complexity and confusingness of a function, and the cyclomatic complexity can be thought of as the bare minimum number of tests you need to write to cover that function (if there's 20 different paths through a function, there's obviously at least 20 different cases of input).

otoh, trying to do a hard cap on the cc of your functions is obviously dumb and a terrible idea and leads to insane things like splitting a 20-case switch into two different functions and declaring it improved, and it's easy to have it not catch actually complicated things because it happens to branch via polymorphism rather than an if. overall i'd consider a high cc as just a weak indicator that that part of the code could benefit from some refactoring.

there is refactoring in need indeed. im probably reinventing horrible bicycle but the code flow for 3 methods is

thingA-v(1:3)
thingB-v(1:3)
thingC-v(1:3)
code(1:2+3)
postD or postE

where i'm sure i can get at least a few clean functions out with no hassle

now the matplotlib methods the mccabe is upset with... not sure i can do much there, all the complexity ifs and whatnot basically are various formatting cases under

if a title this if not a title something
if b add that to title else if c change this in title

and so on

aardvaard
Mar 4, 2013

you belong in the bog of eternal stench

There Will Be Penalty posted:

i like javascript (stockholm syndrome, i know) and sometimes i wanna typescript all the things so bad.

it's nice for really short things because you don't need to care about anything, man. but the moment you need multiple files everything good about it goes away.

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

MeruFM posted:

There's an intermediate between "every class needs its own file, public static void main" and
I don't know what's so terrible about the first thing and I don't know any language where the second thing is a thing.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

MeruFM posted:

There's an intermediate between "every class needs its own file, public static void main" and
code:
1 + 1 + '1'
> "21"
'1' + 1 + 1
> "111"

Java code:
public class Butt {
    public static void main(String[] args) {
        System.out.println(1 + 1 + '1');
        System.out.println('1' + 1 + 1);
        System.out.println(1 + 1 + "1");
        System.out.println("1" + 1 + 1);
    }
}
prints:
51
51
21
111

Luigi Thirty
Apr 30, 2006

Emergency confection port.

me (1:30 am): oh drat, the goon ss13 server is restarting. guess i'll do something else for a few minutes until a game starts

me (2:45 am): what have i done

Elysiume
Aug 13, 2009

Alone, she fights.
maybe a weird question, but if you're working on a project that's going to require data from other teams/services, who tracks down those teams/services? the developers, the project managers, or the managers? trying to get some outside perspective

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Elysiume posted:

maybe a weird question, but if you're working on a project that's going to require data from other teams/services, who tracks down those teams/services? the developers, the project managers, or the managers? trying to get some outside perspective

cc: them all, let their inbox sort 'em out

Doom Mathematic
Sep 2, 2008
Meanwhile in C:

C code:
"11" + 1
> "1"

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Elysiume posted:

maybe a weird question, but if you're working on a project that's going to require data from other teams/services, who tracks down those teams/services? the developers, the project managers, or the managers? trying to get some outside perspective

at my former employment my manager would tell me who I needed to get in touch with and then it was my job to harass them until they gave me what I needed. this usually involved getting the engineering senior manager (who liked me) to email them and tell them to send me the drat spreadsheet because I’m not important enough to them

MeruFM
Jul 27, 2010

Wheany posted:

Java code:
prints:
51
51
21
111
:argh:


John Big Booty posted:

I don't know what's so terrible about the first thing

it forces a lot of handwaving before even the basics can be grasped

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news

Doom Mathematic posted:

Meanwhile in C:

C code:
"11" + 1
> "1"

wtf is even going on in this one

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
python supremacy :smuggo:

code:
>>> print(1 + 1 + '1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen

Mr SuperAwesome posted:

wtf is even going on in this one

pointer arithmetic

Soricidus
Oct 21, 2010
freedom-hating statist shill

MeruFM posted:

There's an intermediate between "every class needs its own file, public static void main" and
code:

1 + 1 + '1'
> "21"
'1' + 1 + 1
> "111"

java doesn't require every class to have its own file, and the code snippet you posted has identical results in java if you replace single quotes with double quotes

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Mr SuperAwesome posted:

wtf is even going on in this one

code:
> cat fart.c
#include <stdio.h>

int main() {
  char* one_one = "11";

  printf("%p: %s\n", one_one, one_one);

  printf("%p: %s\n", (one_one + 1), (one_one + 1));

  return 0;
}

# if you compile with anything less than -Wpedantic you don't get warnings
> clang -Wall -Wpedantic -o fart fart.c
fart.c:6:22: warning: format specifies type 'void *' but the argument has type
      'char *' [-Wformat-pedantic]
  printf("%p: %s\n", one_one, one_one);
          ~~         ^~~~~~~
          %s
fart.c:8:22: warning: format specifies type 'void *' but the argument has type
      'char *' [-Wformat-pedantic]
  printf("%p: %s\n", (one_one + 1), (one_one + 1));
          ~~         ^~~~~~~~~~~~~
          %s
2 warnings generated.

> ./fart
0x10b339faa: 11
0x10b339fab: 1

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

Mr SuperAwesome posted:

wtf is even going on in this one
if i had to guess i'd say that it sees the "1" as a string because of the quotes and then decides to use the + as a concatenation operator

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

anthonypants posted:

if i had to guess i'd say that it sees the "1" as a string because of the quotes and then decides to use the + as a concatenation operator
Nope. That references pointer+1 of the char array. No such thing as a concatenation operator in C. Only pain.

Fergus Mac Roich
Nov 5, 2008

Soiled Meat

anthonypants posted:

if i had to guess i'd say that it sees the "1" as a string because of the quotes and then decides to use the + as a concatenation operator

c strings don't work like that. the type of a string literal is either const char[] or const char*(don't remember which it is). pointer arithmetic is the correct answer.

Edit: oops beaten

brap
Aug 23, 2004

Grimey Drawer
it's pointer arithmetic.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

gonadic io posted:

i don't blame you for making that assumption, it's always surprising when the pl thread isn't just arguing about strong vs weak typing

don't you mean static v dynamic typing?

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Luigi Thirty posted:

me (1:30 am): oh drat, the goon ss13 server is restarting. guess i'll do something else for a few minutes until a game starts

me (2:45 am): what have i done



congratulations now you know Swift and Cocoa in addition to ObjC and Cocoa Touch!

update that resume

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

fleshweasel posted:

it's pointer arithmetic.
sorry guys i forgot what thread i was in :sweatdrop:

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
java is cool because it performs well and runs on multiple platforms with very little fuss.

it's boring but it's also predictable and makes large projects easier to deal with than most langs

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

Fergus Mac Roich posted:

c strings don't work like that. the type of a string literal is either const char[] or const char*(don't remember which it is). pointer arithmetic is the correct answer.

Edit: oops beaten
It's just a char[].

BTW, if you ever wonder if you should learn C, you should. It'll make you more careful and you'll have a newfound appreciation for how much even the crappiest high-level language does for you.

anthonypants posted:

sorry guys i forgot what thread i was in :sweatdrop:
I think it's time it was actually full of chars.

FlapYoJacks
Feb 12, 2009

John Big Booty posted:

It's just a char[].

BTW, if you ever wonder if you should learn C, you should. It'll make you more careful and you'll have a newfound appreciation for how much even the crappiest high-level language does for you.
I think it's time it was actually full of chars.

Knowing how memory management works at a lower level is always helpful.

And yeah, you appreciate "foo" + "bar" a hell of a lot more when you come from C.

Fergus Mac Roich
Nov 5, 2008

Soiled Meat

John Big Booty posted:

It's just a char[].

BTW, if you ever wonder if you should learn C, you should. It'll make you more careful and you'll have a newfound appreciation for how much even the crappiest high-level language does for you.
I think it's time it was actually full of chars.

so what happens if you assign to one of the chars? UB?

Edit: even c tells you white lies, of course. virtual memory and all that. i read on this forum somewhere that even when you write asm that's not necessarily what the processor ends up executing.

Fergus Mac Roich fucked around with this message at 19:30 on Jul 19, 2017

Adbot
ADBOT LOVES YOU

Arcsech
Aug 5, 2008
TIL there's a project that implements the mongo api/wire protocol over postgres, for when you realize you've made a terrible mistake by using mongo for anything: https://github.com/torodb/server

  • Locked thread