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
NihilCredo
Jun 6, 2011

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

leper khan posted:

return to C

It's the best lang. At this point it's picking up useful features faster than C++, so it has my money as the C++ killer.

how's the weather in stockholm this time of the year

Adbot
ADBOT LOVES YOU

Sapozhnik
Jan 2, 2005

Nap Ghost

Soricidus posted:

it feels like the key is minimalism

ruby on rails offered minimal code. implement your whole app with this one-liner! easy sell.

golang offers minimal expressivity. you can’t write clever terse code so what you do write will definitely be very readable! easy sell, to idiots.

rust and haskell offer safety in exchange for learning a bunch of unfamiliar new ideas and different ways to do things, which is … not such an easy sell.

learn arm64 asm in that case

all you need is memory and gprs. no ivory tower abstraction bullshit like "strings" or "memory management" to get in the way of you writing clear and easy-to-understand code

if you're using more than 16 local variables you should probably refactor anyway

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

NihilCredo posted:

how's the weather in stockholm this time of the year

Austin, and it's Hot Season.

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


leper khan posted:

Austin, and it's Hot Season.

Austin Syndrome is probably something else entirely

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Armitag3 posted:

Austin Syndrome is probably something else entirely

e.g. it might be an actual thing

InternetOfTwinks
Apr 2, 2011

Coming out of my cage and I've been doing just bad
Trying to figure out if I'm the terrible programmer or .NET just sucks, trying to get the value of a nullable reflected parameter and it is, just not returning it. Something's causing the parameter to just return as null regardless of if a value is present. Of course, now that I've said something I'll probably crack it in the next 20 minutes heh.

NihilCredo
Jun 6, 2011

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

InternetOfTwinks posted:

Trying to figure out if I'm the terrible programmer or .NET just sucks, trying to get the value of a nullable reflected parameter and it is, just not returning it. Something's causing the parameter to just return as null regardless of if a value is present. Of course, now that I've said something I'll probably crack it in the next 20 minutes heh.

wdym 'reflected'

what sort of hellworld dynamic code are you trying to write

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
if you're doing reflection bullshit then it's the time to be really careful about your terminology. what the heck do you mean by "parameter" here?

- generic type parameters aren't nullable, so probably not that?
- method parameters passed in to your method can be trivially accessed without bothering with reflection, so probably not that either?
- anything else has a better name that isn't "parameter"

LanceHunter
Nov 12, 2016

Beautiful People Club


Armitag3 posted:

Austin Syndrome is probably something else entirely

Austin Syndrome is just a fancy way of saying high-functioning alcoholism.

Plank Walker
Aug 11, 2005

LanceHunter posted:

Austin Syndrome is just a fancy way of saying high-functioning alcoholism.

that's stone cold steve austin syndrome

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

LanceHunter posted:

Austin Syndrome is just a fancy way of saying high-functioning alcoholism.

What's the equivalent when you don't drink?

InternetOfTwinks
Apr 2, 2011

Coming out of my cage and I've been doing just bad

NihilCredo posted:

wdym 'reflected'

what sort of hellworld dynamic code are you trying to write

Basically it's logging changes in entities by grabbing the original entity from the database and comparing it to the new one. Only guarantee is that it derives from the base Entity class so it's grabbing all the properties through reflection for comparison. I'm still wrapping my head around how exactly it's doing it myself, did not write this functionality just responsible for fixing it. Might just be easier to write a comparison method to get the changes and override it in the child classes or something, trying to make it fully generic and apply to everything all at once is proving... taxing.

InternetOfTwinks fucked around with this message at 18:05 on Aug 9, 2022

matti
Mar 31, 2019

code:
static void
insert_character(wchar_t character)
{
	/* This is unsafe if the wide character I/O implementation maps
	 * multiple wide characters to a single multi-byte character. For
	 * example, both U+003C "LESS-THAN SIGN" and U+FE64 "SMALL LESS-THAN
	 * SIGN" could map to '<'. But such implementation would be broken for
	 * any kind of structured output anyway. */

	switch (character) {
	case L'&':
		print(L"&amp;");
		break;
	case L'<':
		print(L"&lt;");
		break;
	case L'>':
		print(L"&gt;");
		break;
	default:
		print(L"%lc", character);
	}
}
is this a realistic worry and an acceptable conclusion?

