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
geeves
Sep 16, 2004

venutolo posted:

Would you elaborate on this? What did it involve? I've previously not heard of this practice.

Take 3 employees.

I wrote code for Function A

I had to write a test code for Function B

I had to QA test Function C.

Adbot
ADBOT LOVES YOU

Bongo Bill
Jan 17, 2012

Pair programming and test-driven development. Alice writes a valid and failing unit test. Bob changes the implementation to make it pass. In some versions of this exercise, Alice writes the next test, whereas in some versions, Bob does. Keep going until all the requirements have tests demonstrating they've been met.

This is the only context in which "writing tests for somebody else's code" doesn't make me wary of other problems.

Keetron
Sep 26, 2008

Check out my enormous testicles in my TFLC log!

JewKiller 3000 posted:

on the other hand, having yourself write the tests for the code you just wrote usually means you write the same code again, only backwards

i'm not saying you shouldn't write tests for your code, but it pays to have an outside perspective too, and the back-and-forth is precisely why

The bold part is not true.
You write a little bit of code that gives the method input and checks the expected outcome based on that input. You basically write design specs in test format. Because that is what you do, you write tests, not functional code.
In fact, as soon as you start writing tests that have a decision flow, you are doing it wrong. See my other posts about test automation in this thread.
But I am biased, I do nothing but writing tests for other people's code and make money because nobody else wants to do it while not having to work very hard. There is a lot of side effects in QA such as mentioned but after more then a decade in the field, I got immune to that. Still kind of decided I will move more into "real" developer roles as the demand is even higher, pay is better and it seems devs are not seen as a cost center. Will take me a year or two to get some basic certification and work in a project where I can convince them that I can put that project on my cv as a dev to be able to sell myself as a dev to the next project. Work on OSS stuff in the mean time to get some more experience. The usual :-)

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.
I don't know anything about your particular situation, but in my own anecdotal experience, having developers not write their own tests is a great way to ensure all the code on a project is not written to be easily testable, and that test coverage is scattershot attempts at grey-box half-measure "integration tests" that test nothing in particular.

It's certainly possible to do it, and get it right, but it definitely requires a strong testing culture and developers who have had lots of experience writing tests even if they're not the ones doing it right now.

B-Nasty
May 25, 2005

Vulture Culture posted:

having developers not write their own tests is a great way to ensure all the code on a project is not written to be easily testable

I feel like this is an often-overlooked benefit of a strong unit testing culture. Even if code-coverage isn't some arbitrarily high percentage or the tests are trivial, designing the code for ease of testing is almost always the way to go.

One example from recent experience is a codebase (zero tests) that used property injection instead of constructor injection and multi-level abstract class inheritance. So, properties on the base classes would be injected and in order to attempt to test a method, you'd basically have to untangle all the magic that happened in multiple files without a clear picture of what needed to be mocked. I posit that a unit-test culture would've immediately convinced the developer of that code that what he is doing is stupid and bad. The pain and friction that happens when you go to write tests is a strong indication that you need to rethink what you're doing.

If your code is hard to test, it is bad code. Q.E.D.

My Rhythmic Crotch
Jan 13, 2011

Guy: What don't you like about my code?
Me: Well, <long list of carefully thought out criticisms, without trying to personally attack him or his code>
Guy: I'm just going to leave it the way it is. I like it because I wrote it.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
We have zero people dedicated to testing or QA and I would estimate that 75% of my coding time is spent working on tests as a result, but I've literally never gotten any sort of pressure to skimp on that to get features out.

CPColin
Sep 9, 2003

Big ol' smile.
You're living the dream.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
The ability to take as long as I feel I need to get something into a shippable state with only rare deadlines is definitely one of the things I really like about my current job.

jony neuemonic
Nov 13, 2009

CPColin posted:

You're living the dream.

No kidding. Cherish that job.

Che Delilas
Nov 23, 2009
FREE TIBET WEED

Plorkyeran posted:

The ability to take as long as I feel I need to get something into a shippable state with only rare deadlines is definitely one of the things I really like about my current job.

