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
hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av
I like programming. Programming is not terrible, it is in fact cool. Capitalization suggests this post is unironic

Adbot
ADBOT LOVES YOU

pepito sanchez
Apr 3, 2004
I'm not mexican

thanks. can't give this a proper reading now but i will later

qntm
Jun 17, 2009

hackbunny posted:

I like programming. Programming is not terrible, it is in fact cool. Capitalization suggests this post is unironic

The missing trailing full stop puts the lie to your sincerity.

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av
my ideal of programming is the starship enterprise (NCC 1701 D). serious. I rewatched tng a few years ago and it honest to god made me rethink programming

the enterprise's systems are so flexible! you can monitor, enable, disable, reroute any subsystem in real time! you can reconfigure everything, it's great. it's really hard to program like that, I realized, I just don't have the tools. one time I was so frustrated with multi-threading in C that I dreamed an environment where you'd spawn subprograms instead of threads, it just seemed a more natural model for C. inter-process communication would be absolute garbage of course, because C's type system is "let's give a name to this range of bytes in memory", so it would probably take a whole new language to have something better than UNIX where everything eventually has to fit in a pipe or file of some sort. thanks to octopus guy (sorry will never remember your nickname right) I found out that actually exists, as Erlang. I wish there were smaller scale versions of that, because a GUI application with background workers can get surprisingly complex! and I really wish sometimes I could just crash my workers (which each aggregate and transform data and events from several unreliable sources) and restart them. since I can't have that, I try to do the next best thing: comprehensive logging, even of impossible conditions (it may be impossible today, what about when someone changes the code, or the code of another component?), self-healing state (yes, it results in a lot of redundant code), and hidden ways in which user actions can automatically unfuck state

I used to be all about assertions, obsessed with assertions, and assuming correctness to make "efficient" (and nearly impossible to debug) code ("if the code is in the correct state, then this pointer is actually a 16 bit variable stashed in the lower bits"). I'm still crazy for assertions but logging and self-healing state are the real stars of the show now

Bloody
Mar 3, 2013

Jabor posted:

are you?

if you're trying to reason about what your code is actually doing after optimisation - well, it's not as easy as you seem to think.

whenever possible, yes I do keep optimizations off or low, but these applications are not exactly complex. reasoning about the compiled form while writing is typically quite doable. there aren't that many ways to poll one volatile address and then write a different volatile address when the first one has a specific bit cleared

Kilroy
Oct 1, 2000

hackbunny posted:

my ideal of programming is the starship enterprise (NCC 1701 D). serious. I rewatched tng a few years ago and it honest to god made me rethink programming

the enterprise's systems are so flexible! you can monitor, enable, disable, reroute any subsystem in real time! you can reconfigure everything, it's great. it's really hard to program like that, I realized, I just don't have the tools. one time I was so frustrated with multi-threading in C that I dreamed an environment where you'd spawn subprograms instead of threads, it just seemed a more natural model for C. inter-process communication would be absolute garbage of course, because C's type system is "let's give a name to this range of bytes in memory", so it would probably take a whole new language to have something better than UNIX where everything eventually has to fit in a pipe or file of some sort. thanks to octopus guy (sorry will never remember your nickname right) I found out that actually exists, as Erlang. I wish there were smaller scale versions of that, because a GUI application with background workers can get surprisingly complex! and I really wish sometimes I could just crash my workers (which each aggregate and transform data and events from several unreliable sources) and restart them. since I can't have that, I try to do the next best thing: comprehensive logging, even of impossible conditions (it may be impossible today, what about when someone changes the code, or the code of another component?), self-healing state (yes, it results in a lot of redundant code), and hidden ways in which user actions can automatically unfuck state

I used to be all about assertions, obsessed with assertions, and assuming correctness to make "efficient" (and nearly impossible to debug) code ("if the code is in the correct state, then this pointer is actually a 16 bit variable stashed in the lower bits"). I'm still crazy for assertions but logging and self-healing state are the real stars of the show now

I'm Wesley

Bloody
Mar 3, 2013

whaaaaat the gently caress c#

okay so i have a system that continuously collects data and dispatches that data to objects through events. i've got a distributor, and it has a bunch of sinks. the sinks are all the same, except that they use a
code:
Func<int, bool> selector
to determine if the data being thrown at them should be sunk by them or ignored. when i started building this system, i just hard-coded a few different sinks like
code:
    distributor.AddSink(pred => pred == 0);
    distributor.AddSink(pred => pred == 1);
    distributor.AddSink(pred => pred == 2);
because w/e. now i want to programmatically generate a whole bunch of sinks so i did this:
code:
for (int i = 0; i < 16; i++)
{
    distributor.AddSink(pred => pred == i);
}
i expected this to give each one its own different i for the comparison

nope

they all wind up checking pred == 16

Shaggar
Apr 26, 2006
I betchu ur lambda isn't being evaluated at the time you add it to the distributor so I has been changed to 16 for all lambdas before they are evaluated.

