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
Absurd Alhazred
Mar 27, 2010

by Athanatos
That's a load-bearing performance hit.

Adbot
ADBOT LOVES YOU

Polio Vax Scene
Apr 5, 2009



Today's highlights for a c# developer we hired with "10 years of c# experience" includes a pull request with the following
code:
var markup;
code:
if (payrate1 != 0 and payRate1 != null)

Tei
Feb 19, 2011

Why is that bad?

I could tell defining a variable withouth type is fishy.

Ignoring user-case is a read flag.

Do this language give "and" and "&&" a different use?

Is that a float?

Maybe is 10 years of experience alone, writing some awnful stuff all by himself for himself.

raminasi
Jan 25, 2005

a last drink with no ice

Tei posted:

Why is that bad?

I could tell defining a variable withouth type is fishy.

Ignoring user-case is a read flag.

Do this language give "and" and "&&" a different use?

Is that a float?

Maybe is 10 years of experience alone, writing some awnful stuff all by himself for himself.

Neither of those compile. C# (before 9.0, where it's used in a completely different place) doesn't even have an and keyword.

Tei
Feb 19, 2011

raminasi posted:

Neither of those compile. C# (before 9.0, where it's used in a completely different place) doesn't even have an and keyword.

Oh, then this guy was a PHP developer, or had a "learn PHP in 10 hours" course, because both "var" and "and" are syntactically correct (sorta) in PHP*.... but would still raise many eyebrows.

He lied about the C# experience.


*I think, I have not used var in attributes in many years. Maybe is only a js thing?

Tei fucked around with this message at 17:23 on Nov 12, 2021

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER

Tei posted:

Oh, then this guy was a PHP developer, or had a "learn PHP in 10 hours" course, because both "var" and "and" are syntactically correct (sorta) in PHP*.... but would still raise many eyebrows.

He lied about the C# experience.


*I think, I have not used var in attributes in many years. Maybe is only a js thing?

I think javascript ides will yell at you if you don't use const and let

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
In addition to the syntax problems, does payrate1 != 0 && payRate1 != null not crash in C#? IIRC, it would in Java, assuming it has type Integer.

EDIT: assuming the implied lack of precondition

rjmccall fucked around with this message at 20:36 on Nov 12, 2021

Hammerite
Mar 9, 2007

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

rjmccall posted:

In addition to the syntax problems, does payrate1 != 0 && payRate1 != null not crash in C#? IIRC, it would in Java, assuming it has type Integer.

EDIT: assuming the implied lack of precondition

code:
using System;

public class Program
{
    static void Main(string[] args)
    {
        var c1 = new C();
        var c2 = new C();

        Console.WriteLine("c1 == 0:         " + (c1 == 0        ).ToString());
        Console.WriteLine("c1 == 1:         " + (c1 == 1        ).ToString());
        Console.WriteLine("c1 != 0:         " + (c1 != 0        ).ToString());
        Console.WriteLine("c1 != 1:         " + (c1 != 1        ).ToString());
        Console.WriteLine();
        Console.WriteLine("c1 == c2:        " + (c1 == c2       ).ToString());
        Console.WriteLine("c1 != c2:        " + (c1 != c2       ).ToString());
        Console.WriteLine("c1 == null as C: " + (c1 == null as C).ToString());
        Console.WriteLine("c1 != null as C: " + (c1 != null as C).ToString());
        // Compiler error CS0034 Operator is ambiguous
        //Console.WriteLine("c1 == null:      " + (c1 == null     ).ToString());
        //Console.WriteLine("c1 != null:      " + (c1 != null     ).ToString());
        Console.WriteLine();
        // Compiler warning CS0472 The result of the expression is always false/always true
        Console.WriteLine("0  != null:      " + (0 == null     ).ToString());
        Console.WriteLine("0  != null:      " + (0 != null     ).ToString());
        Console.WriteLine();

        int x = 0;
        // CS0472 The result of the expression is always true
        Console.WriteLine((x != 0 && x != null).ToString());
    }
}

public class C
{
    public static bool operator ==(C c,  int i ) => true;
    public static bool operator !=(C c,  int i ) => false;
    public static bool operator ==(C c1, C   c2) => true;
    public static bool operator !=(C c1, C   c2) => false;
    public static bool operator ==(C c,  D   d ) => true;
    public static bool operator !=(C c,  D   d ) => false;
}

public class D
{}
code:
c1 == 0:         True
c1 == 1:         True
c1 != 0:         False
c1 != 1:         False

c1 == c2:        True
c1 != c2:        False
c1 == null as C: True
c1 != null as C: False

0  != null:      False
0  != null:      True

False

raminasi
Jan 25, 2005

a last drink with no ice

rjmccall posted:

In addition to the syntax problems, does payrate1 != 0 && payRate1 != null not crash in C#? IIRC, it would in Java, assuming it has type Integer.

EDIT: assuming the implied lack of precondition

