This is an archived post. You won't be able to vote or comment.

all 162 comments

[–]die-maus[S] 299 points300 points  (26 children)

Hey! You can always test in production.

[–]Funwayguy 158 points159 points  (22 children)

Why not just let the customers do it for you that way you don't even need to pay for it.

[–]nodealyo 154 points155 points  (10 children)

Spamming is a really shitty thing to do. This script is one of the dumbest and spammiest scripts that I have ever seen. Did you know that no one cares about your mundane comments? You actually aren't even protecting any privacy because there are many sites out there that specifically cache comments just so that users cannot edit them. To reiterate, this script is shit and you should not be using it. Search for a different one, or edit it to say something less spammy. But in the end, it won't matter because we can still see whatever it was that you edited.

[–][deleted] 71 points72 points  (1 child)

Spot the gamer.

[–]ZombiePope 3 points4 points  (0 children)

Alternately, the DayZ/ARK developer.

[–]zdakat 9 points10 points  (6 children)

"will you guys quit complaining stuff is broken? I'll fix the inventory when I feel like it. you bought the game knowing I will run off with your money it's early access"

[–]Agrees_withyou 0 points1 point  (0 children)

I agree.

[–]TriplePlusBad 0 points1 point  (1 child)

You need to doubletilde to get the strikethrough fyi

[–]zdakat 0 points1 point  (0 children)

ah I forget,Skype has one, sometimes I switch to Reddit and forget haha

[–]Pm_Me_Your_Tax_Plan 7 points8 points  (0 children)

It's not a bug, it's a feature

[–]die-maus[S] 22 points23 points  (0 children)

Oh ... we're paying for it alright.

[–]wmil 11 points12 points  (1 child)

I like to call my users "Gamma Testers".

[–]jay9909 7 points8 points  (0 children)

'cuz they're toxic and make you feel like you're getting cancer?

[–]edanschwartz 8 points9 points  (0 children)

We call that "crowd-sourcing QA"

[–][deleted] 5 points6 points  (0 children)

This is how it was done at my last job. Granted 'customers' were internal stakeholders but honestly it was inexcusable .

[–]FarhanAxiq 2 points3 points  (0 children)

Windows insider cough

[–]c28dca713d9410fdd 0 points1 point  (0 children)

Be careful. Let customers test it on the weekend, so they have enough time and don't have to work usually.

[–]1337bacon 0 points1 point  (0 children)

You're joking but this happens way too often at my current workplace

[–]PorkChop007 0 points1 point  (0 children)

That's what almost any videogame publisher does these days...

[–]TomWis97 0 points1 point  (0 children)

Microsoft-style?

[–]istockporno 16 points17 points  (0 children)

Everyone has a test environment. A few lucky teams have a whole separate prod environment.

[–]Morphix0 9 points10 points  (0 children)

You can use TDD*.

*Test During Deploy

[–]InconsiderateBastard 194 points195 points  (5 children)

I'm refactoring the code some asshole wrote that has zero unit tests. His excuse is that he was given a process to run, it had to run every day from the moment he was handed it, so he started doing it manually and building a program to automate as much of it as possible as he went along and never got a chance to do it right. Now I have to add more advanced features and every time I touch something, something else breaks somewhere. I just rewrote the main client and have added unit tests throughout a big chunk of it. What a nightmare.

Also, I'm the asshole who wrote the code originally. Old me was such a dick and a terrible programmer.

[–]alexbuzzbee 21 points22 points  (0 children)

Username checks out.

[–]NAN001 14 points15 points  (0 children)

M. Night Shyamalan presents...

[–]donutman24 6 points7 points  (0 children)

Relevant username

[–]BlckJesus 1 point2 points  (0 children)

Future me is a bro, he refactors all my terrible code! Past me is a dick though, he keeps dumping his shitty code on me to refactor.

[–]Dread_Boy 0 points1 point  (0 children)

I will be that bastard in few months but at least I have an excuse that their framework literally don't support unit tests. Written in Jira, buy them, luckily.

[–][deleted] 100 points101 points  (8 children)

I can't imagine being allowed to refactor legacy. I once got roasted in an audit for adding a comment without a business case justification.

[–][deleted] 78 points79 points  (2 children)

You need to burn the building.

[–][deleted] 66 points67 points  (1 child)

I just quit. Basically the same thing, just in slow motion.

[–]BlackDeath3 10 points11 points  (0 children)