if you are storing the lambda as a private field of type Func<int,bool> in the sink change it to an int and evaluate the lambda during the addsink call.

Shaggar
Apr 26, 2006
or honestly just get rid of the lambda entirely and make it AddSink(int sinkId)

Bloody
Mar 3, 2013

it's a simplified example but yeah i can probably replace the params the lambda checks with poo poo that just gets pushed down and build the checking function later

Dairy Days
Dec 26, 2007

Bloody posted:

are you compiling with optimizations turned off?

http://www.microchip.com/pagehandler/en_us/devtools/mplabxc/

Bloody
Mar 3, 2013


:barf:

AWWNAW
Dec 30, 2008

Bloody posted:

whaaaaat the gently caress c#

okay so i have a system that continuously collects data and dispatches that data to objects through events. i've got a distributor, and it has a bunch of sinks. the sinks are all the same, except that they use a
code:
Func<int, bool> selector
to determine if the data being thrown at them should be sunk by them or ignored. when i started building this system, i just hard-coded a few different sinks like
code:

    distributor.AddSink(pred => pred == 0);
    distributor.AddSink(pred => pred == 1);
    distributor.AddSink(pred => pred == 2);
because w/e. now i want to programmatically generate a whole bunch of sinks so i did this:
code:

for (int i = 0; i < 16; i++)
{
    distributor.AddSink(pred => pred == i);
}

i expected this to give each one its own different i for the comparison

nope

they all wind up checking pred == 16

pretty sure you can make it work this way by copying the value of I into a scope local variable so that it gets properly closed. I still wouldn't do it this way though. produce the predicates with the enumerable range method or something

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

Kilroy posted:

I'm Wesley

you could be Geordi in that simulation, it could be worse

e: the simulation where you sacrifice him to save the enterprise, not the one where he makes out with the enterprise's warp drive designer

hackbunny fucked around with this message at 16:43 on Oct 20, 2015

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av
I want to divert power to the shields in my programs, like mononcq does, drat it I'm envious

Jerry Bindle
May 16, 2003

fun fact: for 8-bit the "pro" is basically unoptimized, the "free" is de-optimized

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

AWWNAW posted:

pretty sure you can make it work this way by copying the value of I into a scope local variable so that it gets properly closed. I still wouldn't do it this way though. produce the predicates with the enumerable range method or something

this is correct, it's a common issue with lambda capture

you are capturing a reference to the same variable "i" in all of those lambdas which ends up as 16. creating a new variable every pass through the loop (like int i2 = i) and closing over that will do what you want, since now each lambda has its own variable to reference

r# will warn you about this mistake, and I thought I heard that they were going to actually fix it in some new version of c# because it's such a common pitfall

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av
c++ makes you specify it explicitly and that's the only correct way :colbert:

Ralith
Jan 12, 2011

I see a ship in the harbor
I can and shall obey
But if it wasn't for your misfortune
I'd be a heavenly person today
One of the nice things about purity (both in languages and just as a design principle) is that you run into that sort of thing far less often.

VikingofRock
Aug 24, 2008




hackbunny posted:

c++ makes you specify it explicitly and that's the only correct way :colbert:

c++ was right

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av
c++ is the light

lord of the files
Sep 4, 2012

hackbunny posted:

c++ is the light

Valeyard
Mar 30, 2012


Grimey Drawer
I was assigned a jira today. There was some issue where the user can manually enter some string parameters into the running program. It parses all these potential overrides and concats a massive string, manually inserting commas, and then later on delimits the string by comma and produces a list. Which is horrible. The issue was some of the parameters the user could enter could have comma separated lists inside them, so it was throwing everything off. I can fix the issue, but refactoring it would be so much work. This is how the code base got into this mess in the first place

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

hackbunny posted:

c++ makes you specify it explicitly and that's the only correct way :colbert:

I agree with this assessment. c++ actually does a lot of things right, especially most things from c++11 on.

non-nullable refs by default are also pretty rad

lord of the files
Sep 4, 2012

hackbunny posted:

starshipenterprise.txt

i believe the concept you are looking at is software coupling between programs instead of modules.

middleware, activeMQ, ipc, and rmi are similar to what you are referring to, so this does exist in languages other than erlang. java supports ipc,rmi, and message passing for example. c# also supports interprocess communication with named pipes since . net 4.5 . the concept of an enterprise-esque system with multiple programs being coupled together to easily be rerouted is not that far off if you think about it.

since ipc is socket-based, it would be the easiest way to implement a modulated process system. you would need a translation layer over your ipc implementation.

Zaxxon
Feb 14, 2004

Wir Tanzen Mekanik

hackbunny posted:

c++ makes you specify it explicitly and that's the only correct way :colbert:

lua sticks the for variable inside the scope of the for loop. But yeah the C++ way is actually best.

pointers
Sep 4, 2008

Barnyard Protein posted:

MonocQc your story is very good. holy smokes.

KidDynamite
Feb 11, 2005

I finally got work. It's doing support. Updating queries and running batch jobs. Kill me. Gonna put the hammer down with some personal apps so I can get the gently caress out.