It will work fine if payrate1 is a Nullable<int>, which is a value type with an overloaded == that behaves sensibly in both of those situations. (Although you can definitely write that conjunction less confusingly - I'd personally probably do payRate1.HasValue && payRate1 != 0.) If payrate1 is just an int or something it will always not be equal to null, which I actually did not realize until I just checked right now.

raminasi fucked around with this message at 21:27 on Nov 12, 2021

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Okay, it sounds like C# never does implicit unboxing the way Java does. In Java, payrate1 != 0 (when payrate1 is of type Integer) is exactly equivalent to payrate1.intValue() != 0, and so can throw if payrate1 is null (making the second half of the && meaningless). C# apparently wouldn’t have this problem because it wouldn’t let this code compile in the first place unless you used something like Nullable.

Eggnogium
Jun 1, 2010

Never give an inch! Hnnnghhhhhh!
Well the fact that neither line can even compile means they are a bad developer in any language because they don’t test their code.

take boat
Jul 8, 2006
boat: TAKEN
that's what the pull request CI integration is for!

but also seriously, that is what it's for

ToxicFrog
Apr 26, 2008


take boat posted:

that's what the pull request CI integration is for!

but also seriously, that is what it's for

I mean, that is what it's for, but ideally you feed it to CI and see if it falls over before you send it for code review

OddObserver
Apr 3, 2009

ToxicFrog posted:

I mean, that is what it's for, but ideally you feed it to CI and see if it falls over before you send it for code review

Let he who never forgot to cast the first rollback.

take boat
Jul 8, 2006
boat: TAKEN

ToxicFrog posted:

I mean, that is what it's for, but ideally you feed it to CI and see if it falls over before you send it for code review

I definitely agree with you there, I just mean it's an automated way to enforce the social contract of not merging broken code. and if someone is opening failing PRs, you can tell them to fix it before they get approval

raminasi
Jan 25, 2005

a last drink with no ice

rjmccall posted:

Okay, it sounds like C# never does implicit unboxing the way Java does. In Java, payrate1 != 0 (when payrate1 is of type Integer) is exactly equivalent to payrate1.intValue() != 0, and so can throw if payrate1 is null (making the second half of the && meaningless). C# apparently wouldn’t have this problem because it wouldn’t let this code compile in the first place unless you used something like Nullable.

If I understand boxing correctly, there’s no box in the first place. You’d never get a NullReferenceException because there’s no reference to be null.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
C# does have a form of boxing where you can convert value types to various types which are defined to be reference types, like System.Object or System.ValueType. But the unified model in the language largely hides this from you in e.g. the dynamic type of the reference; it’s only formally exposed by things like ReferenceEquals.

raminasi
Jan 25, 2005

a last drink with no ice

rjmccall posted:

C# does have a form of boxing where you can convert value types to various types which are defined to be reference types, like System.Object or System.ValueType. But the unified model in the language largely hides this from you in e.g. the dynamic type of the reference; it’s only formally exposed by things like ReferenceEquals.

Ok, I should have been more specific - boxes are not usually necessary or even common, so reading an isolated line of code like that, I wouldn't assume boxing is happening. But when it is, you are correct, C# does not implicitly unbox.

ToxicFrog
Apr 26, 2008


OddObserver posted:

Let he who never forgot to cast the first rollback.

I've been spoiled working at a place where attempting to send something for review automatically runs CI on it and refuses to notify the review until it passes.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


That must be so nice. I had to work with a system where the only way I could compile my changes against the libraries that depended on them was to submit a PR, and it notified the entire team who owned that library on every build attempt.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

ToxicFrog posted:

I've been spoiled working at a place where attempting to send something for review automatically runs CI on it and refuses to notify the review until it passes.

Yeah, this is really quite nice. Targets are built and tests are run before another person is told it's ready. You can override that, but it's a fantastic way to find out that the "harmless" last minute change is busted before it goes out.

Macichne Leainig
Jul 26, 2012

by VG

ToxicFrog posted:

I've been spoiled working at a place where attempting to send something for review automatically runs CI on it and refuses to notify the review until it passes.

I had this at my old job which was a C# shop but they had quite a bit of legacy code that would just randomly break your build for no reason so you might have to queue your CI 2-3 times to have it finally go through.

I think they finally cut that flaky legacy poo poo out this year from what I've heard from friends who still work there, so that's good at least.

Tei
Feb 19, 2011

I have plans to do some game engine programming with Quake. So I rebuilded a old computer, installed a SSD and the last versions of windows and compilers.

A observation is compiling speed don't feel any faster since 2005 / 2002.
The UI to choose things like output target and stuff is still a mess and with zero usability.

Fortunally making this old codebase to work again was simple. I just had to disable some SAFEsomething flag, and blacklist LIBC.lib from the list of libraries. I had first to install some extra compability layers because this Visual Studio thing did not supported any of the the 3 the proyect already had (I believe that was sln).


Since the original game is from 1996 don't really support a 16x9 monitor and defaults to fullscreen. Going back and from the game is horrible. If the debugger trigger in the middle of the game, with the resolution different than the desktop one, I had to use the task manager to return to the debugger (arggh) and it was in 640x400 resolution. Debuggers and IDE's are not any smarter than in 2005.

I am surprised with how littel has changed.

One of the first thing I will have to do is to force this game to run in window-borderless mode. Will probably be smoother to debug that way.

Bethesda has released a new version of Quake this year, but they don't seems interested in releasing the source code (they have not reason to, but would be nice). John Carmack have asked them to do so, but they just ignored him.

ToxicFrog
Apr 26, 2008


Protocol7 posted:

I had this at my old job which was a C# shop but they had quite a bit of legacy code that would just randomly break your build for no reason so you might have to queue your CI 2-3 times to have it finally go through.

I think they finally cut that flaky legacy poo poo out this year from what I've heard from friends who still work there, so that's good at least.

One of the many really nice things about the setup we have here is that it maintains some history for each test, so it can report not just the results of your test run but how that compares to previous runs, and even make an educated guess about flakiness (e.g. "if this test got run multiple times on the same commit and passed only some of the time, it's flaky")

So a CI run will group the results into "passing", "used to be broken but you fixed it", "used to be passing but you broke it", "still broken", and "flaky", and you can focus on the "you broke it" results; there's even an option to automatically rerun flaky tests a few times and report back what proportion of runs passed!

F4rt5
May 20, 2006

Tei posted:

I have plans to do some game engine programming with Quake. So I rebuilded a old computer, installed a SSD and the last versions of windows and compilers.

A observation is compiling speed don't feel any faster since 2005 / 2002.
The UI to choose things like output target and stuff is still a mess and with zero usability.

Fortunally making this old codebase to work again was simple. I just had to disable some SAFEsomething flag, and blacklist LIBC.lib from the list of libraries. I had first to install some extra compability layers because this Visual Studio thing did not supported any of the the 3 the proyect already had (I believe that was sln).


Since the original game is from 1996 don't really support a 16x9 monitor and defaults to fullscreen. Going back and from the game is horrible. If the debugger trigger in the middle of the game, with the resolution different than the desktop one, I had to use the task manager to return to the debugger (arggh) and it was in 640x400 resolution. Debuggers and IDE's are not any smarter than in 2005.

I am surprised with how littel has changed.

One of the first thing I will have to do is to force this game to run in window-borderless mode. Will probably be smoother to debug that way.

Bethesda has released a new version of Quake this year, but they don't seems interested in releasing the source code (they have not reason to, but would be nice). John Carmack have asked them to do so, but they just ignored him.
This... This must be a joke right?

Hammerite
Mar 9, 2007

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

F4rt5 posted:

This... This must be a joke right?

wh-why should it b-b-b-be a j-joke?

Xarn
Jun 26, 2015
It's Tei, I still don't know if they are gimmick posting or not. :shrug:

Spatial
Nov 15, 2007

Sounds pretty real and familiar to me (I've been working on the Homeworld source lately lol)

It does compile faster though, enable multiprocessor compilation Tei!

chglcu
May 17, 2007

I'm so bored with the USA.
Debugging true exclusive full screen games is still a pain in the rear end last I checked, but I wouldn’t blame the debugger or IDE for it. It’s really more of a OS or possibly display mode switching standard thing.

ExcessBLarg!
Sep 1, 2001
Remote debugging?

Tei
Feb 19, 2011

Spatial posted:

Sounds pretty real and familiar to me (I've been working on the Homeworld source lately lol)

It does compile faster though, enable multiprocessor compilation Tei!

Oh, cool. It did not had sound when it got released. But I imagine somebody added fmod or something to it.
Is a sweet game and cool engine. Hope you have fun with it.

I will check the multiprocessor thing. I don't really have to rebuild everything often, is generally only one C file, but I am surprised is not much faster. Moving around code is also kind of slow... compared to the vscode build around atom.

After posting that I was able to use fullscreen, it works and is smooth :D

Hammerite
Mar 9, 2007

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

quote:

The password rules are as follows:

Must be a minimum of 8 and a maximum of 20 characters in length
Must be a combination of alphabetical and at least 2 numerical characters
The password must not contain any spaces
The only allowed characters are upper case and lower case letters and numbers
The password is case sensitive

🤔

Falcorum
Oct 21, 2010

*proceeds to silently truncate the password in some situations anyway*

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

Falcorum posted:

*proceeds to silently truncate the password in some situations anyway*

Hi {username},

Thank you for registering! Your login details are

Username: will@storedintheballs.com
Password: p33p33p33p33

Your password will expire in 90 days, after which you’ll need to choose a new password. If you do not pick a new password within 7 days, your account will be frozen until you speak to one of our site admins to reset your password.

Regards,
Admin team

Rubellavator
Aug 16, 2007

"is there a way we can run all the tests but skip the failures" - a senior dev

csammis
Aug 26, 2003

Mental Institution
...well, is there?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
And if there is, let's turn it off!

qsvui
Aug 23, 2003
some crazy thing
why not both? https://github.com/auchenberg/volkswagen

Absurd Alhazred
Mar 27, 2010

by Athanatos
https://twitter.com/d_feldman/status/1466248315029409798

Adbot
ADBOT LOVES YOU

Tei
Feb 19, 2011

Rubellavator posted:

"is there a way we can run all the tests but skip the failures" - a senior dev

./unit-tests 2>/dev/null

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