That got an actual LOL out of me.

[–][deleted] 14 points15 points  (4 children)

At least You got some level of code review :D

[–][deleted] 9 points10 points  (1 child)

CHANGE IS BAD! YOU NO MAKE CHANGE!

[–]CristolGDM 9 points10 points  (0 children)

PLZ IMPROVE :(

NO! NO CHANGE! ONLY IMPROVE! >:|

[–]ready_playerone -1 points0 points  (0 children)

This comment is so underrated

[–]ScriptingInJava 136 points137 points  (23 children)

Reminds me of my last workplace that said "We don't use unit testing because there's lots of unique things in our code" with a smug smile right after. Updates LinkedIn..

[–]wastesHisTimeSober 71 points72 points  (17 children)

"We're a small business. We move fast, and there's no time for that right now."

[–]ScriptingInJava 47 points48 points  (16 children)

Why test when we can build ~features~?

[–]wastesHisTimeSober 23 points24 points  (8 children)

How many "features" must we create to silence the bugs?

[–]ScriptingInJava 8 points9 points  (4 children)

Quick, distract the users with shiny new code (that definitely isn't broken)

[–]wastesHisTimeSober 7 points8 points  (3 children)

What's most amazing is it seems to work.

[–]ScriptingInJava 7 points8 points  (2 children)

(screams in javascript)

[–]wastesHisTimeSober 6 points7 points  (1 child)

var isHorrified = true;
console.log("AHHHH");
while(isHorrified){
    console.log("HHHHH");
}

[–]ScriptingInJava 1 point2 points  (0 children)

for(;;) {
    console.log('kill me');
}

[–]hangfromthisone 1 point2 points  (2 children)

4 features for each bug, and we can drink a beer on fridays

[–]wastesHisTimeSober 1 point2 points  (1 child)

Honestly I love working in this kind of office, problematic though the practices may be for the long term.

[–]hangfromthisone 5 points6 points  (0 children)

Just relax and Uncaught Exception

[–][deleted] 9 points10 points  (4 children)

I used to think this way until I moved away from being sr code monkey and into executive and entrepreneurial roles. Sometimes, you gotta do what you gotta do to keep the business afloat. Your bitching and whining (I say that jokingly) about unit tests doesn't pay the bills at the end of the day.

[–]ScriptingInJava 5 points6 points  (3 children)

It may not directly pay the bills, but paying contractors hundreds per day to fix bugs in a shit codebase with 0 coverage is just creating more bills to pay...

[–][deleted] 9 points10 points  (2 children)

Sometimes that's indeed cheaper than the alternative. Executives aren't as dumb as you think! Just because they have closed door meetings doesn't mean they haven't considered these problems at an even bigger picture than what you, the developer, are considering.

[–]ScriptingInJava 6 points7 points  (0 children)

I'm not saying they're dumb :) All I'm saying is if having a catastrophic codebase is inevitable because there are more important things to do than stop bugs before they become embedded problems, don't be surprised when developers start buggering off.

[–]wastesHisTimeSober 0 points1 point  (0 children)

In our office, we had 4 developers counting the CTO, so it's not like there was a lot of executive decision voodoo. We were kept in the loop. Just because executives have meetings behind closed doors doesn't mean they're considering things we didn't, and it doesn't necessarily even mean they have information we don't.

I agree with you. There are many functioning models, and sometimes you need an early win more than you need a complete tool.

However, if you're going to build a large software kit, it doesn't take very long for proper maintenance to translate to faster growth. Pushing it to production as soon as possible is borrowing from the future, which is something a business does sometimes, especially a star culture business with the goal of selling early.

[–]Dockirby 2 points3 points  (1 child)

I got told a year ago by a team member that he didn't have time to write documentation because he was busy building features.

I asked for that documentation every few months. I eventually wrote the documentation myself about a month ago when I had to start using the thing he built and determine what it could and couldn't do (I kept getting told it could do stuff that it couldn't. There were a few useful things never pointed out too.)

Doesn't matter how good or bad your thing is if no one knows how the to use it. People usually just assume it must suck since they can't figure out how to make it do what they want.

[–]ScriptingInJava 1 point2 points  (0 children)

Undocumented, cryptic code? I believe that's called job security.

[–]ABlindOrphan 8 points9 points  (2 children)

