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
POKEMAN SAM
Jul 8, 2004

Wheany posted:

commented out code (checked in version control),

I can't loving stand this when I see it.

Adbot
ADBOT LOVES YOU

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Ugg boots posted:

I can't loving stand this when I see it.

Which part bugs you the most? For me it's the unexplained lines of code cluttering up the project when you already have a revision control system in place. The rare times I do it I put a date stamp and a one line explanation of why at least.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
I love this

/*

[... commented out code ...]

someVariable = someObscureFunction();

[... commented out code ...]

*/

When grepping trying to find references to someVariable or someObscureFunction.

Hughlander
May 11, 2005

Received a library from a 3rd party today with a 'sample' program included called UniteTest_LIBRARYNAME.CPP...

Open it up and it's barely an integration test. The entire thing is one pass through a transaction, create transaction, run transaction, cleanup transaction.

There's no edge cases. There's no error cases, hell there's only the single 'correct' case.

I've never gone so quickly from elation to depression. (Oh hey, Unit Testing! That's... :confused: not Unit Testing...)

Brecht
Nov 7, 2009

Hughlander posted:

Received a library from a 3rd party today with a 'sample' program included called UniteTest_LIBRARYNAME.CPP...

Open it up and it's barely an integration test. The entire thing is one pass through a transaction, create transaction, run transaction, cleanup transaction.

There's no edge cases. There's no error cases, hell there's only the single 'correct' case.

I've never gone so quickly from elation to depression. (Oh hey, Unit Testing! That's... :confused: not Unit Testing...)
While I agree with you that what you described totally sucks, testing one code path exclusively is precisely a unit test. And integration tests are the next level "above" unit tests, not below. So I guess the point of this post is I'm confused by your terminology.

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Scaramouche posted:

Which part bugs you the most? For me it's the unexplained lines of code cluttering up the project when you already have a revision control system in place. The rare times I do it I put a date stamp and a one line explanation of why at least.

I really enjoy deleting these blocks. My favorite is when the file is 90% commented out code from a year ago that isn't relevant to anything at all in the current version.

Brecht posted:

While I agree with you that what you described totally sucks, testing one code path exclusively is precisely a unit test. And integration tests are the next level "above" unit tests, not below. So I guess the point of this post is I'm confused by your terminology.

The thing he's describing is an integration test - an end-to-end integration test specifically. And at best a BVT. All that test does is say "Yup, you didn't break the universe". It doesn't tell you what "unit" broke, just that "it's broken".

Unit tests don't test one "code path", they test one "unit of code", which is usually a single method (or object), and generally test that unit multiple ways, hitting all the possible edge cases. Failing (well-designed) unit tests usually give you a lot of detail on what exactly broke.

Dessert Rose fucked around with this message at 20:53 on Jun 7, 2011

Brecht
Nov 7, 2009

Ryouga Inverse posted:

The thing he's describing is an integration test - an end-to-end integration test specifically. And at best a BVT. All that test does is say "Yup, you didn't break the universe". It doesn't tell you what "unit" broke, just that "it's broken".

Unit tests don't test one "code path", they test one "unit of code", which is usually a single method (or object), and generally test that unit multiple ways, hitting all the possible edge cases. Failing (well-designed) unit tests usually give you a lot of detail on what exactly broke.
I agree with everything you said and still find his post confusing. Which tells me it's a word choice issue and not any fundamental misunderstanding. So that's OK, cool.

Hughlander
May 11, 2005

Brecht posted:

While I agree with you that what you described totally sucks, testing one code path exclusively is precisely a unit test. And integration tests are the next level "above" unit tests, not below. So I guess the point of this post is I'm confused by your terminology.

My terminology probably sucked.

All they did was call 3 functions in their API with a single argument list and called it a unit test.

It was something like:

code:
ASSERT( 0 == StartTransaction(arg1, arg2) );

while( result = (ProcessTransaction() == PROCESSING) )
    sleep(100);

ASSERT( result == DONE );

ASSERT( 0 == TearDownTransaction(arg3) );
That was the sum total of their 'Unit Tests' Hence me calling it more of an integration test.

This was the tests to a library of thousands of lines of code, tested in a module of under 100 lines. When I write unit tests, it tends to be about 30% more lines of code then what's being tested.

POKEMAN SAM
Jul 8, 2004

Scaramouche posted:

Which part bugs you the most? For me it's the unexplained lines of code cluttering up the project when you already have a revision control system in place. The rare times I do it I put a date stamp and a one line explanation of why at least.

No, this is fine, and I do it when it is like this:

code:
// Commented out for the demo until we can figure out the performance problems --Ugg 6/8/2011
// DoTheThing();
But seeing 100 lines of code wrapped with #if 0 that was written 5+ years ago and is still in the code makes me furious. If it's like "hey we might need this later" then it should be deleted, but if it's only genuinely temporarily commented out pending further changes/investigation, then that's fine.

ozymandOS
Jun 9, 2004

Ugg boots posted:

But seeing 100 lines of code wrapped with #if 0 that was written 5+ years ago and is still in the code makes me furious. If it's like "hey we might need this later" then it should be deleted, but if it's only genuinely temporarily commented out pending further changes/investigation, then that's fine.

We use SVN where I work. Depending on your team, it's actually mandated that you comment out code you wish to remove instead of just removing it. You will be called out in code review for not doing so.

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

BP posted:

We use SVN where I work. Depending on your team, it's actually mandated that you comment out code you wish to remove instead of just removing it. You will be called out in code review for not doing so.

Wh... why? Does the entire team work off the same checkout?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

BP posted:

We use SVN where I work. Depending on your team, it's actually mandated that you comment out code you wish to remove instead of just removing it. You will be called out in code review for not doing so.

That's horrible. We actually will call people out in code reviews for leaving in chunks of commented out code. I very proudly removed several thousand lines of commented out code when I was recently making some tweaks to an older application. The culprit for all of those commented out lines? Me. I felt a great weight lift off my shoulders.

The thing I wish more than anything else in the world is that people would be more verbose in their check-in comments. I hate it when I get a user saying "hey, process A used to do X, Y, and Z. But I just noticed it stopped doing them at some point."

I check source control, and sure enough, a 2 year old checkin from a guy who left long ago. The comment on the checkin says: "Changed process to not do X, Y, Z"

No explanation for why the change was made, so the best I can say to the user is "Yep, you're right, it did used to do that stuff. Timmy removed it on 3/28/2009. I have no clue why. Sorry."

New Yorp New Yorp fucked around with this message at 00:35 on Jun 9, 2011

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Ugg boots posted:

No, this is fine, and I do it when it is like this:

code:
// Commented out for the demo until we can figure out the performance problems --Ugg 6/8/2011
// DoTheThing();
But seeing 100 lines of code wrapped with #if 0 that was written 5+ years ago and is still in the code makes me furious. If it's like "hey we might need this later" then it should be deleted, but if it's only genuinely temporarily commented out pending further changes/investigation, then that's fine.

At the job I just quit, I left blocks like this in commits:
code:
/* This is code marketing asked for last week, but today they decided they 
* didn't want it, but I know the focus group tomorrow :suicide: will whine
* and they'll beg me to put it back in and I will tell then it will take two days
* and I will use that time to look for a new job

/// code 

*/

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

Lumpy posted:

At the job I just quit, I left blocks like this in commits:
code:
/* This is code marketing asked for last week, but today they decided they 
* didn't want it, but I know the focus group tomorrow :suicide: will whine
* and they'll beg me to put it back in and I will tell then it will take two days
* and I will use that time to look for a new job

/// code 

*/

I'm sorry to say I've worked projects where I'd see a comment like that and nod understandingly. And then I'd tell marketing that their request would take four days, blame half of it on you, and use the other two days to look for a new job.

And those assholes wonder why their "enterprise solution" is falling behind the curve.

Zhentar
Sep 28, 2003

Brilliant Master Genius

DaTroof posted:

Wh... why? Does the entire team work off the same checkout?

Around here (which I fear may actually be the same place) people generally do things like that out of many years of habit from the days before SVN usage, or because they don't understand that it was only done that way in the past because there was no SVN, or becuase they don't understand how to use SVN so don't really feel they can get it back.

Moxie Omen
Mar 15, 2008

one of the developers at my jorb used to insist on doing seperate commits on every single file he modified

hirvox
Sep 8, 2009

MOOMIN.EXE posted:

one of the developers at my jorb used to insist on doing seperate commits on every single file he modified
We're more in the habit of making mega-commits that solve four minor bugs at once and introduce two major bugs.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



MOOMIN.EXE posted:

one of the developers at my jorb used to insist on doing seperate commits on every single file he modified

Right when we introduced SVN here, one guy took it to mean it was replacing his FTP client. Every time he wanted to see his changes run (this is PHP), he would commit from his local machine and update on the server. This went on for a couple weeks before I noticed.

Also, I have lots of SVN ignore rules like '*.001' or '*.bak' to keep people used to the old way that we used to do 'version control' from adding the copies of modified files they still inexplicably make from adding them to the repository.

Hughlander
May 11, 2005

Munkeymon posted:

Right when we introduced SVN here, one guy took it to mean it was replacing his FTP client. Every time he wanted to see his changes run (this is PHP), he would commit from his local machine and update on the server. This went on for a couple weeks before I noticed.

