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
Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Notorious b.s.d. posted:

docker containers are opaque.
there's no way to know what needs to be patched in the first place

if i know i need a patch, yeah, i can deploy a new container

i gotcha

seems like it just means you need to janitor a golden image. infinitely preferable to janitoring a whole bunch of servers imo

Adbot
ADBOT LOVES YOU

Notorious b.s.d.
Jan 25, 2003

by Reene

Blinkz0rz posted:

i gotcha

seems like it just means you need to janitor a golden image. infinitely preferable to janitoring a whole bunch of servers imo

golden images are the loving worst

Notorious b.s.d.
Jan 25, 2003

by Reene

MALE SHOEGAZE posted:

maybe i'm not understanding you but cant you just docker exec -it $container_id bash and introspect

i mean not that i'm suggesting that as a solution for patching many containers, but they're not entirely opaque

yeah on solaris you don't have to do that

the patcher doohickey just knows what to do with zones, and patches them alongside the host OS

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Notorious b.s.d. posted:

golden images are the loving worst

i guess

tbh they don't seem too awful if you're building them with something like packer

infrastructure as code is pretty cool by me

Brain Candy
May 18, 2006

Sinestro posted:

if you need clairvoyance to see how variables will change during a programs runtime, then smdh

yes, ofc mutablity makes entangling things even worse.

but there's another effect on design over time with respect to the code, hence talking about years. i'm contending that global vars can help your design decay to mush by logically connecting things that don't necessarily need connecting.

suffix
Jul 27, 2013

Wheeee!
your automatic build should just pull the latest official centos image and yum update it and build an updated image and restart your workers
their tooling doesn't feel that great for production use though, i wish they'd make better conventions for the building, disting, logging, running and user

Notorious b.s.d. posted:

golden images are the loving worst

idgi, you want to patch individual running docker containers? that seems as bad as byte patching an executable instead of building a new one from source

Soricidus
Oct 21, 2010
freedom-hating statist shill

suffix posted:

that seems as bad as byte patching an executable instead of building a new one from source

you say it like that's a bad thing

Notorious b.s.d.
Jan 25, 2003

by Reene

suffix posted:

your automatic build should just pull the latest official centos image and yum update it and build an updated image and restart your workers
their tooling doesn't feel that great for production use though, i wish they'd make better conventions for the building, disting, logging, running and user
the production tooling is a joke

and that's the part they are trying to sell

oops

suffix posted:

idgi, you want to patch individual running docker containers? that seems as bad as byte patching an executable instead of building a new one from source

on certain obscure long-dead platforms you could actually patch the running code

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Wheany posted:

wtf, just put your cursor over the method name in your ide and use "find usages"

lol, like i work in a real language. MUMPS does not have such silly frills as this.


Thanks City of Glompton for the glorious sig

tef
May 30, 2004

-> some l-system crap ->
stop the presses, just got some real hot takes on programming

Destroyenator posted:

globals are bad

Mr Dog posted:

Globals are bad

even if we do have global state the last thing we want to do is make it obvious, we'd rather implicitly inject shared objects through annotation and reflection

tef
May 30, 2004

-> some l-system crap ->

Mr Dog posted:

Globals are bad because two different people could decide to create a global variable called foo and then stomp on each other's internal state in unpredictable ways

yeah we had this problem with tables and filenames, two people could create the same file or table and stomp on each other's internal state, so we've replaced it with a unique token for each and a xml mapping file, honest

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
it seems that the idea of programming languages being for adult engineers seems to be forgotten these days. there's a difference between protecting against difficult to find bugs and edge cases and designing stuff around "but two people could create a global with the same name". one person could put code that dials out to some russian hacker, does that mean that we should get rid of networking? jesus

Volte
Oct 4, 2004

woosh woosh
Global state was never inherently bad---using global state to pass information into or out of functions is bad. It makes things non-reentrant, like strtok. There's no inherent problem with global variables for objects that want to exist for the application's entire lifetime because the application's global scope is still a perfectly valid singleton scope, it's just not given a ceremonial name and private constructor.

That said, just sticking variables in the global namespace is messy as hell but making a singleton class is still global state.

tef
May 30, 2004

-> some l-system crap ->
docker almost solves two problems:

1. amazon lock in

which is why every other cloud vendor is jumping onto it like a rat escaping a sinking ship (openstack)

2. cheap multi-tenancy

because your ceo won't pay amazon for two machines, and if you let two of your webdevs deploy on the same root account one is going to sabotage the other


the investor story time revolves around being a kingmaker, i think, because they originally tried to do hosting but gave up. the hype train is really strong because as we know, up until now, deploying software has been impossible. that and every rails app needs root access and superuser for the database.

tef
May 30, 2004

-> some l-system crap ->

Sinestro posted:

it seems that the idea of programming languages being for adult engineers seems to be forgotten these days. there's a difference between protecting against difficult to find bugs and edge cases and designing stuff around "but two people could create a global with the same name". one person could put code that dials out to some russian hacker, does that mean that we should get rid of networking? jesus

tldr programmers want their language to protect them from other people not from themselves

tef
May 30, 2004

-> some l-system crap ->

Sinestro posted:

the "problems" with globals are all related to reasoning about how they change

the problem with shared mutable state is that it's mutable, and shared. it's bad, so we shouldn't use it, unless not using it is worse. we've got the hang of the former, not the latter.

qntm
Jun 17, 2009
hold on a second

Volte posted:

non-reentrant, like strtok

why does strtok work like that

comedyblissoption
Mar 15, 2006

The main reason mutable state is bad is because it makes programs difficult to understand and difficult to compose modular parts.

Mutable state encapsulated inside an object and not directly accessible anywhere is almost just as bad in these terms as global mutable state if the effects of the mutability leak outside the scope of the object.

A way to improve the composability and understandability of programs should be to practically minimize this mutable state with global effects.

You can divide mutable state into essential and accidental.

Essential mutable state is inherent to the problem you are trying to solve and cannot be eliminated.

Accidental mutable state can be subdivided:
  • Accidental mutable state that is necessary to achieve acceptable performance
  • Accidental mutable state that makes it easier to understand the problem
  • Accidental mutable state that makes it more difficult to understand the problem

There's a paper that discusses these issues:
http://shaffner.us/cs/papers/tarpit.pdf
Their proposed solution might suck though.

comedyblissoption
Mar 15, 2006

We use dependency injection in a C# codebase.

The more and more I use it and try to program in a style that minimizes side effects and have many singleton 'service' modules that themselves don't have any mutable shared state, the more it seems like that it's just a method to achieve a functional programming-like module system in a really boilerplatish way.

comedyblissoption
Mar 15, 2006

People laugh at C++ for having to declare and define the same thing in a redundant way.

Unfortunately in C# or Java, you have to do something like this when you use a DI framework with singletons:
code:
public class Foo
{
    private readonly IBar _bar;

    public Foo(IBar bar)
    {
        _bar = bar;
    }
}
The "Bar" service is listed 6 loving times.

Bloody
Mar 3, 2013

I still don't know what di is for

JawnV6
Jul 4, 2004

So hot ...

Bloody posted:

I still don't know what di is for

mocking

triple sulk
Sep 17, 2014



from wiki

Dependency injection means giving an object its instance variables. Really. That's it.

James Shore, 22 March 2006.[1]

comedyblissoption
Mar 15, 2006

i'm trying to think of another justifiable reason besides mocking and i literally can't come up with another reason

you can do stuff with dependency injection frameworks to magically wrap decorators around poo poo and automagically provide factories and other crazy poo poo but that probably just makes things harder to understand

comedyblissoption
Mar 15, 2006

in some crazy world you would use a dependency injection framework to change the implementation of some interface in your codebase outside of your tests but that's probably going down the path of crazy and there are more straightforward ways to change implementation based on configuration

brap
Aug 23, 2004

Grimey Drawer
sometimes it's nice to be able to swap out one implementation for another. I do that now to use one data access implementation for environment A and another data access implementation with different technology for environment B.