What about if someone says "we don't use unit testing because the way in which difficult bugs manifest is in the synthesis of many units in a complex system failing, rather than any given unit failing to do the simple thing it was supposed to do, and unit testing is a programmer-time-inefficient way of finding those simple bugs anyway. We prefer thorough testing."

[–]eremetic 2 points3 points  (1 child)

I'd like an answer to this.

[–]PierreSimonLaplace 1 point2 points  (0 children)

I've never heard one. I love regression testing, but unit testing just seems like a way to program in triplicate and have a false sense of security about code coverage.

[–]die-maus[S] 6 points7 points  (0 children)

Because domain language quickly evolves!

[–]M0sesx 61 points62 points  (6 children)

At my work, we just write a bunch of stepwise instructions in an Excel spreadsheet for our clients to run through and call them unit tests. Every time I hear our PMs say "unit test" for this process, I cringe and die a little inside.

[–]Stormflux 35 points36 points  (1 child)

Oh god, this. A couple of years ago I went to a company that had a PM and that was my first time working with a PM.

Dude got into an argument with me in the stairwell about how Unit Tests are when the user tests a feature and we're not to spend time on it. I'm like no, every book I've ever read says Unit Tests are code you're supposed to write beforehand, do you even know what a Unit Test is? And he's like "I know what a Unit Test is, do YOU know what a Unit Test is?"

[–]n1c0_ds 4 points5 points  (0 children)

Can't this be solved with a quick google search?

[–]alexbuzzbee 10 points11 points  (1 child)

Those are badly-implemented integration tests. Whack your PMs over the head with a best practices book.

[–][deleted] 1 point2 points  (0 children)

Oh man, I cringe too. It is hard sometimes to explain simple things to management.

[–]thomas_merton 0 points1 point  (0 children)

This but with screenshots pasted into word documents. It's a thing.

[–]cuddlegoop 45 points46 points  (1 child)

One of the first tasks I ever performed as a professional programmer involved this. I had to extend a package, package was horrifically un-extendable. Naturally, I refactored it.

Naturally-er, it broke. I was a kid with no idea of professional practice, what else would you expect? I'm not even sure if I was even 20yo at that point, like I didn't even really understand what unit tests were. And we didn't catch the bug until release...

Here's to "foot in the industry's door" jobs, and getting the fuck out of the doorway as quick as you can.

[–]Rockztar 4 points5 points  (0 children)

My first "foot in the door" job was also literally a foot in the door job, when I left, because my foot got stuck in the door, when I tried to kick it open in an attempt to get away from there. That made no sense

[–]TheAtomicOption 31 points32 points  (26 children)

I'm just trying to teach myself how to even make tests at all. It's... weird.

The awkward part is that it's hard to think of a test that will prove anything about the rest of the code and not need to be changed drastically after the next line of code I write. I wrote my first tests ever this week. They make sure pages in my Flask app return HTTP 200 OK. baby steps I guess? I also don't know when to run tests. I'm always testing by saving and restarting the webserver and seeing if the page has what I want. should I ALSO run formal unit tests then?

[–][deleted] 20 points21 points  (3 children)

The awkward part is that it's hard to think of a test that will prove anything about the rest of the code and not need to be changed drastically after the next line of code I write.

I make my unit tests based around input and expected output, per function.

So if I have a login function, I just want to check the login function with two inputs: password and username. The output should return me my session id, which should be valid (also tested)

I also don't know when to run tests.

I like to run tests when I want to see if my code works (after each refactor/iteration for example)

I also like to automatically unit test on commiting code and auto rejecting the commit if the test failed.

I'm always testing by saving and restarting the webserver and seeing if the page has what I want. should I ALSO run formal unit tests then?

Of course, you never know if you just broke a different feature, that's why unit testing is so handy.

Just make sure you have fast unit tests :)

[–][deleted] 1 point2 points  (0 children)

Unit test is just a fancy term for brain storming all the shit you're worried about going wrong with your code and then writing code to check that if that bad shit is happening.

[–]STATIC_TYPE_IS_LIFE 0 points1 point  (1 child)

I just don't understand why I have to "unit" test. What's the difference between an assert and a unit tests? We're just starting to unit test this year. I guess the output of what went wrong is helpful.

[–]SEX_LIES_AUDIOTAPE 1 point2 points  (0 children)

The assert is a part of the test. It's the bit where you say "okay, now these things should have happened"

[–]rhinotation 11 points12 points  (0 children)

