Creamy Goodness wrote: » http://www.php.net/manual/en/datetimeimmutable.modify.php
Despite the name, and unlike <code>DateTime::modify</code>, this function does <i>not</i> modify the DateTimeImmutable object. Code inspection leads me to believe that it <i>copies</i> the DateTimeImmutable object, modifies the copy, and returns that.
long propertyID; if (//some validation here) { // Some stuff } else { [B] propertyID = (long)1;[/B] }
BrokenArrows wrote: » long propertyID; if (//some validation here) { // Some stuff } else { [B] propertyID = (long)1;[/B] } Why the cast?
var somevar = (bool) false;
Code: long propertyID; if (//some validation here) { // Some stuff } else { propertyID = (long)1; } Why the cast?
ChRoMe wrote: » Opened up the class I've been asked to retro fit with unit tests (the code is 10 years old). The class is 30k lines....
BrokenArrows wrote: » I have one with 32793 There are plenty of others around the 20k mark. Every time a change request comes in for this software I die a little. Annoying thing was it was discontinued years ago but we have a few customers who refuse to let it go and are paying for continued development.
public string TellMeDate() { return DateTime.Today.ToString(); }
Korvanica wrote: » public string TellMeDate() { return DateTime.Today.ToString(); } Is this really necessary....
Ludo wrote: » It needs comments!
/// <summary> /// Get the date /// </summary> /// <returns>The Date string</returns> public string TellMeDate() { // Start of method return DateTime.Today.ToString(); // Returns the date string from DateTime.Today object in the format defined by regional settings. // End of method } :)
if(myBool) { myOtherBool = true; }
return map.containsKey(mKey) ? true : false;
return (null==map) ? false : map.containsKey(key);
/// <summary> /// Get the date /// </summary> /// <returns>The Date string</returns> public string TellMeDate() { // Start of method String datetime = DateTime.Today.ToString(); // Returns the date string from DateTime.Today object in the format defined by regional settings, and saves it to a string variable called datetime. return datetime; // return the datetime string from the previous line // End of method }
The_B_Man wrote: » return (null==map) ? false : map.containsKey(key);
return map != null && map.containsKey(key);
id rather brie wrote: » Other than noise, there's a lot of other stuff, like get a list of records from DB and THEN filtering them by looping though the list...jesus.
Colonel Panic wrote: » I see this all over the place in some code I maintain. Selecting 200 records when 2 would do. I've been able to improve performance just by changing SQL.
c_man wrote: » Our scrummaster told us this morning that the Mythical Man-moth, specifically the part about throwing more people at a problem not making the task faster, is itself a myth.You just need the right people with the right expertise Which we don't haveAh ye can get up to speed in no time Sigh.
Berserker wrote: » He then told me that unit testing was of no use, unless you were using the TDD methodology.
@Test public void testSomething(){ final String returnValue = ""; setupMock(); DBConnectionManager objUnderTest = new DBConnectionManager(); objUnderTest.doMethod(); assertNotNull(returnValue); }
Dacelonid wrote: » Just on the topic of tests, last year I had to do an analysis of the unit tests on a ~4 year old project that was currently mostly being developed by an offshore team Apart from using @Ignore to turn off tests that were failing, or deleting asserts so that they wouldn't fail, or tests in the wrong class, or tests named for something stupid rather than what it was testing, the one that really stuck in my mind was something along these lines (method names are made up)@Test public void testSomething(){ final String returnValue = ""; setupMock(); DBConnectionManager objUnderTest = new DBConnectionManager(); objUnderTest.doMethod(); assertNotNull(returnValue); } There was a bit more code that that in the test, but that was a general structure. I tried to explain the management and the offshore teams, that this wasn't actually testing anything, they didn't really get it.