|
Di is boring let's talk about cvs
|
# ? Jan 18, 2015 18:37 |
|
|
# ? May 13, 2024 10:35 |
|
MononcQc posted:The quickcheck library wouldn't be much help unless you can figure out a property of your IO system you want to see, or find an alternative function (a model) to compare your implementation to. yeah, the few things you want to do to be able to test IO are: * move all of your pure code in IO functions to pure functions. hey now you can test all of that with quickcheck or whatever * you can create a wrapper class Monad m => AppIO m that declares all the IO functions you use in your program and declares its own instance of monad. then you can create an instance for IO which is the one used normally, and an instance for something like AppIO (State MockData) that you can use in testing but really, moving your pure code out of pure functions and making those as small as possible is what you want to do.
|
# ? Jan 18, 2015 19:43 |
|
Bloody posted:Di is boring let's talk about cvs walgreens suits my needs op
|
# ? Jan 18, 2015 19:45 |
|
FamDav posted:yeah, the few things you want to do to be able to test IO are: elm is really easy for this kind of stuff. you just write literally everything as pure functions and then thread a signal through it right at the end to make it actually do stuff. that's basically what you should be doing in haskell with io anyway, but haskell makes it a lot easier to spend a lot of unnecessary time living in the io monad
|
# ? Jan 18, 2015 20:15 |
|
FamDav posted:yeah, the few things you want to do to be able to test IO are: If I'm in Erlang I can use meck to mock the IO functions and leave their implementation in place, and then get a trace of all their arguments and return values, and/or overload their implementations. I can then use that stuff in any test framework I want, including Quickchck vv It's particularly useful when I want to test that something gets properly logged, because I just get a trace of the logging module and can analyze everything post-facto in a functional manner.
|
# ? Jan 18, 2015 22:28 |
|
fart simpson posted:elm is really easy for this kind of stuff. you just write literally everything as pure functions and then thread a signal through it right at the end to make it actually do stuff. that's basically what you should be doing in haskell with io anyway, but haskell makes it a lot easier to spend a lot of unnecessary time living in the io monad Maybe it's finally time for me to get serious about haskell
|
# ? Jan 18, 2015 22:53 |
|
MononcQc posted:If I'm in Erlang I can use meck to mock the IO functions and leave their implementation in place, and then get a trace of all their arguments and return values, and/or overload their implementations. I can then use that stuff in any test framework I want, including Quickchck vv that just doesnt feel necessary in a language where the stuff actually dependent on IO are going to sit at main or maybe a function below that. For any case where you have to thread IO deeper into your stack (and a lot of times you don't) you're likely working with something that is (or should be) a monad transformer that wraps IO and can be substituted out for a state instance or something.
|
# ? Jan 18, 2015 22:58 |
|
though no lie writing the kind of code to make a MyServiceT that does the correct thing can be cumbersome
|
# ? Jan 18, 2015 23:00 |
|
FamDav posted:that just doesnt feel necessary in a language where the stuff actually dependent on IO are going to sit at main or maybe a function below that. For any case where you have to thread IO deeper into your stack (and a lot of times you don't) you're likely working with something that is (or should be) a monad transformer that wraps IO and can be substituted out for a state instance or something. Logging or gathering metrics in running code that operates with sockets tends to be nice to be able to weave as deep as you need it to be if you want the values to be accurate. I'm still not sure how easy it would be to take some production code we have that parses, transforms and pipes data across many sockets and goes "yes that were how many bytes were shuttled from A to B and from B to A and here's how long each step took" especially without wanting to accumulate any of that data in memory longer than required in the first place. Instead I access global time wherever, put logs in a mergeable data structure and can then build everything where I need to report it without altering code structure or duplicating it because someone wants to know where time is spent on specific requests and responses. I'm guessing these cases just can't happen in Haskell so you have to solve that problem beforehand (or give up on these metrics altogether) though. I like being able to go meck:new(io, [passthrough, unstick]), run_my_test(), meck:history(io) and then I have a data structure that traces every call made lower in the stack and not have to do anything different.
|
# ? Jan 18, 2015 23:13 |
|
thanks, these are all good points tef posted:on the other hand if you're just using it for unit testing there is probably some classloader hack that will fix this for you. in java i can use powermock to swap in a mock implementation, and in python unittest.mock can monkey patch things out for each test i was thinking there might be some general way to do it across oo languages that i was missing, but i'm starting to think that you need language support to do it well MononcQc posted:If I'm in Erlang I can use meck to mock the IO functions and leave their implementation in place, and then get a trace of all their arguments and return values, and/or overload their implementations. I can then use that stuff in any test framework I want, including Quickchck vv cool. this lets you swap out any module for your tests?
|
# ? Jan 18, 2015 23:34 |
|
suffix posted:cool. this lets you swap out any module for your tests? Yes, at runtime. You can override anywhere between no functions to all of them functions there by arbitrary code and even define sequences for whatever mocks you'd make that would depend on hidden process state. You can decide to let missing overrides pass through to existing code or to force a crash if you want. It's a pretty nifty tool that beats monkeypatching and some lovely container mechanism any day of the week.
|
# ? Jan 18, 2015 23:40 |
|
who knows about fb app poo poo? i'm trying to fix some bug in one of our apps but i dont know anything about this and i dont really want to. we have 6 links and all of them send a request back to our local box which i can see. the 7th is throwing an internal server error but it's never even sending a request back to my server. these links all point to apps.facebook.com/app_namespace/:route, which are configured in the fb app settings to point back to my server. i dont understand why all the other routes have no issue reaching me but this one is throwing an error, unless there's some setup thing on facebook that i'm missing
|
# ? Jan 19, 2015 01:04 |
|
suffix posted:i have a terrible programmer question: how do you do dependency injection right? The entire reason for a DI framework is to create the object graph for you without you having to do it all by hand with a giant series of new Foo(new Bar, new Baz(...)). If you have to set something up whenever you add a new dependency in your object graph, your DI framework sucks. As an example, imagine your class needs an IFoo instance in its constructor. Somewhere in your assembly is a Foo implementing IFoo. Your DI framework should be able to automatically detect this and instantiate Foo and pass it into the IFoo. The DI framework should be able to recursively do this for all of the dependencies of Foo. You should be able to configure if Foo will be a singleton throughout the assembly and the DI framework should handle that. Be careful if you use the new operator in an object's constructor and you're not constructing a simple value object. The entire point of DI is to make it so you aren't calling new in an object constructor. Following DI principles is a boiler-platish patch on java-like OOP encouraging bad practices for modularity and composition of programs.
|
# ? Jan 19, 2015 01:08 |
|
Also run away from poo poo that requires you to program things in XML.
|
# ? Jan 19, 2015 01:11 |
|
comedyblissoption posted:Following DI principles is a boiler-platish patch on java-like OOP encouraging bad practices for modularity and composition of programs. if java were amenable to partial application you really wouldnt need nearly as much of the plumbing that goes into, say, spring. that being said, spring gives you the ability to do configuration at runtime p easily, whether thats at startup or even per request.
|
# ? Jan 19, 2015 01:24 |
|
MALE SHOEGAZE posted:who knows about fb app poo poo? i'm trying to fix some bug in one of our apps but i dont know anything about this and i dont really want to. we have 6 links and all of them send a request back to our local box which i can see. the 7th is throwing an internal server error but it's never even sending a request back to my server. okay i just changed the link to apps.facebook.com/app_namespace/settings to apps.facebook.com/app_namespace/buttslol and it works fine wtf
|
# ? Jan 19, 2015 01:29 |
|
FamDav posted:if java were amenable to partial application you really wouldnt need nearly as much of the plumbing that goes into, say, spring.
|
# ? Jan 19, 2015 01:57 |
|
Bloody posted:Di is boring let's talk about cvs cvs was pretty bad
|
# ? Jan 19, 2015 06:38 |
|
i wonder if there's some other forum where some dude 10 years older than rotor is vociferously defending cvs
|
# ? Jan 19, 2015 06:48 |
|
good new thread title
|
# ? Jan 19, 2015 07:10 |
|
can i ask rly stupid programming qs in here
|
# ? Jan 19, 2015 08:26 |
|
Stringent posted:i wonder if there's some other forum where some dude 10 years older than rotor is vociferously defending cvs nope, i checked
|
# ? Jan 19, 2015 08:27 |
theadder posted:can i ask rly stupid programming qs in here
|
|
# ? Jan 19, 2015 08:38 |
|
theadder posted:can i ask rly stupid programming qs in here nobody will judge you here, friend
|
# ? Jan 19, 2015 08:46 |
|
rotor posted:nobody will judge you here, friend unless you defend git
|
# ? Jan 19, 2015 09:41 |
|
what up thread its been a long while since i last posted in here. last time i shitposted about webdna, a lovely relic of a language no one's heard of. well after quitting that job without lining up another one first, i had a severe existential crisis and pretty close to committing suicide. a cross country move and several lovely months later, i am gainfully employed at a php dev shop. also i take sad brain medication and see a counselor so i don't repeat what i did. yet i still seem easily susceptible to giving a drat about doing my job right. so this dev shop was like three people for the longest time, then in the past year they hired on like crazy to try and keep up with the work coming in. well considering my last job was just my boss and i with no prospect for growth, this is already a step up. they use svn, which is better than no vcs so yay another step up. and that's about it. every client's svn repo is the latest development snapshot with no branches or indication what production is running. development is done on a remote web server that may also be hosting the test environment and/or the production environment. debugging consists of var_dump, print_r, and die calls, and checking logs is next to useless because they turned off all error logging in php.ini. updating files on servers consists of ssh, using svn up only on the specific files you changed, and alter table queries from the mysql cli. to save my sanity and resolve some long standing bugs i made a vagrant vm, cloned the svn repo into git, and made an orphan branch with rsync'd production code. i got an actual debugger installed and resolved a few issues within hours of setup. my team thinks this is black voodoo magic and would take too much time to setup and train, so their solution is to make separate remote servers for every dev and just be sure to check svn before you work on a file. i guess i should jump ship but given my troublesome employment history, i think its best to stick it out for at least a year before moving. or finding a less sad brains-inducing career. i just wanna be like tef. thanks for reading.
|
# ? Jan 19, 2015 10:20 |
|
Stringent posted:i wonder if there's some other forum where some dude 10 years older than rotor is vociferously defending cvs I'm actually on that list (not forum) and it has not just CVS but RCS/SCCS adherents and ClearCase (or was it PVCS?) advocates people who consider locking everyone else out of a file while it's being edited by one person a serious advantage who think sharing should code be done via a shared filesystem - and possibly sharing build intermediates too
|
# ? Jan 19, 2015 10:58 |
while your team are savages, dont jump ship before you see the coast, unless they want to eat you godspeed, coder
|
|
# ? Jan 19, 2015 10:59 |
|
wolffenstein posted:i guess i should jump ship but given my troublesome employment history, i think its best to stick it out for at least a year before moving. or finding a less sad brains-inducing career. i just wanna be like tef. thanks for reading. using a VM to do your black voodoo magic debugging sounds like a step on the way to being like tef, especially in that small pond, sticking it out for a year could see you leading or managing things
|
# ? Jan 19, 2015 11:02 |
|
rotor posted:nobody will judge you here, friend thank u 4 ur kind words ive no programming experience at all & this is the problem im looking at im trying to do the experiment bit but but im unsure what the answer would look like
|
# ? Jan 19, 2015 11:13 |
|
theadder posted:thank u 4 ur kind words Imo tef or someone who has thought a lot about teaching programming should answer this one Is that swift or lua maybe?
|
# ? Jan 19, 2015 11:27 |
|
the code currently keeps track of the largest number it's seen so far in the aptly-named "largest" variable. the experiment is asking you to add another variable (say, largestKind) that keeps track of what kind the largest number seen so far happens to be.
|
# ? Jan 19, 2015 11:28 |
theadder posted:thank u 4 ur kind words i don't know anything about programming either but is that set of numbers an array of arrays? you can keep track of the position in that first array when a number is found in the others to see what "kind" of number it is.
|
|
# ? Jan 19, 2015 11:32 |
|
MALE SHOEGAZE posted:Imo tef or someone who has thought a lot about teaching programming should answer this one its swift ya Jabor posted:the experiment is asking you to add another variable (say, largestKind) that keeps track of what kind the largest number seen so far happens to be. i should have said more but im used to v short posts its not the concepts but smth about the syntax that im having trouble with
|
# ? Jan 19, 2015 11:36 |
|
theadder posted:thank u 4 ur kind words something like this I guess code:
|
# ? Jan 19, 2015 11:37 |
|
you should post something that you've tried but isn't working - it's way more instructive to point out where your existing approach went wrong than it is to just give a solution (or a process to derive a solution) from nothing.
|
# ? Jan 19, 2015 11:39 |
take absolute values, butt?
|
|
# ? Jan 19, 2015 11:39 |
|
kalstrams posted:take absolute values, butt? but -1 is larger than -9!
|
# ? Jan 19, 2015 11:41 |
err, i brainfarted wouldn't it work as is then? (note, i have no idea about swift)
|
|
# ? Jan 19, 2015 11:42 |
|
|
# ? May 13, 2024 10:35 |
|
kalstrams posted:err, i brainfarted
|
# ? Jan 19, 2015 11:47 |