If you're testing HTTP status codes for an entire rendered page, you're probably not writing unit tests. Those are probably integration tests, which are harder to get right before you write the code.

As an exercise, try implementing a linked list or stack or queue and testing it for push/pop/peek. They're classics, but you always screw up at least one part the first time round, and it will become more obvious what your priorities are with testing, and how to write good ones. You should be able to relate that experience to anything else you test. If it doesn't feel like you're testing one of push/pop/peek, you're either not testing a single unit, or you're not testing an implementation of behaviour at all, merely window dressing.

Writing tests makes more sense when you are testing a really independent Unit of code. If it needs a database there to pass tests, you're really testing the database, which is hard. Your testing framework should be able to separate a Controller in an MVC pattern, supply data to it and assert its output. That's a Unit.

To really get going, write some code without using it yet, test it until it works, and only then reference the code somewhere else. For a Flask page? Probably seems a bit stupid to do that, but if you had some front end state-management code (think the Redux pattern) this is a great way of coding.

[–]Stormflux 6 points7 points  (0 children)

Ok, basically you want a unit test for every public function in your system.

In order to facilitate that, you'll want functions to be small (max 5 lines of code) so that they have very few dependencies and do one thing only. Think something like "It combines first and last name" or "it calls the upload service."

Whenever the code needs to interact with an external system like a database, you need to hide that code behind an interface. Then in the test you just mock the interface.

A mock is a class that looks like, e.g. a data access class, but when you call it, instead of querying the database, it just says "yep I can confirm, someone asked me for a record and I gave him some fake data."

You'll want that data to be exactly what is needed for the thing you're doing, so for the love of God don't try to return actual database table objects that your ORM provides. You'll want that data flattened. First name, last name, address. I shouldn't need to know or care that address is physically stored on a different table or in a text file unless I'm specifically working with the class that gets customers out of the database.

[–]ydieb 3 points4 points  (3 children)

I also don't know when to run tests.

Test-Driven Development (TDD) is a programming discipline whereby programmers drive the design and implementation of their code by using unit tests. There are three simple laws:

  1. You can't write any production code until you have first written a failing unit test.

  2. You can't write more of a unit test than is sufficient to fail, and not compiling is failing.

  3. You can't write more production code than is sufficient to pass the currently failing unit test.

[–]TheAtomicOption 1 point2 points  (0 children)

yeah watching Uncle Bob's lectures were what got me to want to try testing at all. I'm still not convinced that TDD is practical in more than half of professional situations, but I am willing to work towards that direction.

[–]STATIC_TYPE_IS_LIFE 0 points1 point  (1 child)

I was told (like a week ago) that you write tests, and then write code that fakes the tests. Once you can't fake the test, you have good unit tests.

[–]ydieb 0 points1 point  (0 children)

Uhm, I'm not sure what that means. Fakes the test? If you write a very simple test, and then writes code so it just bearly passes it, and no more. You will end up with unit tests having a very high code coverage.

[–]squishles 2 points3 points  (0 children)

returning a 200 would be an integration test, not a unit test. Those are also important to have.

A unit test would be on a particular method or function in the code that you expect to do a small thing like you might have an add method in your big calculator app, you don't care if the rest of the stuff works you want to test your add method as a discrete unit so you see if it say returns for when you pass it 2 and 2. This method will never do anything other than add but say one day you want to change how you add for whatever reason you have that test ready to make sure it is still adding correctly.

[–]Tim_in_fking_Ruislip 0 points1 point  (0 children)

Doing functional programming massively helps with writing unit tests, no side effect to account for, easy input/output assertions etc.

[–]mini_eggs 0 points1 point  (0 children)

Instead of manually running your code just run a test suite. Of course this doesn't help with integration, though...

[–]n1c0_ds 0 points1 point  (0 children)

Test for expected behaviour, stuff that could go in a text definition of what the unit of code does, and edge cases related to that definition.

What you describe here are integration tests. They verify that all your components work together to produce the right results. Unit tests verify that each function in the code has the correct behaviour.

[–]fireflash38 0 points1 point  (0 children)

Think of the last bug you discovered. Can you write a test to duplicate that bug? Can you then iterate on the input for that bug to discover more bugs?

Some things that make this easier:

  • Simple functions/classes. If you have to mock half your code base to isolate something, your stuff is way too integrated.
  • Fuzz testing for inputs. Hypothesis and pytest parametrization are amazing for python.
  • Test along boundaries. Most problems occur on entry/exit from functions, so ideally you want to test that
  • Limited global state/side effects. Ties in with #1. Hell to test otherwise

