|
MALE SHOEGAZE posted:^^ once twice refactor is such a good rule of thumb. this is a good post. learning new languages is good (even if they’re not widely used for real work), learning industry standard methodologies is good (even if yospos rightly sneers at them) basically imo if you’re learning something then you’re doing it right. learn Haskell, learn x86 asm, learn spring or asp mvc, it will all help your brain develop in useful ways. the genuinely terrible programmers are the ones who learn to do exactly one thing and then try to rely on that their whole career.
|
# ? Aug 13, 2018 09:42 |
|
|
# ? Dec 3, 2024 13:37 |
|
You could also join a lovely company and work on their legacy app, giving you a treasure trove of study material on how NOT to write and structure software, with the benefit of this aforementioned trove growing everyday
|
# ? Aug 13, 2018 09:42 |
|
going through the Design Patterns book as a p-langer is very masochistic imo, I'd save that for later, preferably after you at least dabbled into java a bit.
|
# ? Aug 13, 2018 10:01 |
|
cheque_some posted:What would you recommend for someone who is a self-taught terrible devopsing p-langing programmer but want to become a non-terrible programmer make a bunch of mistakes then think about and research ways to fix them. and do the actual fixing part as well ofc
|
# ? Aug 13, 2018 10:24 |
|
ctps: adding a field to device telemetry here requires 7 different pull requests and deployments. Each service/pipeline has a different enrichment process and so it's own data schema (and half of them use different data transport technologies). It's taken me a week to add a "butts": true to messages. What's a not poo poo way of doing this? Everyone at work is adamant that each of the stages is unavoidable complexity and totally needs to exist
|
# ? Aug 13, 2018 10:43 |
|
MALE SHOEGAZE posted:personally, i've found the functional approach incredibly useful to me throughout my career. i dabbled in haskell very early in my programming development, and while i remember little to nothing about haskell, a few of the functional concepts stuck with me and i think they helped me a lot, even when i was working on a terrible rails app. there are very few places where you can't escape from some stateful context into a pure function. this, a hundred times this. you don't need to be purely functional, but if you have stuff with side effects that populates values which are SOMETIMES needed, I will loving berate a coworker about this kind of thing to no end. This stuff drives me mad: code:
code:
code:
|
# ? Aug 13, 2018 11:03 |
|
|
# ? Aug 13, 2018 11:11 |
|
a couple of online courses that made a huge impression on me: CS212 Design of Computer Programs by Peter Norvig is probably my favorite course ever. it's kind of a unique course on algorithms/data structures but a lot more pragmatic. he also introduces a lot of design patterns in a sneaky way, if you plan to really get into that it'll definitely help to already have the general intuition that Norvig gives you here. if that's a heavy course to you maybe give it a pause and try CS101 Intro to Computer Science, it's a way more basic course but it touches on a lot of intermediate topics that you may not be familiar with. Programming Languages by Dan Grossman is a great intro to PLT. It's about learning 3 languages and their key ideas (SML, Racket and Ruby). it forces you to think about a lot of stuff you never really think about in introductory p-lang courses (typing, mutability, scoping, dispatch etc) compared to CS212 this is hella formal and academic so it may or may not be your cup of tea. Starting with SML may be a huge shock but is totally worth it. I really like this course better than just learning just one fp language in isolation because it puts other paradigms side by side to give you a better perspective. Symbolic Butt fucked around with this message at 15:52 on Aug 18, 2018 |
# ? Aug 13, 2018 11:25 |
|
floatman posted:You could also join a lovely company and work on their legacy app, giving you a treasure trove of study material on how NOT to write and structure software, with the benefit of this aforementioned trove growing everyday yes, you will learn a lot. but you will need a good work environment + coworkers to stop you from wanting to take a long walk off a short pier, and if you do it too long your brain ends up broken
|
# ? Aug 13, 2018 11:30 |
|
now someone should post about SICP and the smart dog book and we're cool
|
# ? Aug 13, 2018 11:30 |
|
oh another like, super duper important thing: learning to write unit testable code. this is maybe the most important skill to have for your average CRUD app developer. it's a huge topic that i certainly cannot do justice but the takeaway is: write code in a way that makes it easy to unit test. now you have tests, and also it turns out that most methods for writing unit testable code are also good practices in general. i'm not sure of a good resource for unit testing though as i've picked all of this up on the job. perhaps someone else has a good rec. also before i start a derail i'm not saying unit testing is the only kind of testing you should do but it's the best place to start learning how to test.
|
# ? Aug 13, 2018 11:30 |
|
also this is a good thread for asking questions. feel free to come by and ask as many questions as you want. this thread and others on SA have been invaluable to me and have helped me develop from a terrible programmer who didn't even know what questions to ask to an okay programmer making money. also i've developed a real passion for programming, it's great most of the time.
DONT THREAD ON ME fucked around with this message at 11:36 on Aug 13, 2018 |
# ? Aug 13, 2018 11:33 |
|
i miss writing code and am srsly thinking about going back to being an ic even though management has sweet rear end perks
|
# ? Aug 13, 2018 11:37 |
|
MALE SHOEGAZE posted:good news: we’re here to help with both problems ah gently caress
|
# ? Aug 13, 2018 12:12 |
|
what's a unit test
|
# ? Aug 13, 2018 12:57 |
|
Captain Foo posted:what's a unit test A miserable pile of false passes.
|
# ? Aug 13, 2018 13:12 |
|
gonadic io posted:Oo patterns are overrated
|
# ? Aug 13, 2018 15:26 |
|
MALE SHOEGAZE posted:oh another like, super duper important thing: learning to write unit testable code. this is maybe the most important skill to have for your average CRUD app developer. it's a huge topic that i certainly cannot do justice but the takeaway is: write code in a way that makes it easy to unit test. now you have tests, and also it turns out that most methods for writing unit testable code are also good practices in general. The Art Of Unit Testing is really, really good
|
# ? Aug 13, 2018 15:57 |
|
Phobeste posted:it's just loving tedious and easy to screw up and still has a similarly abstracted machine model as c. you don't think about cache in x86 assembler, usually. you're still dealing with virtual memory. the only difference is it it's now a massive pain to do any flow control and it's a massive pain to deal with types above machine word size. hooray contrariwise, when i have to think about caches it's time for asm
|
# ? Aug 13, 2018 16:17 |
|
one good reason to learn asm imo is that it forces you to think about how your code is structured, because careless or poorly documented code becomes unmaintainable after a few dozen lines of code at most, whereas in a higher level language you can get away with hundreds or even thousands of lines of bad code and still be able to work with it you almost certainly shouldn’t be using asm for anything real (unless you’re working in some very specific domains), but it’s a nice didactic tool
|
# ? Aug 13, 2018 16:50 |
|
gonadic io posted:ctps: adding a field to device telemetry here requires 7 different pull requests and deployments. Each service/pipeline has a different enrichment process and so it's own data schema (and half of them use different data transport technologies). I can do it in one except it silently breaks a subset of the consumers and there's no way to know in advance which consumers are liable to break
|
# ? Aug 13, 2018 17:49 |
|
raminasi posted:The Art Of Unit Testing is really, really good i skimmed it. it's probably a decent introduction if you've never heard of unit testing at all. but otherwise, it's yet another loving unit testing book that tells me in excruciating detail how to test string parsers and arithmetic operations. yawn. assert.equals(two.plus(two), 4)? thanks dude, would never have figured out how to write that. wait, why are you talking to me about mocks and stubs and testing stubs against mocks now*? what do i need those things for? here's a real life scenario: products have VAT rates. those VAT rates can occasionally change over time, meaning both that a product can be moved to a different VAT rate, or that a VAT rate can be increased or decreased by a percentage point or two (let's keep it simple and say it's one VAT rate per product (it's not)). is there a unit testing book that will teach me how to structure an invoicing system in such a way that I can test that it won't apply the wrong VAT rate when an invoice is created, edited, modified, or duplicated, even if the VAT rate for a product changes at some point? (btw, at one point TAoUT literally shows a test that defines a mock, tells the mock what a certain method should return, then asserts that the method returns that value. no non-mock code appears in the test at all.)
|
# ? Aug 13, 2018 19:10 |
|
NihilCredo posted:(btw, at one point TAoUT literally shows a test that defines a mock, tells the mock what a certain method should return, then asserts that the method returns that value. no non-mock code appears in the test at all.) Sounds great! I want my codebase to have 110% coverage!
|
# ? Aug 13, 2018 19:23 |
|
NihilCredo posted:is there a unit testing book that will teach me how to structure an invoicing system in such a way that I can test that it won't apply the wrong VAT rate when an invoice is created, edited, modified, or duplicated, even if the VAT rate for a product changes at some point? i read 7 unit testing books so far and haven't found one that does that. seconding the request
|
# ? Aug 13, 2018 19:28 |
|
bob dobbs is dead posted:i read 7 unit testing books so far and haven't found one that does that. seconding the request it was already linked in this thread gonadic io posted:Oo patterns are overrated
|
# ? Aug 13, 2018 19:34 |
|
The emulator101 bug has bitten me too, but I'm doing it in Ceylon and adding tests because I'm a weirdo. I started with an Opcode enum that I was piling everything into—byte value, size, mnemonic, parameter mnemonic—before I realized that was stupid and put only what both the disassembler and the emulator needed to know in there: byte value and size. I made that realization when I was about to stuff the code that does the emulation into the enum, which was way too late to figure that out.
|
# ? Aug 13, 2018 20:24 |
|
CPColin posted:The emulator101 bug has bitten me too, but I'm doing it in Ceylon and adding tests because I'm a weirdo. haha i did almost exactly the same thing. now i'm actually implementing the instructions and i just refactored my runloop. now my jmp test is broken and i'm not sure why. i'm definitely advancing the pc when i shouldn't, or i'm not advancing it. one or the other. e: ugh it was because i apparently deleted the part of jmp where i set the pc to the offset. DONT THREAD ON ME fucked around with this message at 21:50 on Aug 13, 2018 |
# ? Aug 13, 2018 21:41 |
|
Same here, but Swift. I started with the disassembler but was frustrated by all the repetition and went through three or four different ways of breaking down the instruction set until I finally ended up with one I liked, and started writing the execution part along side to make sure it would actually work. It's interesting how you can break down each instruction 'family' like MOV and figure out what registers it's dealing with just from looking at the opcode, so rather than coding MOV 63 times you just have one bit of code that knows how to decode the registers. Now instead of a switch statement I've just got a cached lookup into a much smaller set of structs that each know how to disassemble or emulate a family of instruction, which nicely handles instructions with varying timing too. The only bit that is a bit poo poo is the bit that holds the current 'in flight' instruction across ticks so it doesn't change cpu state until the right number of ticks have elapsed. I don't even know if that's how it should do it?
|
# ? Aug 13, 2018 21:46 |
|
MALE SHOEGAZE posted:haha i did almost exactly the same thing. I couldn't figure out why the emulator wasn't getting anywhere until I realized that when you RET from a CALL, you're supposed to end up with the program counter pointing at the instruction after the CALL, not back at the CALL again. Whee! toiletbrush posted:The only bit that is a bit poo poo is the bit that holds the current 'in flight' instruction across ticks so it doesn't change cpu state until the right number of ticks have elapsed. I don't even know if that's how it should do it? I haven't even tried to deal with that part yet, but I made my State class immutable and my emulate() function return the new state along with the number of cycles the instruction will/would take. I figure I'll delay applying the new state until the right number of cycles have passed, or something. I haven't really sorted through how I'll deal with emulating the processor speed and the interrupts yet.
|
# ? Aug 13, 2018 22:00 |
|
Captain Foo posted:what's a unit test if you find out can you let our devs know tia edit: also me because as per the above i pretty much learned what i know by going through then eventually refactoring our code base which has......zero tests. Powerful Two-Hander fucked around with this message at 22:38 on Aug 13, 2018 |
# ? Aug 13, 2018 22:34 |
|
echoing that, i never learned really learned how to do testing beyond test as you go incremental development, certainly nothing part of a build process the last job i had paid somebody else to write/regularly run test suites against the running embedded system so we had some kind of testing, but i wasn't very involved
|
# ? Aug 13, 2018 23:27 |
|
Captain Foo posted:what's a unit test code:
|
# ? Aug 13, 2018 23:28 |
|
I'm amazed at the other pl thread that actually has the embarrassment of riches to actually argue about what type of unit tests is good, while here I am struggling for scraps with this pos test suite that takes 9 hours to run, but don't worry guys we got, "ideas to fix them!" I literally just saw a test that performed a bunch of loving asserts, then the last line of the test was markTestSkipped(). When I comment out the last line it's actually a passing test. What the gently caress was that Dev on when it was marked as skipped I want some of that too to ease my pain
|
# ? Aug 13, 2018 23:33 |
|
floatman posted:I'm amazed at the other pl thread that actually has the embarrassment of riches to actually argue about what type of unit tests is good, while here I am struggling for scraps with this pos test suite that takes 9 hours to run, but don't worry guys we got, "ideas to fix them!" it could be (or was) a flappy test. Did you run it again? Flappy tests (tests that alternatively succeed and fail) can be really hard to debug if your test fixtures were engineered badly.
|
# ? Aug 13, 2018 23:47 |
|
Sorry for double post, but I'm finishing up this talk on Rust. https://www.youtube.com/watch?v=LjFM8vw3pbU It's Bryan Cantrill, a joyent guy, and he kinda rambles all over the place but he used Rust for a few weeks and thinks it's cool. Rust content starts at: 1:00:30 His discussion of the fight over npm shrinkwrap is kinda funny (at 1:11-ish)
|
# ? Aug 13, 2018 23:54 |
|
Finster Dexter posted:it could be (or was) a flappy test. Did you run it again? Flappy tests (tests that alternatively succeed and fail) can be really hard to debug if your test fixtures were engineered badly. Did I ever mention the time I discovered that our integration tests were intentionally using alternating auth methods depending on whether the day of the month was odd or even
|
# ? Aug 14, 2018 00:23 |
|
NihilCredo posted:here's a real life scenario: products have VAT rates. those VAT rates can occasionally change over time, meaning both that a product can be moved to a different VAT rate, or that a VAT rate can be increased or decreased by a percentage point or two (let's keep it simple and say it's one VAT rate per product (it's not)). Can you define what you mean by "wrong rate", like basically the VAT should be denormalized and stored at the time of the invoice rather than mutating with the current rate the entire way through?
|
# ? Aug 14, 2018 00:29 |
|
correctly computing and adjusting VAT rate information sounds more like a domain knowledge/architecture question...?
|
# ? Aug 14, 2018 00:33 |
|
I mean there's many ways you can test them, but it comes closer to "integration" since if the VAT is 'take current snapshot then mutate but the invoice is unchanged' arguably may depend on a component having to control current VAT (or a per-date historic table), and one handling the invoices themselves. So to check the interaction (or lack thereof) between both components, I'd imagine this stuff would not initially fit well under unit tests. But if you wanted to unit test it, you gotta isolate everything to ignore the filesystem, network, and other components, you could use a mock; first call has a reported current VAT at say 10%, second call 11%, 12%, and so on. Make sure that the value you have on the invoice is at a given % value; call the mock to read/change the value so it should be higher. Check on the invoice again and ensure the invoice was unchanged. That shows the isolation between current rate and rate-at-invoice-time. Anyway that would be the simple way to go without caring too much about whether it's clean or not. But yeah, having mostly finished writing a testing book, a big problem is that interesting tests require interesting codebases to demonstrate stuff, and having to introduce an interesting system just to test it after the fact is a hell of a lot of work (both for reader and author), and it's hard to make it interesting to the reader. You've got to dump a bunch of code going "this is not actually relevant to the lesson in this chapter but you have to go through it anyway, sorry!"
|
# ? Aug 14, 2018 00:54 |
|
|
# ? Dec 3, 2024 13:37 |
|
toiletbrush posted:The only bit that is a bit poo poo is the bit that holds the current 'in flight' instruction across ticks so it doesn't change cpu state until the right number of ticks have elapsed. I don't even know if that's how it should do it? the way y'all are describing pipelining is really strange, can't wrap my head around it
|
# ? Aug 14, 2018 01:00 |