Shaggar
Apr 26, 2006

InternetOfTwinks posted:

Basically it's logging changes in entities by grabbing the original entity from the database and comparing it to the new one. Only guarantee is that it derives from the base Entity class so it's grabbing all the properties through reflection for comparison. I'm still wrapping my head around how exactly it's doing it myself, did not write this functionality just responsible for fixing it. Might just be easier to write a comparison method to get the changes and override it in the child classes or something, trying to make it fully generic and apply to everything all at once is proving... taxing.

that sounds like some entity framework bullshit. do not use entity framework. do not attempt to make your own version of entity framework. the entire concept of an entity layer between your code and the db is loving stupid

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.
I need some help workshopping an opinion

pull requests were made either in fact or in practice by GitHub, to allow untrusted third parties contribute to open source code bases. but in a software development team, if you don't trust someone to modify the code, you should just fire them.

this leads to, what, recommending everyone just commit on the trunk? do you do code reviews before you push commits? pull requests are used to dissect and review code, how do you still get knowledge transfer and catch each other's gotchas, just write the tests with those in mind?

InternetOfTwinks
Apr 2, 2011

Coming out of my cage and I've been doing just bad

Shaggar posted:

that sounds like some entity framework bullshit. do not use entity framework. do not attempt to make your own version of entity framework. the entire concept of an entity layer between your code and the db is loving stupid

It is indeed entity framework bullshit. Namaste.

Xarn
Jun 26, 2015
Just use pull requests and gated merge.

YMMV if you have massive churn due to hundreds of devs working on the same repo though

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.

Xarn posted:

Just use pull requests and gated merge.

YMMV if you have massive churn due to hundreds of devs working on the same repo though

this just leads to people arguing about functional vs oop or whatever the kids argue about these days.

it's like fixing a bug or adding functionality is one thing, and then sharing the codebase knowledge of "there's a function that does this part of that job over here you can reuse", and the last thing of catching unintended effects of code you write is something else entirely, but they're all sloshed together into this one idea of a pull request

InternetOfTwinks
Apr 2, 2011

Coming out of my cage and I've been doing just bad
Cool, I got the go ahead to just rewrite the whole loving thing so I can make it less arcane to work with.

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.
just commit your rewrite directly to the trunk, I think I'm onto something here

Shaggar
Apr 26, 2006
rip out entity framework and use dapper w/ stored procs. litterral 10x speedup and infinitely more maintainable code

mystes
May 31, 2006

Shaggar posted:

that sounds like some entity framework bullshit. do not use entity framework. do not attempt to make your own version of entity framework. the entire concept of an entity layer between your code and the db is loving stupid
the one good shaggar take

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

InternetOfTwinks posted:

Basically it's logging changes in entities by grabbing the original entity from the database and comparing it to the new one. Only guarantee is that it derives from the base Entity class so it's grabbing all the properties through reflection for comparison. I'm still wrapping my head around how exactly it's doing it myself, did not write this functionality just responsible for fixing it. Might just be easier to write a comparison method to get the changes and override it in the child classes or something, trying to make it fully generic and apply to everything all at once is proving... taxing.

last time i had to do something like this i serialized the objects to json and used the newtonsoft libraries to do the comparisons (JToken.DeepEquals calls basically), it worked surprisingly well and the code was much cleaner than loving around in reflection

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


It sounds kind of like someone in the past went "man comparing all these properties is loving boring, I'll just automate it by using reflection" which is not necessarily that bad an idea.

Like I'm guessing it's doing "for each property in foo.getproperties, get the equivalent property from object bar using the property name, and compare"?

so your types should be comparable there so doesn't sound like it's one being nullable vs not, but maybe check if the properties are actually properties (i.e. have a getter and setter) and not fields.