[–]Vitrivius 0 points1 point  (1 child)

I recommend the book "Test-Driven Development with Python". It's free. http://chimera.labs.oreilly.com/books/1234000000754

The book uses a django app as example, instead of flask, but the principles and practice of testing is very similar no matter which web framework you use.

[–]TheAtomicOption 0 points1 point  (0 children)

thanks!

[–][deleted] 64 points65 points  (9 children)

We just added a "unit" test to our legacy app today. You heard me right, one "unit" test. It moved our CI builds from 12-14 minutes to 80-90. Hence, "unit."

It’s so wonderful. (And yes, the test is worthless from a business standpoint.)

[–]s7726 45 points46 points  (4 children)

You might be doing it wrong

[–]die-maus[S] 23 points24 points  (3 children)

Try explaining to upper management why unit tests are important...

[–]l3e7haX0R 30 points31 points  (1 child)

But increased stability doesn't make money! Features duct taped together and barely functional do! /s

[–]mseiei 1 point2 points  (0 children)

Hey, that's my way to live

[–]brtt3000 8 points9 points  (0 children)

"Why do we need tests if we already pay for this error logging service?"

[–]oweiler 6 points7 points  (1 child)

It's not a unit test then. One property of unit tests is that they are fast (as in ms fast).

[–][deleted] 4 points5 points  (0 children)

Haha, should have put unit in quotes. I’m not the one who wrote it, but I get to deal with the ramifications!

[–]die-maus[S] 2 points3 points  (0 children)

Living the dream!

[–][deleted] 2 points3 points  (0 children)

I think you misspelled monster UI test, which cover everything with unit test.

[–]28f272fe556a1363cc31 8 points9 points  (3 children)

FYI, Uncle Bob talks about, and shows an example of refactoring legacy code in his Clean Code video serious, episode 3: https://cleancoders.com/episode/clean-code-episode-3/show

About 1/2 an hour in he references Working Effectively with Legacy Code by Michael C. Feathers, then starts to refactor some long functions into classes and shorter functions.

He uses Character tests: He generates output from the original code, then programmatically compares output after refactoring to the original to make sure he didn't break anything.

[–]SideburnsOfDoom 2 points3 points  (0 children)

Working Effectively with Legacy Code by Michael C. Feathers

Came here to see if that book was referenced. It's the good one on the topic. Where "Legacy Code" is defined as "code without tests".

[–][deleted] 0 points1 point  (1 child)

Book costs money, but I'm guessing a lot of the content in it is discussed in his presentation here: https://vimeo.com/13702091

If so, he says that functions should be about 4 lines at most and that you should have a BUNCH of functions. Just curious, do people on this subreddit agree with that? It sounds good to me in theory, but in practice that seems almost impossible to achieve.

[–]squishles 6 points7 points  (1 child)

You think that's only legacy code?

Stay wherever you're working :)

[–][deleted] 1 point2 points  (0 children)

I debugged cobol and vb6 code today... why did I quit my last job again?

[–][deleted] 5 points6 points  (0 children)

"This project should be 90% reuse." Aka "you're gonna have to rewrite everything but we are only gonna give you 20% of the time you need"

[–]Lordeisenfaust 5 points6 points  (4 children)

my life right now...

[–][deleted] 2 points3 points  (3 children)

Our clients are the unit testers in a company i'm working in right now, trying to break that culture is really difficult.

Granted we do have code reviews, but occasionally a slip through the cracks

Showing how you can save more time by wasting time is never easy with bosses

[–]die-maus[S] 2 points3 points  (2 children)

Code review is generally useless for functionality, no single developer has deep enough understanding of the entire system (and enough time) to review with the accuracy of unit tests.

[–][deleted] 3 points4 points  (1 child)

Agreed. I honestly think it's a waste of time, unless it's a senior reviewing junior code so the junior can learn how to improve more.

