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
Space Kablooey
May 6, 2009


a hot gujju bhabhi posted:

True, and occasionally he does take it upon himself to ask me to double check his poo poo, but I feel like it's ridiculous that I can't trust this person to do the simple stuff (we're paid equally and share the exact same position, which is what may be underpinning my frustration to be honest).

I'm too tired to continue fake-ragging on you, but the idea of code review isn't that (necessarily) you don't trust the other people. The idea is that you do code review so stupid poo poo (like typos, and wrong tabbing, and horrible code, and, and) has a second chance to be caught before the stupid poo poo gets to be a problem in production.

Adbot
ADBOT LOVES YOU

Dongsturm
Feb 17, 2012

Zemyla posted:

No, they require the ability to consciously and selectively disregard typing. Having the ability to remove safety guards from a machine is different from having a machine that doesn't have safety guards in the first place.

E: Shut up, this is boring

Dongsturm fucked around with this message at 06:40 on Jun 18, 2017

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

HardDiskD posted:

I'm too tired to continue fake-ragging on you, but the idea of code review isn't that (necessarily) you don't trust the other people. The idea is that you do code review so stupid poo poo (like typos, and wrong tabbing, and horrible code, and, and) has a second chance to be caught before the stupid poo poo gets to be a problem in production.

I know but it's also not some excuse to be as sloppy as you like so that someone else can find all your typos, hosed up indentations and miscapitalisations etc later on. That's my point. He makes zero effort to do his own due diligence.

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?

itskage posted:

The first bit aside, It's crazy how long it takes some people to realize you can just return the result of the test and not have to explicitly write true : false all over the drat place.

But what a Boolean is a byte in your language/platform you might otherwise want to return something else like file not found, eh smart guy?

ThisIsNoZaku
Apr 22, 2013

Pew Pew Pew!
I'm working on a legacy application which is essentially a giant pile of Java Servlets written by a self-taught programmer. The entire thing is a spaghetti mess, with lots of state clumsily passed around via the session; if one of them wants to make, say, a User object available in the session, it puts the User id primitive into the session and the other end pulls that out, goes to the UserManager and calls a static method to get the User again. I'm trying to fix it up to make it easier to add new clients but I had to stop my refactoring when I realized I was basically rewriting it from scratch and had to start over with much lowered expectations and I've still had to make changes in nearly every file.

Here, however, is hands down the dumbest thing I've seen in this project:

code:
Object value = waitTime(userId);
if(value.getClass().equals(Integer.class){
    map.put("wait time", value);
} else {
    map.put("position", value);
}
code:
public Object waitTime(Long userId){

    int xxx = 1;

    for(Long id : UserManager.aStaticMethodToGetaMapOfLongsToUsers.keys()){

       if(id != userId){

            xxx++;

        } else {

            break;

        }

    }


   return xxx;
}
I might have left out some of the whitespace in waitTime.

ThisIsNoZaku fucked around with this message at 19:19 on Jun 18, 2017

Mr Shiny Pants
Nov 12, 2012

This sounds eerily like MVC 5 where you have a User property which holds the ID, if you want the user you make a call to the UserManager and get the full user.

I don't know if this is good or bad. :ohdear:

Mr Shiny Pants fucked around with this message at 12:06 on Jun 18, 2017

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Snak posted:

New thread title?

john donne
Apr 10, 2016

All suitors of all sorts themselves enthral;

So on his back lies this whale wantoning,

And in his gulf-like throat, sucks everything

That passeth near.

ThisIsNoZaku posted:

Here, however, is hands down the dumbest thing I've seen in this project:

But... Why? What requirement is this fulfilling?

Space Kablooey
May 6, 2009


a hot gujju bhabhi posted:

I know but it's also not some excuse to be as sloppy as you like so that someone else can find all your typos, hosed up indentations and miscapitalisations etc later on. That's my point. He makes zero effort to do his own due diligence.

Ah, that's hosed up then.

idiotmeat
Apr 3, 2010

ThisIsNoZaku posted:

Here, however, is hands down the dumbest thing I've seen in this project:

How self taught can lead to that is really mind boggling.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

john donne posted:

But... Why? What requirement is this fulfilling?

My theory is that he only half-understands what a map does. He knows that you can put stuff into a map and get all the things out of it by iterating through all the keys (probably found how to do that on codeproject). He doesn't understand that if you know the individual key, you can get the value out of the map.

Absurd Alhazred
Mar 27, 2010

by Athanatos

ThisIsNoZaku posted:

code:
Object value = waitTime(userId);
if(Object.getClass().equals(Integer.class){
    map.put("wait time", value);
} else {
    map.put("position", value);
}

I think you meant value.getClass(), rather than Object.getClass(). :v:

Dr. Stab
Sep 12, 2010
👨🏻‍⚕️🩺🔪🙀😱🙀

Bruegels Fuckbooks posted:

My theory is that he only half-understands what a map does. He knows that you can put stuff into a map and get all the things out of it by iterating through all the keys (probably found how to do that on codeproject). He doesn't understand that if you know the individual key, you can get the value out of the map.

Except he's not getting anything out of the map. He's iterating over the keyset and returning values based on when the iterator happens to yield a certain key (which is unspecified behaviour) while also assigning all ids not in the keyset a value equal to the size of the map +1. I hope the values aren't supposed to be unique and that elements are never removed from the map.

It also must be very old if it doesn't use generics.

ThisIsNoZaku
Apr 22, 2013

Pew Pew Pew!

Absurd Alhazred posted:

I think you meant value.getClass(), rather than Object.getClass(). :v:

Yep, you're right. Fixed.

Dr. Stab posted:

It also must be very old if it doesn't use generics.

It was written in Java 6 and does use generics, just not there.

Another funny thing, if the method returns the position in the queue as an Integer, it is put into the container with the key "wait time" but if anything else it is put in with the key "position"!

I will give the man his due, however, my understanding is the thing has been running fairly smoothly in production for years. It's just a nightmare to change anything.

ThisIsNoZaku fucked around with this message at 19:33 on Jun 18, 2017

zergstain
Dec 15, 2005

Wouldn't it be impossible for it to be anything other than Integer? The value the method returns is an int, which would be converted to Integer if I remember the autoboxing rules correctly.

ThisIsNoZaku
Apr 22, 2013

Pew Pew Pew!

zergstain posted:

Wouldn't it be impossible for it to be anything other than Integer? The value the method returns is an int, which would be converted to Integer if I remember the autoboxing rules correctly.

:thejoke:

Also, there is a Number class which is the supertype of all the boxed number classes so there's no need to go all the way up to Object even if this ridiculous thing is what you actually want to do.

And if that's the case, maybe you need to use a different language.

ThisIsNoZaku fucked around with this message at 20:54 on Jun 18, 2017

Dr. Stab
Sep 12, 2010
👨🏻‍⚕️🩺🔪🙀😱🙀

ThisIsNoZaku posted:

:thejoke:

Also, there is a Number class which is the supertype of all the boxed number classes so there's no need to go all the way up to Object even if this ridiculous thing is what you actually want to do.

And if that's the case, maybe you need to use a different language.

Well, the non-generic version of Map maps from objects to objects. Implicit conversions are for the weak. Except, of course, on the first line where he boxes an int and then casts it to an object.

I'm amazed that this code is part of anything that does anything. What it ends up doing is very small for the amount of code it takes up, and doesn't really seem like a thing you'd want to do in the first place.

ThisIsNoZaku
Apr 22, 2013

Pew Pew Pew!
It turns out I hosed up! I had changed it and was misremembering the old code, that map is used elsewhere.

code:
public static Object getWaitTime(SomeEnum nameOfQueueToGet, String client){
    
    ConcurrentLinkedQueue<String> queue = aPrivateStaticMethodToGetTheQueue(nameOfQueueToGet);

     int xxx = 1;

    for (String id : queue) {

       if(id.equals(client)){

            return xxx;
        
       } 

        xxx++;

    }

    return xxx++;

 }
code:
public static int getWaitTime(SomeEnum type, User client){
    return Arrays.asList(getQueue(type).toArray()).indexOf(client) + 1;
}
This method should just be excised completely but I've got to pick my battles right now.

Edit: Forgot all the extra whitespace!

ThisIsNoZaku fucked around with this message at 22:29 on Jun 18, 2017

ThisIsNoZaku
Apr 22, 2013

Pew Pew Pew!
More :cry:

This application has a ColdFusion front end running on a dev server. You have to go into the ColdFusion config and tell it to direct traffic to the instance running on your dev machine and restart it.

Only one person can work on it at a time.

Edit:

I forgot about this one.

code:
public static ArrayList<User> getSomeUsers(){
    ArrayList<User> someUsers= new ArrayList<User>();
    for (User user: SomeOtherClass.getSomeUsers()){
        someUsers.add(user);
    }
    return someUsers;
}

ThisIsNoZaku fucked around with this message at 23:48 on Jun 18, 2017

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

HardDiskD posted:

Ah, that's hosed up then.

In fairness to you I explained it poorly.

TheresaJayne
Jul 1, 2011

Mr Shiny Pants posted:

This sounds eerily like MVC 5 where you have a User property which holds the ID, if you want the user you make a call to the UserManager and get the full user.

I don't know if this is good or bad. :ohdear:

This reminds me of a VB 6 program i once had to rewrite to add the functionality the original developer failed to add.

Back then you would do something like

Global Dim Username
Global Dim UserID

so that you had in the running app the username and id.

The original developer had booked a one day OOP course and failed to attend,
(this was back in 1999)

He had

code:
Class UserRecord 
Begin
   Dim userName as UserNameRecord
   Dim userPassword as UserPasswordRecord
End

Class UserNameRecord
Begin
   Dim userName as String
End

Class UserPasswordRecord
Begin
  Dim password as String
End

NihilCredo
Jun 6, 2011

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

TheresaJayne posted:

The original developer had booked a one day OOP course and failed to attend,
(this was back in 1999)

He had

Information Hiding, Single Responsibility, and Type-Driven Development. This guy was a pro.

Or as they were called in 1999, "eXXXXXXtreme".

Mr Shiny Pants
Nov 12, 2012

NihilCredo posted:

Information Hiding, Single Responsibility, and Type-Driven Development. This guy was a pro.

Or as they were called in 1999, "eXXXXXXtreme".

Yeah it also kinda reminded me of the F# for fun and profit working with types examples. Don't know if VB6 would be the right language......

Jarl
Nov 8, 2007

So what if I'm not for the ever offended?
A few weeks ago I had to fix a crippling bug in production during the weekend. Found this compareTo Java method which obviously was plain wrong, and after a little back-of-the-envelope doodling I concluded it definitely was the cause of our bug. It was.

That it is non-transitive is only one of its faults.

Original:
code:
    @Override
    public int compareTo(QueryResultPatientParameter o) {
        final int keyCompare = this.getKey().compareTo(o.getKey()); 
  	 	final int typeCompare = this.getType() != null && o.getType() != null ? this.getType().compareTo(o.getType()) : 0; 
        return keyCompare + typeCompare; 
    }
The guy who wrote it is actually really competent, and one I respect and admire, but the day he wrote this he must have had an aneurysm.

Fixed:
code:
     @Override
    public int compareTo(QueryResultPatientParameter o) {
        final int keyCompare = this.getKey().compareTo(o.getKey());
        
        if (keyCompare == 0) {
            if (this.getType() != null) {
                if (o.getType() != null) {
                    return this.getType().compareTo(o.getType());
                } else {
                    return 1;
                }
            } else {
                if (o.getType() == null) {
                    return 0;
                } else {
                    return -1;
                }
            }
        } else {
            return keyCompare;
        }
    }

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
code:
    @Override
    public int compareTo(QueryResultPatientParameter o) {
        return ComparisonChain.start()
            .compare(this.getKey(), o.getKey())
            .compare(this.getType(), o.getType(), Ordering.natural().nullsFirst())
            .result();
    }
yw

Jarl
Nov 8, 2007

So what if I'm not for the ever offended?

Jabor posted:

code:
    @Override
    public int compareTo(QueryResultPatientParameter o) {
        return ComparisonChain.start()
            .compare(this.getKey(), o.getKey())
            .compare(this.getType(), o.getType(), Ordering.natural().nullsFirst())
            .result();
    }
yw

Nice.

Coffee Mugshot
Jun 26, 2010

by Lowtax
Orderings.natural.nulllsFirst sounds like something you say while cursing a hoodoo bag.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Jarl posted:


The guy who wrote it is actually really competent, and one I respect and admire, but the day he wrote this he must have had an aneurysm.


I always like to see these. Even the best of us have bad days.

Not that I'm among the "best of us", but most of my "oh god thats super dumb" mistakes happen because I'm doing lots of editing across a couple of different locations and I start conflating what I'm doing in one place with what I'm doing in another place. Or I'm just trying something out and then never do it right.

canis minor
May 4, 2011

Same here - though there's always a difference between working with somebody that has a bad day, working with somebody that is overworked and wants to provide results as quickly as possible (for example, I think the other dev in the company I started working at belong to this category, as while his layers of code are consistent within the layer, but inconsistent between times he did them, if that makes sense) and working with people that don't have a clue what they're doing (or care to understand). It's also a shame when a lead cannot say: this is what we're doing, this is how we should do it, this is how we're going to approach the problem.

Meanwhile - I've had fun installing Cordova / Java:
- installed npm, cordova, java without problems
- setup 4 paths in environment variables (for Java and Android Studio; paths for Android Studio are not in the place where documentation specifies)
- trying to build cordova hello app - fails with message saying that it can't find the ADV
- trying to find ADV Manager in Android Studio - it's not in the place any documentation specifies; managed to find it via "Search everything"
- managed to install it, again running build, message saying my Java path is wrong
- changed the paths, no result
- actually message about paths being wrong means that Java doesn't have enough memory to run VM; setting _JAVA_OPTIONS with 2048M fixes it
- trying to build again, build completed without problems
- trying to install plugin for geolocation - manage to reinstall JRE, overwriting my previous installation and issuing an 1803 error; I can't build cordova app anymore
- install, reinstall Java - getting error 1803; nothing on the Java documentation page regarding this problem works; Java Control Panel doesn't run, nothing runs
- removed _JAVA_OPTIONS from my environment variables, Java can install again
- try to build again - message says my Java path is wrong
- add back _JAVA_OPTIONS with 2048M - message says my Java path is wrong
- change _JAVA_OPTIONS to 512M - cordova builds succesfully

Logic!

canis minor fucked around with this message at 13:50 on Jun 20, 2017

comedyblissoption
Mar 15, 2006

https://groups.google.com/forum/#!topic/golang-nuts/Oo5s6ryBCYI

Pollyanna
Mar 5, 2005

Milk's on them.



YOLO, i want better structure to program faster, i might not be doing the right thing because i ain t yet understood the language correctly, yet, i want to benefit the whole environment provided by it, ultimately, that i m right or wrong, does not matter in the immediate terms of getting productive, i m only looking for ways to program faster by reducing all those additional constructs.

FrantzX
Jan 28, 2007
Python code:
def _ReadLong(fs, endian = _DEFAULT_ENDIAN):
    return struct.unpack(endian + 'l', fs.read(4))[0]

def _ReadLong64(fs, endian = _DEFAULT_ENDIAN):
    return struct.unpack(endian + 'q', fs.read(8))[0]
Why would you choose these function names?

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

FrantzX posted:

Python code:
def _ReadLong(fs, endian = _DEFAULT_ENDIAN):
    return struct.unpack(endian + 'l', fs.read(4))[0]

def _ReadLong64(fs, endian = _DEFAULT_ENDIAN):
    return struct.unpack(endian + 'q', fs.read(8))[0]
Why would you choose these function names?

Because on the one system you checked, longs were 32-bit, but you needed a 64-bit type? :shrug:

"long" is not a strictly-defined term in C-likes IIRC, which is why most languages are now making the number of bits explicit in the type names.

Smoke_Max
Sep 7, 2011


I'm stunned by the simplicity and brutal practicality.

feedmegin
Jul 30, 2008

TooMuchAbstraction posted:

"long" is not a strictly-defined term in C-likes IIRC, which is why most languages are now making the number of bits explicit in the type names.

To include C/C++ - check out stdint.h.

Eela6
May 25, 2007
Shredded Hen

Don't doxx me

(I am getting acclimated to go, but I will never forgive them not having a loving set type with intersection, union, and difference methods. What the gently caress.)

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Eela6 posted:

(I am getting acclimated to go, but I will never forgive them not having a loving set type with intersection, union, and difference methods. What the gently caress.)

The number of things that would be one-liners in a language with generics that become tedious for loops in Go is enormous. They're simple, easy to write, and all over the goddamn place so you're liable to accidentally gently caress one of them up sometime, resulting in subtle bugs because your eyes just gloss over them.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

boo_radley
Dec 30, 2005

Politeness costs nothing

The npm maintainers are the bane of my existence

boo_radley fucked around with this message at 00:45 on Jun 22, 2017

Adbot
ADBOT LOVES YOU

Absurd Alhazred
Mar 27, 2010

by Athanatos
https://twitter.com/jennschiffer/status/877705092043907072

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