this tripped me up once with MVC model binders (which use reflection internally iirc) because they won't work on fields and i think you'll get a default null returned but you won't know why because nothing is actually failing

Shaggar posted:

rip out entity framework and use dapper w/ stored procs. litterral 10x speedup and infinitely more maintainable code

Shaggar is right

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
i'm going to assume that there's also a library out there that already does object comparison/diffing just fine and if i ever revisit our audit code i'm going to look into that further

e: found this, looks like it might work in a lot of cases: https://github.com/GregFinzer/Compare-Net-Objects/wiki/Getting-Started

also +1 on using dapper whenever possible

Cold on a Cob fucked around with this message at 19:17 on Aug 9, 2022

InternetOfTwinks
Apr 2, 2011

Coming out of my cage and I've been doing just bad
Yeah turns out it was never considered "finished" in the first place so I've basically got carte blanche to do something (hopefully) less terrible instead.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

RokosCockatrice posted:

I need some help workshopping an opinion

pull requests were made either in fact or in practice by GitHub, to allow untrusted third parties contribute to open source code bases. but in a software development team, if you don't trust someone to modify the code, you should just fire them.

this leads to, what, recommending everyone just commit on the trunk? do you do code reviews before you push commits? pull requests are used to dissect and review code, how do you still get knowledge transfer and catch each other's gotchas, just write the tests with those in mind?

commit on trunk and review before release? use branches without pull requests and review before merge?

that first sentence is questionable history and seemingly irrelevant to attempted current use. a pull request is a path of commits, do with it as you please

ArcticZombie
Sep 15, 2010

RokosCockatrice posted:

I need some help workshopping an opinion

pull requests were made either in fact or in practice by GitHub, to allow untrusted third parties contribute to open source code bases. but in a software development team, if you don't trust someone to modify the code, you should just fire them.

this leads to, what, recommending everyone just commit on the trunk? do you do code reviews before you push commits? pull requests are used to dissect and review code, how do you still get knowledge transfer and catch each other's gotchas, just write the tests with those in mind?

It sounds like you're on the road to re-inventing trunk-based development.

Sapozhnik
Jan 2, 2005

Nap Ghost
use pull requests, code reviews by both humans and robots is good. these days there's a whole bunch of ready-to-use linters that you can run from your pull request ci workflow. linters and auto-formatters are invaluable for avoiding stupid bikeshedding tangents, the machine tells you how your code should be formatted and whether particular code constructs should be allowed or not. you can always override specific instances of linter complaints with a comment but then a human reviewer might challenge you on it. configuring your ide to autoformat the entire source file on save should be considered an essential standard practice on the same level as keeping your code in source control in this day and age.

having a human give the code a once-over is good as well if for no other reason than they might say "have you considered (a much simpler and easier-to-understand way of achieving what you were doing)?". on the other hand if you work with a bunch of insufferable neckbeards then they might end up nitpicking all sorts of pointless bullshit.

then you get to have The Merge Workflow Discourse (the correct answer is rebasing btw).

outhole surfer
Mar 18, 2003

RokosCockatrice posted:

I need some help workshopping an opinion

pull requests were made either in fact or in practice by GitHub, to allow untrusted third parties contribute to open source code bases. but in a software development team, if you don't trust someone to modify the code, you should just fire them.

this leads to, what, recommending everyone just commit on the trunk? do you do code reviews before you push commits? pull requests are used to dissect and review code, how do you still get knowledge transfer and catch each other's gotchas, just write the tests with those in mind?

pretty sure pull requests originated from the lkml, not github. github implemented a web ui around the process, but pull requests previously existed as a literal e-mail that requested you pull changes from a repo specified in the e-mail.

InternetOfTwinks
Apr 2, 2011

Coming out of my cage and I've been doing just bad
Figured it out. Turns out the object being created to represent the data before the changes was getting its values from a PropertyValues object, when that PropertyValues object apparently needed to be cast to an object with the ToObject method, otherwise all nullable properties would simply report as null. Isn't reflection great?

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


It's called reflection because you turn your monitor off and then you see the problem