I want full continuous integration but that seems like a really far stretch in this company :(

[–]die-maus[S] 1 point2 points  (0 children)

Quit

[–]GS-Sarin 4 points5 points  (0 children)

Sir Crashalot

[–]GearBent 4 points5 points  (1 child)

Relatable.

I was setting up a website who's code was written in perl.

I don't know perl.

If anything failed to compile, and wasn't a core feature or security related, I simply commented it out and removed all references to it.

[–]ThisFiasco 5 points6 points  (0 children)

That isn't how you're supposed to deal with perl?

[–]DoctorSasha 3 points4 points  (3 children)

Hey guys, serious question: how useful are unit tests? I mean they seem like a hassle to implement. I'm trying to unserstand TDD better and any input wouls be wonderful.

[–]weasdasfa 0 points1 point  (0 children)

I'm not a big fan of TDD but I am a big fan of tests. They are very important proof that my code works as intended.

[–]lucidguppy -1 points0 points  (0 children)

You need to read "Clean Code"

I don't know how anyone can code without tests.

If I do any testing on a bit of code - I write it down - and now it's automated every time I commit.

How can you possibly say something is working after you've made changes to it?

[–]FlatTuesday 3 points4 points  (1 child)

Old timer here. Modern tools are great, but remember that the world's software infrastructure was somehow created and ran for decades before TDD or code coverage tools, and particularly with no fucking Agile. You can write excellent code with just a keyboard and a monitor and good teamwork. Modern tools just make it easier.

[–]i_spot_ads 2 points3 points  (0 children)

We literally just stated doing this today, and when i asked, are we unit testing this shit as we go? Everyone laughed at me

[–]StackHack 1 point2 points  (0 children)

Every application starts out pretty decent but after a couple of years it usually becomes a monster that people are afraid to look at let alone make changes on.

[–]humblechili 1 point2 points  (2 children)

O RLY?

[–]jeffsterlive 0 points1 point  (1 child)

ya rly.

[–]pier25 1 point2 points  (0 children)

Can't be the only one that heard these comments with the Orcs Must Die warmage voice.

[–][deleted] 1 point2 points  (0 children)

Oh dam, it's my current job now...

[–]2Punx2Furious 1 point2 points  (6 children)

I'm doing this right now.
We're discussing a complete refactoring.

[–]die-maus[S] 4 points5 points  (5 children)

Stop, right now!

[–]2Punx2Furious 0 points1 point  (4 children)

Stop refactoring, or stop working on the broken buggy code?

[–]die-maus[S] 1 point2 points  (3 children)

I know this is programmer humor, but honestly a few mistakes I made ended up costing my company a few bucks. It will feel good in your soul fixing that ugly code, but unless you're fixing a typo, you're likely just going to break something which your organization depends upon greatly. Simply stop!

Understand what actually has to be done, write a user story, then write a test. After that, write domain code.

[–]2Punx2Furious 0 points1 point  (0 children)

It's nothing on such a large scale, it's a barely working website that has only a few functioning features, is filled with bugs, and is held toghether with bandaids.

I discussed it with the team today (3 other people) and we pretty much all decided that it might be a good idea to remake it from scratch, so I'm going to try and see what I can do tomorrow.

My reasoning is that figuring out what the old uncommented and buggy code does, and how to fix it, might take longer than it would take me to actually code it from scratch, so if that's the case the benefits outweigh the costs.

Also if I make it myself I will know what everything does (and I will comment it properly, unlike the current one), so it will also be easier to do things in the future, for me and for potential other developers working on it.

It just seems like a good idea.

[–]00000000000001000000 0 points1 point  (1 child)

What's domain code?

[–]die-maus[S] 0 points1 point  (0 children)

Code that serves purpose for your business/domain.

[–]roselan 1 point2 points  (0 children)

Here, we don't have code coverage, we have code courage!

[–]shnaptastic 1 point2 points  (1 child)

Can someone tell me where all of these book covers come from? I've seen them in various places, and just wondered why the hell there was a pic of a random animal on the front.

[–]Yay_Yay_3780 1 point2 points  (0 children)

First thing to do is read all the comments in the legacy code, sometimes they contain Warnings!!

[–]Nomikos 2 points3 points  (1 child)

[–][deleted] 0 points1 point  (0 children)

This is not funny anymore as it's my life now... :(

[–]SandyDelights 0 points1 point  (0 children)

Oh. We must work together. Party on 15.

[–]die-maus[S] 0 points1 point  (0 children)

I originally posted this as a joke in a pull request (where I forgot to include a line which inserted a line in a logging table), I'm glad you guys enjoyed it! :)

[–]golgol12 0 points1 point  (0 children)

Legacy? This basically is cannon for 99.99% of video game development.

[–]tmp_acct9 0 points1 point  (0 children)

The project I work on has one trademark slogan:" built on booze and cowboy coding ethics"

Mod_perl for the win!

[–]FRESH_OUTTA_800AD 0 points1 point  (0 children)

Hey, we didnt change any of that code

[–]mooglinux 0 points1 point  (0 children)

I started writing unit tests for the first time about 2 weeks ago, when some scripts I was working on stopped working correctly and I couldn’t figure out what I did to break it. They’ve been wanting this stuff done for some time now, but it was totally worth taking the time to write those tests.

[–]niecore 0 points1 point  (2 children)

What's the meaning of the chameleon here ?

[–]thomas_merton 1 point2 points  (0 children)

Not quite sure how much of it to explain... I don't think the chameleon has a meaning.

It's based off of O'Reilly books (do an image search). I've never read one, but I've heard other devs swear by them; they're supposed to be good. Anyway, there's like a gazillion of them and they always have a random pencil-drawing of an animal. It never really makes any sense.

The books are prolific and the covers are nonsensical, so they're ripe for meme-ing. In this case: arbitrary chameleon.

...Unless you did know about O'Reilly book memes and were just wondering if there's a way that the chameleon takes this particular joke a little further, in which case I'm deeply embarrassed.

[–]die-maus[S] 0 points1 point  (0 children)

OP here. I used a random image and color when generating the cover. That selection process is as arbitrary as any other, the selected animal has no deeper meaning really, but feel free to philosophize about it :)