Meanwhile:
"Hey Che I know we talked about slowing down and doing more deliberate release cycles with builds on UAT/staging environments for a certain amount of time, but we want you to release this new feature as a hotfix because customer wants it and will be annoyed if they don't have it (i.e. The situation for every customer and stakeholder on the planet that will exist until the heat death of the universe)."

GutBomb
Jun 15, 2005

Dude?
I work for a consulting company and in between gigs I am on the bench. I still get paid and just work on either personal projects to learn new poo poo, or projects the company needs done. I like the bench. But when you're on the bench you also get sent out on a lot of time wasting interviews. I get to interview at some pyramid scheme makeup company tomorrow (I live in Utah so there's loads of pyramid scheme companies around) for a back-end PHP development position. I told the guy that I only do front end stuff and what little PHP I've done has been really basic. His response "well, it's good to interview anyway, right?"

I just know this is going to be one of those "writing code on a whiteboard" interviews where I'm going to end up looking like an idiot because that's just not how I (or anyone, really) write code. I'm wasting my time, the client's time, and the agency's time, and potentially making myself and this guy look like idiots for showing up.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

GutBomb posted:

I work for a consulting company and in between gigs I am on the bench. I still get paid and just work on either personal projects to learn new poo poo, or projects the company needs done. I like the bench. But when you're on the bench you also get sent out on a lot of time wasting interviews. I get to interview at some pyramid scheme makeup company tomorrow (I live in Utah so there's loads of pyramid scheme companies around) for a back-end PHP development position. I told the guy that I only do front end stuff and what little PHP I've done has been really basic. His response "well, it's good to interview anyway, right?"

I just know this is going to be one of those "writing code on a whiteboard" interviews where I'm going to end up looking like an idiot because that's just not how I (or anyone, really) write code. I'm wasting my time, the client's time, and the agency's time, and potentially making myself and this guy look like idiots for showing up.

Spend the entire interview telling them PHP is trash and how they should throw out everything and re-write it, and you are the perfect choice for such a task.

hailthefish
Oct 24, 2010

For half a second I wondered if there actually were people who show up to an interview and spend the entire time bagging on the company's language/stack choices and then I realized of course there are. :spergin:

geeves
Sep 16, 2004

hailthefish posted:

For half a second I wondered if there actually were people who show up to an interview and spend the entire time bagging on the company's language/stack choices and then I realized of course there are. :spergin:

A few months ago, I phone interviewed with one company and when they said they were a ruby shop and would I be okay with it (this was not mentioned anywhere in the job description and they were looking for java). I may have said slightly audibly on call with 3 devs, "Oh gently caress, really?" because all I could think of was this:

http://classicprogrammerpaintings.com/post/142737403879/programmers-at-work-maintaining-a-ruby-on-rails

My Rhythmic Crotch
Jan 13, 2011

How have I never seen that site before? Holy poo poo that's incredible

geeves
Sep 16, 2004

My Rhythmic Crotch posted:

How have I never seen that site before? Holy poo poo that's incredible

Probably my favorite:



Another

Developer explaining SEO to marketing

Smugworth
Apr 18, 2003

Skandranon posted:

Spend the entire interview telling them PHP is trash and how they should throw out everything and re-write it, and you are the perfect choice for such a task.

Care to elaborate on why this is a common opinion? I'm genuinely curious, I just graduated and interviewed for a PHP position, and the only thing I really knew about the language was "people think it's a trash scripting language." I'm handy with Python, so I figured what the hell. Fortunately, they didn't ask me to code anything, and I accepted a position elsewhere.

geeves
Sep 16, 2004

Smugworth posted:

Care to elaborate on why this is a common opinion? I'm genuinely curious, I just graduated and interviewed for a PHP position, and the only thing I really knew about the language was "people think it's a trash scripting language." I'm handy with Python, so I figured what the hell. Fortunately, they didn't ask me to code anything, and I accepted a position elsewhere.

There are a whole host of reasons. But this has been the "opinion" for 15 years.

You can write good even great PHP. It's just that PHP allows people to write bad code easily. JavaScript is similar in this regard.

One of my old favorite examples is SQL scrubbing. There is "mysql_escape_string" but you shouldn't use that one - so instead of fixing the original method, PHP introduced "mysql_real_escape_string" so you know that one is real.