Also, I have lots of SVN ignore rules like '*.001' or '*.bak' to keep people used to the old way that we used to do 'version control' from adding the copies of modified files they still inexplicably make from adding them to the repository.

They probably just have a script of:
svn update | grep -v ^? | cut -f 2 | xargs svn add
svn commit -m 'Committing'

that they run everytime they change something.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Hughlander posted:

They probably just have a script of:
svn update | grep -v ^? | cut -f 2 | xargs svn add
svn commit -m 'Committing'

that they run everytime they change something.

Wishful thinking. They all run Windows and I was the only one who had ever heard of CygWin when I got here.

People around here are so used to obtuse, convoluted manual processes that he probably didn't think anything of using Tortoise's commit workflow every time he wanted to upload his changes.

Munkeymon fucked around with this message at 15:49 on Jun 9, 2011

yippee cahier
Mar 28, 2005

I'm always getting asked in emails why I made a change to a certain file in SVN. I think I'm the only one who uses comments.

Hughlander
May 11, 2005

sund posted:

I'm always getting asked in emails why I made a change to a certain file in SVN. I think I'm the only one who uses comments.

When I had that problem I just replied back with
$ svn log FILENAME
<pasted output of log>

1337JiveTurkey
Feb 17, 2005

MOOMIN.EXE posted:

one of the developers at my jorb used to insist on doing seperate commits on every single file he modified

My last SVN commit was number 524193. :suicide:

POKEMAN SAM
Jul 8, 2004

1337JiveTurkey posted:

My last SVN commit was number 524193. :suicide:

My last changelist number committed was 685093 :)

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

I did a query on the repository, next ID will be 31304.

We're efficient yo :cool:

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Ugg boots posted:

My last changelist number committed was 685093 :)
21759446 :gonk:

POKEMAN SAM
Jul 8, 2004

Janin posted:

21759446 :gonk:

Holy poo poo

PrBacterio
Jul 19, 2000

Janin posted:

21759446 :gonk:
Yeah I've always assumed that working at ginormous projects for humungeous corporations like that must suck. Makes me glad to be working for a small embedded tech startup, my last commit was #209 :)

NotShadowStar
Sep 20, 2000

Janin posted:

21759446 :gonk:

No loving way. Pics or it didn't happen.

Standish
May 21, 2001

Janin posted:

21759446 :gonk:
that's 5,400 commits every single day since subversion was released back in 2000, what are you doing?

zeekner
Jul 14, 2007

Standish posted:

that's 5,400 commits every single day since subversion was released back in 2000, what are you doing?

All I can imagine is some app backed by a flat file database. Eventually they need to scale, enterprise style. Rather than spend 10 minutes rewriting the app to use SQL, they write to the file and check it into SVN. Every time the app goes to read the file it calls svn update first, and every time it writes it will commit those changes.

The Überhorror.

PalmTreeFun
Apr 25, 2010

*toot*
Did somebody write a script that commits literally every time they hit the space bar? Jesus.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Janin posted:

21759446 :gonk:

:psyduck: I just hit 5000 today!

more like dICK
Feb 15, 2010

This is inevitable.
Came across this yesterday. Is using LINQ to parse XML a horror?

code:
t.Details = (from XmlNode i in taskInfo where i.Name == "details" select i).First().InnerText;

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog
That's exactly what LINQ-2-XML is for, so no.
t.Details = taskInfo.Where(x => i.Name == "details").First().InnerText; is shorter though.

more like dICK
Feb 15, 2010

This is inevitable.
Neat, never seen LINQ used for XML before :)

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

PrBacterio posted:

Yeah I've always assumed that working at ginormous projects for humungeous corporations like that must suck. Makes me glad to be working for a small embedded tech startup, my last commit was #209 :)
It's really lots of fun, I can work on big important stuff at work and then come home and hack on little side projects.

Standish posted:

that's 5,400 commits every single day since subversion was released back in 2000, what are you doing?
Well it's not like I'm by myself; plus, we use Perforce, not subversion. I think the current change rate is 20 commits per minute.

SavageMessiah
Jan 28, 2009

Emotionally drained and spookified

Toilet Rascal

Janin posted:

Well it's not like I'm by myself; plus, we use Perforce, not subversion. I think the current change rate is 20 commits per minute.

Google?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

DIW posted:

Neat, never seen LINQ used for XML before :)

Every time I see LINQ to XML, it makes me want to go back and rewrite a specific XML-parsing application we have. It uses DataTables. It's horrible.

I just put the whole thing under test, too... maybe it's time to do some stealth refactoring.

Adbot
ADBOT LOVES YOU

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

SavageMessiah posted:

Google?
yup

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