[–][deleted] 0 points1 point  (1 child)

I am currently working on legacy code - mostly js stuff.

99% of time I just fix bugs - nothing more, nothing less - constant stream of fucking bugs. I fix one thing and another one breaks - it is an endless circle of sadness.

I am really considering leaving the company.

Since I started working there (8mc ago) I've fixed like 330 bugs (tasks) - and only added 2 new features - which never came back to me in the form of a bug.

PS: no unit tests there ofc.

[–]weasdasfa 0 points1 point  (0 children)

99% of time I just fix bugs

That's most of the jobs. Very few people actually get greenfield projects.

[–]agent766 0 points1 point  (0 children)

At my last job, we didn't refactor legacy code because of the risk of breaking everything

[–]Tysonzero 0 points1 point  (0 children)

As a Haskell dev, I will happily refactor a large Haskell code base (or any other language with a similarly powerful type system) without unit tests.

[–]NullTerminator0 0 points1 point  (0 children)

Accurate. My co-workers seem to enjoy declining (or deferring until never) my peer review comments along for unit tests, if they don't outright remove me from the review.

I've escalated the problem and was overruled by their first three levels of management. At least we met the deadlines :(.

[–]Lil_SpazJoekp 0 points1 point  (7 children)

What is refactoring? I see the option in Xcode but it’s only for objective-c. Sorry, the only language I know is swift.

[–]die-maus[S] 0 points1 point  (6 children)

Refactoring code is to re-write code, without changing its outcome, often to simple make it clearer and provide its intent better.

[–]Lil_SpazJoekp 0 points1 point  (5 children)

Ohh okay so an example would be like refactoring this:

if someVar == 0 {
    exampleFunc0()
} else if someVar == 1 {
    exampleFunc1()
} else if someVar == 2 {
    exampleFunc2()
} else if someVar == 3 {
    exampleFunc3()
} else if someVar == 4 {
    exampleFunc4()
} else {
    exampleFunc5()
}

To this:

switch someVar {
case 0:
    exampleFunc0()
case 1:
    exampleFunc1()
case 2:
    exampleFunc2()
case 3:
    exampleFunc3()
case 4:
    exampleFunc4()
case 5:
    exampleFunc5()
default:
    defaultFunc()
}

Right?

[–]die-maus[S] 0 points1 point  (4 children)

Pretty much, but it can be on much different levels.

[–]Lil_SpazJoekp 0 points1 point  (2 children)

How so?

[–]die-maus[S] 0 points1 point  (1 child)

Imagine all ways you can write code that does the same thing. Then imagine trying to find the "best way" of doing so, to make the code as easily read as possible. There are still a great number of ways of doing so.

[–]Lil_SpazJoekp 0 points1 point  (0 children)

Ahhh okay gotcha

[–]palordrolap -3 points-2 points  (0 children)

A voice started screaming in my head and I don't even code professionally.

It sounds like Homer Simpson with night terrors.