Some API issues are just dumb. Needle, Haystack arguments are swapped in some methods. so foo(needle, haystack) for 99% of methods then there is baz(haystack, needle)

And that's just the surface. There used to be something like "file.phps" (see: https://top-frog.com/script_src/source.phps ) where including that "s" would expose the PHP source depending on how your hosting situation was setup. God I found so many server and DB connections and if I was a complete rear end in a top hat could have deleted entire databases easily.

geeves fucked around with this message at 06:14 on Jun 28, 2017

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
The canonical rant is "PHP: A fractal of bad design".

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Smugworth posted:

Care to elaborate on why this is a common opinion? I'm genuinely curious, I just graduated and interviewed for a PHP position, and the only thing I really knew about the language was "people think it's a trash scripting language." I'm handy with Python, so I figured what the hell. Fortunately, they didn't ask me to code anything, and I accepted a position elsewhere.

It's a terrible language cobbled together over the last 15 years. It does nothing better than other languages in the same space. It has really stupid syntax, like using -> to access object properties, and . to concat strings. There is no reason to ever use it beyond "we have 15 years of PHP code our business depends upon". C#, Node.js, Java are all better and have better ecosystems. Hell, I would rather use RoR, and I HATE RoR.

Also, it stands for Personal Home Page. A guy wrote it so he could make a crappy blog. Let that sink in.

xiw
Sep 25, 2011

i wake up at night
night action madness nightmares
maybe i am scum

Cpig Haiku contest 2020 winner
PHP used a philosophy of keeping the same function API as the underlying C lib it was exposing - that's pretty much why you have all the things like mysql_real_escape_string as that is literally what mysql named its charset-aware escaping function.

Modern PHP is okay, not my fave language for fun, but the contempt culture around it is pretty bad.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

hailthefish posted:

For half a second I wondered if there actually were people who show up to an interview and spend the entire time bagging on the company's language/stack choices and then I realized of course there are. :spergin:

I had an interviewee jump straight to telling me we were idiots for picking C++ and that we would have to rewrite in C if we didn't want our codebase to inevitably turn into an incomprehensible mess the instant I asked a C++-related question.

The guy who said we should rewrite in Rust was a little more tolerable since he at least skipped calling us idiots for not picking it in 2011.

Doom Mathematic
Sep 2, 2008

My Rhythmic Crotch posted:

How have I never seen that site before? Holy poo poo that's incredible

Also.

DigitalRaven
Oct 9, 2012




PHP is less a programming language, more a Turing-complete set of security vulnerabilities.

Ghost of Reagan Past
Oct 7, 2003

rock and roll fun
I don't know PHP and have never used PHP and now I never, ever want to, because holy poo poo.

Iverron
May 13, 2012

GutBomb posted:

I work for a consulting company and in between gigs I am on the bench. I still get paid and just work on either personal projects to learn new poo poo, or projects the company needs done. I like the bench. But when you're on the bench you also get sent out on a lot of time wasting interviews. I get to interview at some pyramid scheme makeup company tomorrow (I live in Utah so there's loads of pyramid scheme companies around) for a back-end PHP development position. I told the guy that I only do front end stuff and what little PHP I've done has been really basic. His response "well, it's good to interview anyway, right?"

I just know this is going to be one of those "writing code on a whiteboard" interviews where I'm going to end up looking like an idiot because that's just not how I (or anyone, really) write code. I'm wasting my time, the client's time, and the agency's time, and potentially making myself and this guy look like idiots for showing up.

I can't tell from your post if you've worked for Pyramid Schemes / MLMs before, but my previous job ran off the entire .NET team due to an absolutely poo poo awful MLM client.

It's the weird thing where the main users of your website see it as their primary job and source of income and everything you do is ruining their life.

GutBomb
Jun 15, 2005

Dude?

Iverron posted:

I can't tell from your post if you've worked for Pyramid Schemes / MLMs before, but my previous job ran off the entire .NET team due to an absolutely poo poo awful MLM client.

It's the weird thing where the main users of your website see it as their primary job and source of income and everything you do is ruining their life.

I haven't but I do have major contempt for MLMs because they prey on people and the only people that ever prosper with an MLM are the people running it. I've been exposed to them my whole life because of dumb but well meaning family members who never seem to learn.