Powerful Two-Hander fucked around with this message at 21:36 on Aug 9, 2022

distortion park
Apr 25, 2011


ArcticZombie posted:

It sounds like you're on the road to re-inventing trunk-based development.

I love that site because their "scaled trunk based development" is actually branch+pr. Which I think is great! but very confusing given the name.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Powerful Two-Hander posted:

It's called reflection because you turn your monitor off and then you see the problem

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
typescript is deece, purescript is shite

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

Powerful Two-Hander posted:

It's called reflection because you turn your monitor off and then you see the problem

quantum leaps into an obese, neckbearded man in a rush t-shirt with unkempt hair and stares into the dark monitor screen

"i'm a .net developer?"

Kazinsal
Dec 13, 2011



matti posted:

code:
static void
insert_character(wchar_t character)
{
	/* This is unsafe if the wide character I/O implementation maps
	 * multiple wide characters to a single multi-byte character. For
	 * example, both U+003C "LESS-THAN SIGN" and U+FE64 "SMALL LESS-THAN
	 * SIGN" could map to '<'. But such implementation would be broken for
	 * any kind of structured output anyway. */

	switch (character) {
	case L'&':
		print(L"&amp;");
		break;
	case L'<':
		print(L"&lt;");
		break;
	case L'>':
		print(L"&gt;");
		break;
	default:
		print(L"%lc", character);
	}
}
is this a realistic worry and an acceptable conclusion?

unicode is a loving mess, but this is one of those cases where I think the concern is a bit of a fringe case that would likely be caused by the software being run on a machine that doesn't actually understand how to unicode and decides to normalize U+FE64 into U+003C. in that case it might mangle U+FE64 into &lt;

in my opinion the bigger concern is that there's a portability issue in that code though wherein wchar_t is technically unportable as its width and encoding are implementation-defined, and that you should instead be explicitly using char16_t for UTF-16 and char32_t for UTF-32 (both of which were introduced in C11 and updated in C23 to explicitly be UTF-16 and UTF-32 encoded, but afaik every C11 implementation used those particular encodings anyways). if you do a _Static_assert(sizeof(wchar_t) == 4) on a win32 compiler the compiler will throw an assert error for example, but it'll be happy with _Static_assert(sizeof(char32_t) == 4).

matti
Mar 31, 2019

Kazinsal posted:

unicode is a loving mess, but this is one of those cases where I think the concern is a bit of a fringe case that would likely be caused by the software being run on a machine that doesn't actually understand how to unicode and decides to normalize U+FE64 into U+003C. in that case it might mangle U+FE64 into &lt;

im more just paranoid if there is some lovely UNIX implementation that does normalization from its arbitrary wide character encoding (I used Unicode just as an example) to whatever is the value of the current LC_CTYPE locale category.

but ive mulled over it enough and doubt its a problem

i have a razor i try apply: do not care about malicious implementations, its their problem, not mine

even if POSIX.1 technically could allow it

Shaggar
Apr 26, 2006

Powerful Two-Hander posted:

It's called reflection because you turn your monitor off and then you see the problem

Adbot
ADBOT LOVES YOU

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

Kazinsal posted:

unicode is a loving mess, but this is one of those cases where I think the concern is a bit of a fringe case that would likely be caused by the software being run on a machine that doesn't actually understand how to unicode and decides to normalize U+FE64 into U+003C. in that case it might mangle U+FE64 into &lt;

in my opinion the bigger concern is that there's a portability issue in that code though wherein wchar_t is technically unportable as its width and encoding are implementation-defined, and that you should instead be explicitly using char16_t for UTF-16 and char32_t for UTF-32 (both of which were introduced in C11 and updated in C23 to explicitly be UTF-16 and UTF-32 encoded, but afaik every C11 implementation used those particular encodings anyways). if you do a _Static_assert(sizeof(wchar_t) == 4) on a win32 compiler the compiler will throw an assert error for example, but it'll be happy with _Static_assert(sizeof(char32_t) == 4).

sounds like you need to _Static_assert yourself a new programming language, hoss

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