I only really bother with the hassle of it if it it's for some stateful/external service. I don't do the whole mock thing for just a module of deterministic functions unless I realllly need to test the behavior of some parent object while hard coding simple return values for the mock dependency (I don't need to)

testing is overrated and I don't always like the things we test at my workplace, but there are worse problems to suffer from.

brap fucked around with this message at 02:53 on Sep 21, 2015

comedyblissoption
Mar 15, 2006

yeah I would recommend that you test with as little mocking as possible and try to only mock the system boundaries

we tried with mock literally every dependency and uh it was a really bad idea in retrospect

Bloody
Mar 3, 2013

Oh. I just don't test

comedyblissoption
Mar 15, 2006

automated testing can be nice but it's a significant investment

understandable code is much more important than testing though

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

qntm posted:

why does strtok work like that

like most ancient parts of the stdlib, it was originally done for convenience in a single threaded environment with a small number of users

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
I don't get what's the deal with you people and testing

my tests are dumb, incomplete pieces of poo poo

"eh I'll maybe go back and make them better", and then actually I never go back for 90% of them

it's p much regular coding but much simpler and lazier

I guess you people are perfectionists. you don't need to aim for 100% coverage and bend the architecture to make it testable or some poo poo. just write some tests when it's obvious to do so and don't commit to them like some absolute authority, it's a disposable tool to help you

AWWNAW
Dec 30, 2008

i like writing tests for poo poo when i know what the results should be but i have no idea how to implement

today i gave up trying to solve this dumb problem after getting 90% there:
you have a list of objects, each with a int property that specifies how they should be ordered
the objects are already ordered
one of them gets moved to a diff position
you gotta adjust the order properties of the list objects so that the list remains ordered, while making the least amount of changes
if you have gaps between the order ints, most of the time you only need to change the one that moved, e.g. splitting the difference between the one before and after
but if you move poo poo hundreds of times, the gaps eventually close and then you have to change a bunch of neighboring order properties
so i was trying to come up with a solution that minimized the # of changes
i think the right answer is to find the moved object and use some sort of approach that buffers the gaps between neighboring objects in both directions, hopefully not having to change more than 2-3

anyway i had a good test so i knew my solution wasn't complete and it made me feel stupid

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Symbolic Butt posted:

I don't get what's the deal with you people and testing


some people write software other people use and expect to work

qntm
Jun 17, 2009

Blotto Skorzany posted:

like most ancient parts of the stdlib, it was originally done for convenience in a single threaded environment with a small number of users

that makes sense

wait no it doesn't, what if I want to tokenise several strings at once

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
so is python still the current hipste?

Volte
Oct 4, 2004

woosh woosh
I used to be lazy about unit tests until I was the only developer on a shared-code iOS/Android Xamarin app that was built with a very low budget and tight deadline. I didn't write many unit tests and took a few stupid design shortcuts because of the limited manpower. Those two things don't go together well. I spent way more time fixing some dumbass regression that I introduced than I would have just writing comprehensive unit tests in the first place, plus it would've been a lot easier to sleep at night. Pretty much wherever I used to just write a little console program to verify the results of the something, I instead write a unit test, and now a great weight has been lifted from my shoulders.

That said, way too much ado is made about mocking for my tastes. Mock external services (internet, database), but use your actual internal service implementations where possible. As long as you only test one component with each test, that component can still safely depend on other components without mocking them, as long as they have also been tested. I mean, if the goal of a mock is to establish an object with the behaviour of a particular class, and you have a fully tested instance of that class that behaves exactly like itself, what's the point of introducing more and more extra code that the programmer must manually (and without any compiler assistance) make sure matches the semantics of the real class?

Carthag Tuek
Oct 15, 2005

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



AWWNAW posted:

i like writing tests for poo poo when i know what the results should be but i have no idea how to implement

today i gave up trying to solve this dumb problem after getting 90% there:
you have a list of objects, each with a int property that specifies how they should be ordered
the objects are already ordered
one of them gets moved to a diff position
you gotta adjust the order properties of the list objects so that the list remains ordered, while making the least amount of changes
if you have gaps between the order ints, most of the time you only need to change the one that moved, e.g. splitting the difference between the one before and after
but if you move poo poo hundreds of times, the gaps eventually close and then you have to change a bunch of neighboring order properties
so i was trying to come up with a solution that minimized the # of changes
i think the right answer is to find the moved object and use some sort of approach that buffers the gaps between neighboring objects in both directions, hopefully not having to change more than 2-3

anyway i had a good test so i knew my solution wasn't complete and it made me feel stupid

why not just run through the list once while looking at the objects & changing the order properties if theyre wrong? or am i misunderstanding what youre trying to accomplish

AWWNAW
Dec 30, 2008

Snapchat A Titty posted:

why not just run through the list once while looking at the objects & changing the order properties if theyre wrong? or am i misunderstanding what youre trying to accomplish

the problem is minimizing the number of changes required. if all your sequence numbers converge to being consecutive then you have to change a bunch of objects. the hard part is just ensuring there are gaps between each object while minimizing the number of required changes I guess?

crazypenguin
Mar 9, 2005
nothing witty here, move along

comedyblissoption posted:

i'm trying to think of another justifiable reason besides mocking and i literally can't come up with another reason

frameworks, probably.

like, i dunno how to define a "framework" as a distinct thing from an ordinary library except as a "pre-existing structure of interfaces and different modules implementing these interfaces that are composed via some form of DI so you can hook into it and customize whatever."

ok so i googled framework, and yeah, I like my definition better than wikipedia's.

Adbot
ADBOT LOVES YOU

Soricidus
Oct 21, 2010
freedom-hating statist shill

crazypenguin posted:

frameworks, probably.

like, i dunno how to define a "framework" as a distinct thing from an ordinary library except as a "pre-existing structure of interfaces and different modules implementing these interfaces that are composed via some form of DI so you can hook into it and customize whatever."

ok so i googled framework, and yeah, I like my definition better than wikipedia's.

a framework is like a library except it deliberately goes out of its way to do non-standard stuff and subvert the language and generally not play nicely with any other libraries you might want to use

also it gets rewritten from scratch every time it reaches 80% completion, unlike libraries, which are simply abandoned at that point

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