I don't particularly hate PHP, it's fine for what it is, but it's a huge mess, I've barely scratched the surface of its object oriented stuff and classes, I've never used any of its frameworks, and everything I've ever done with it was simple MySQL driven single page tools. I'm primarily a front end angular 1 guy and have no idea why my account manager thinks it's a good idea for me to go down there and make myself look like a fool and make the company look like it doesn't know what it's doing sending a fool down. If it was just a regular interview for myself I wouldn't care. I'd just refuse to do the whiteboard stuff and offer to let them look at some code on my laptop and walk them through a project I've done instead. But since I'm representing a company now it makes the company look bad if I don't play along and this company gives me money even when I'm not working. Yuck.

Most of my dev workflow is this:
I'm encountered with a problem. Build poo poo until I get stuck, usually reusing some poo poo I built for a previous project and reworking it. When I get stuck or something doesn't work, google->stack exchange(just reading other people's questions/comments, not like, asking "please write my code for me")->install a library->poo poo works and move on to the next problem to solve. I see people here and at work complain about "I can just google that" at a job interview but isn't that what everyone does? Most people except the most dedicated book learners are going to flounder on a whiteboard with no code insight, no snippets to refer to, no google/stack exchange.

Ugh. I got a lovely night of sleep too and I just don't want to do this at all.

Edit: found a job listing for this position online. It's a senior php developer. Come on dude.

GutBomb fucked around with this message at 15:50 on Jun 28, 2017

Iverron
May 13, 2012

GutBomb posted:

I haven't but I do have major contempt for MLMs because they prey on people and the only people that ever prosper with an MLM are the people running it. I've been exposed to them my whole life because of dumb but well meaning family members who never seem to learn.

It'll slowly eat at your soul.

Highly annoying clients that you have moral qualms with are literally the worst thing imaginable.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

GutBomb posted:

I haven't but I do have major contempt for MLMs because they prey on people and the only people that ever prosper with an MLM are the people running it. I've been exposed to them my whole life because of dumb but well meaning family members who never seem to learn.

I don't particularly hate PHP, it's fine for what it is, but it's a huge mess, I've barely scratched the surface of its object oriented stuff and classes, I've never used any of its frameworks, and everything I've ever done with it was simple MySQL driven single page tools. I'm primarily a front end angular 1 guy and have no idea why my account manager thinks it's a good idea for me to go down there and make myself look like a fool and make the company look like it doesn't know what it's doing sending a fool down. If it was just a regular interview for myself I wouldn't care. I'd just refuse to do the whiteboard stuff and offer to let them look at some code on my laptop and walk them through a project I've done instead. But since I'm representing a company now it makes the company look bad if I don't play along and this company gives me money even when I'm not working. Yuck.

Most of my dev workflow is this:
I'm encountered with a problem. Build poo poo until I get stuck, usually reusing some poo poo I built for a previous project and reworking it. When I get stuck or something doesn't work, google->stack exchange(just reading other people's questions/comments, not like, asking "please write my code for me")->install a library->poo poo works and move on to the next problem to solve. I see people here and at work complain about "I can just google that" at a job interview but isn't that what everyone does? Most people except the most dedicated book learners are going to flounder on a whiteboard with no code insight, no snippets to refer to, no google/stack exchange.

Ugh. I got a lovely night of sleep too and I just don't want to do this at all.

Edit: found a job listing for this position online. It's a senior php developer. Come on dude.

Senior PHP Developer === Developer who has realized every other option is better.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

GutBomb posted:

I haven't but I do have major contempt for MLMs because they prey on people and the only people that ever prosper with an MLM are the people running it. I've been exposed to them my whole life because of dumb but well meaning family members who never seem to learn.

I don't particularly hate PHP, it's fine for what it is, but it's a huge mess, I've barely scratched the surface of its object oriented stuff and classes, I've never used any of its frameworks, and everything I've ever done with it was simple MySQL driven single page tools. I'm primarily a front end angular 1 guy and have no idea why my account manager thinks it's a good idea for me to go down there and make myself look like a fool and make the company look like it doesn't know what it's doing sending a fool down. If it was just a regular interview for myself I wouldn't care. I'd just refuse to do the whiteboard stuff and offer to let them look at some code on my laptop and walk them through a project I've done instead. But since I'm representing a company now it makes the company look bad if I don't play along and this company gives me money even when I'm not working. Yuck.

Most of my dev workflow is this:
I'm encountered with a problem. Build poo poo until I get stuck, usually reusing some poo poo I built for a previous project and reworking it. When I get stuck or something doesn't work, google->stack exchange(just reading other people's questions/comments, not like, asking "please write my code for me")->install a library->poo poo works and move on to the next problem to solve. I see people here and at work complain about "I can just google that" at a job interview but isn't that what everyone does? Most people except the most dedicated book learners are going to flounder on a whiteboard with no code insight, no snippets to refer to, no google/stack exchange.

Ugh. I got a lovely night of sleep too and I just don't want to do this at all.

Edit: found a job listing for this position online. It's a senior php developer. Come on dude.

The problem with just showing off libraries that you wrote is that the interviewer has no idea whether you actually wrote it or not. That's why whiteboard interviews remain popular, even though everyone knows and agrees that it's a terrible way to do things.

An interviewer definitely shouldn't be asking you questions that you would need to look up. You should be able to ask them clarifying questions, or explain that you don't remember the exact algorithm for red black trees. The whole thing should be looking for signals. Obviously, "I don't actually know how simple and fundamental data structures actually work" is as big one, but flexibility and intelligence is required.

GutBomb
Jun 15, 2005

Dude?
It went better than expected. I went in there, told them my skill level in php, they showed me the project, and it was over within 25 minutes. No whiteboard.

Walking someone through my own code instead of whiteboarding worked for me before because when you're walking someone through your stuff in depth it's kind of hard to fake it. At least for me it would be.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

GutBomb posted:

It went better than expected. I went in there, told them my skill level in php, they showed me the project, and it was over within 25 minutes. No whiteboard.

Walking someone through my own code instead of whiteboarding worked for me before because when you're walking someone through your stuff in depth it's kind of hard to fake it. At least for me it would be.

OMG what have you done? Now you might actually get hired and have to work with PHP!

Hughlander
May 11, 2005

xiw posted:

PHP used a philosophy of keeping the same function API as the underlying C lib it was exposing - that's pretty much why you have all the things like mysql_real_escape_string as that is literally what mysql named its charset-aware escaping function.

Modern PHP is okay, not my fave language for fun, but the contempt culture around it is pretty bad.

Not really...

"Rasmus Lerdorf creator of PHP posted:

Well, there were other factors in play there. htmlspecialchars was a
very early function. Back when PHP had less than 100 functions and the
function hashing mechanism was strlen(). In order to get a nice hash
distribution of function names across the various function name lengths
names were picked specifically to make them fit into a specific length
bucket. This was circa late 1994 when PHP was a tool just for my own
personal use and I wasn't too worried about not being able to remember
the few function names.

Some names were chosen so there wouldn't be too many hash collisions with the hashing function strlen.

Pollyanna
Mar 5, 2005

Milk's on them.


quote:

Back when PHP had less than 100 functions and the
function hashing mechanism was strlen()

I know literally nothing and even I can tell that trying to hash things by their length is a dumb idea.

KoRMaK
Jul 31, 2012



I don't understand why that would even be a concern. Like really, I don't get it. Why hash your function names

sarehu
Apr 20, 2007

(call/cc call/cc)

KoRMaK posted:

I don't understand why that would even be a concern. Like really, I don't get it. Why hash your function names

To map function names to implementations in a hash table.

SuddenExpire
Jun 29, 2005

expired...
PHP is a great language if you dare to use it properly :getin:

KoRMaK
Jul 31, 2012



sarehu posted:

To map function names to implementations in a hash table.

why though? IS it a compiler thing or something?

Adbot
ADBOT LOVES YOU

csammis
Aug 26, 2003

Mental Institution

KoRMaK posted:

why though? IS it a compiler thing or something?

Yes. The short story is that the compiler or interpreter maps functions to locations in memory so that it can easily turn function invocations into jumps to that location.

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