comedyblissoption
Mar 15, 2006

Jabor posted:

So most of the reason inheritance ruins things for everyone else is because people think it's "good enough" as code re-use thing. And so proper compositional code re-use often requires pointless boilerplate code to achieve, instead of someone coming up with a good syntax for it.
proper compositional code re-use in C#/java lang involves specifying the module you want 6 times it's a little bit loving ridiculous

code:
public class Foo
{
    private readonly IDependency _dependency;

    public Foo(IDependency dependency)
    {
        _dependency = dependency;
    }
}

comedyblissoption
Mar 15, 2006

Opulent Ceremony posted:

We just merged the master branch into dev after someone made a needed quick fix on master to be quickly pushed to production. This merge stomped on a bunch of new work on a file that master hasn't seen changes to outside from having dev merged into it. Why did this happen and what are we doing wrong with git?
properly resolve merge conflicts

also note that if you create a commit to reverse a merge you didn't mean to happen, you have to take explicit complicated steps to unfuck the history of the repository when you later finally decide to incorporate the merge which you can google. this is kind of an unfortunate pitfall but it is what it is.

Opulent Ceremony
Feb 22, 2012

comedyblissoption posted:

properly resolve merge conflicts

also note that if you create a commit to reverse a merge you didn't mean to happen, you have to take explicit complicated steps to unfuck the history of the repository when you later finally decide to incorporate the merge which you can google. this is kind of an unfortunate pitfall but it is what it is.

Yea I figure I've been giving this guy the benefit of the doubt enough at this point, time to stop blaming git

comedyblissoption
Mar 15, 2006

it's extremely easy to check if someone is just blindly saying "use my commit"

just checkout the parent commit representing the branch he worked on and do a merge and resolve all conflicts using just "your" commit and see if the resulting merge commit is identical to what is checked in

better yet, do the merge and resolve it (assuming it doesn't take much time) and see how it compares to how he did the merge

git isn't going to save you if someone is blindly stomping on the work of other people whenever they do a merge. you'd have the exact same problem if someone resolved merge conflicts that way in SVN

comedyblissoption fucked around with this message at 06:48 on Oct 21, 2015

comedyblissoption
Mar 15, 2006

also stop using the git TFS plugin in visual studio it is absolute garbage. I evaluated it in early 2014 and it was almost loving unusable. it didn't even report the warnings/error the git CLI would spit at you and so you would have no idea why a command wasn't working. some of these warnings that the CLI would say that VS would suppress would be along the lines of "hey you can't checkout this new branch because you have uncommited changes in your current branch. please take corrective action"

just use sourcetree for a git gui https://www.sourcetreeapp.com/

some other people like git extensions on windows

comedyblissoption
Mar 15, 2006

if you go down the route of reversing a problem merge commit using the git reverse command, don't do so without reading the following and understanding it fully:
http://stackoverflow.com/a/7101376
http://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt

the other option is if there wasnt that much breakage you just re-implement the missing commits using cherry picks or meticulous re-implementation

it's honestly much easier for people who don't understand what theyre doing to just force push away a bad merge commit before anyone gets the bad merge commit into their local repositories, but uh you also have to know what youre doing if youre using force push to destroy your public history and it's almost always the wrong thing to do

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

Nitrocat posted:

i believe the concept you are looking at is software coupling between programs instead of modules.

middleware, activeMQ, ipc, and rmi are similar to what you are referring to, so this does exist in languages other than erlang. java supports ipc,rmi, and message passing for example. c# also supports interprocess communication with named pipes since . net 4.5 . the concept of an enterprise-esque system with multiple programs being coupled together to easily be rerouted is not that far off if you think about it.

since ipc is socket-based, it would be the easiest way to implement a modulated process system. you would need a translation layer over your ipc implementation.

can't exactly structure a mobile application in that way, can I. the iOS sandbox even specifically restricts you to a single process

Bloody
Mar 3, 2013

use pull requests instead of merges

Jerry Bindle
May 16, 2003
yeah, the key to successfully using git is to not have any chucklefucks on your project, or having some way to force them to contribute exclusively through pull requests

Shaggar
Apr 26, 2006
git is a disaster and nobody should use it. distributed version control is an oxymoron and one of the worst software development concepts of the past 10 years.

also I spent all morning tweaking shims and polyfills to make stuff work in IE8 and now I want to die but its still not as bad as using git

Jerry Bindle
May 16, 2003
yeah i voted for hg but the company i work for is obsessed with atlassian. what is bad about distributed? i mean for all practical purposes, except for being able to do stuff locally, its really similar to a centralized scm

shaggar what do you use?

Adbot
ADBOT LOVES YOU

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

Barnyard Protein posted:

yeah i voted for hg but the company i work for is obsessed with atlassian. what is bad about distributed? i mean for all practical purposes, except for being able to do stuff locally, its really similar to a centralized scm

shaggar what do you use?

bitbucket supports hg though. in fact im using it right now

  • Locked thread