Ranter
Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
 
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Comments
		
- 
				
				Haha, I got a legacy app to refactor, I found this type of code:
 
 (true ? logic one : same logic one ) || true
- 
				
				 Crost39464yThis is nothing guys. I once had to explain why this is a bad test Crost39464yThis is nothing guys. I once had to explain why this is a bad test
 
 var service = new MockLibrary.Fake<MyService>();
 
 service.dosomething();
 
 service.VeryifyWasCalled(s => s.doSomething());
- 
				
				Being there, Done that.
 Just hang in there my friend and never forget, killing stupid people is still a crime.
 
 My biggest sigh of relief was the guy resigned voluntarily. 6 months after he left, the codebase was 30% the size.
- 
				
				 rsokhonn314yI once saw something like this: if something == true, return true, else return false. I asked “why don’t you just return that Boolean variable?”, then he said “just to be sure”. rsokhonn314yI once saw something like this: if something == true, return true, else return false. I asked “why don’t you just return that Boolean variable?”, then he said “just to be sure”.
- 
				
				 hjk10155824yIf the logic is sort than it's a silly style. If the logic is complex than it's perfectly valid: hjk10155824yIf the logic is sort than it's a silly style. If the logic is complex than it's perfectly valid:
 
 bool goodblah = some_mess < whatever;
 bool frobnacious = messy_crud != junky_expression;
 bool yetanother = long_winded_condition;
 
 if (goodblah || (frobnacious && yetanother)) {
 ...
 }
- 
				
				@hjk101 seems like c#
 and seems like the VerifyWasCalled takes function (delegate) as a parameter.
 
 it probably wants to be used as
 VerifyWasCalled(service.doSomething), basically providing a pointer to that function to the VerifyWasCalled one.
 
 what is being done there instead, is creating a lambda (anonymous) function, which, when called, calls the service.doSomething() function, and then passing that lambda to the VerifyWasCalled.
 
 *syntax for providing a pointer to the function (delegate) in my explanation is incorrect, i don't use delegates in this way too often, so i don't remember exactly how you create one/cast a function to one/whatever. as a bonus, delegates were always a bit confusing to me for some reason.
Related Rants









 Coworker's whiteboard today
Coworker's whiteboard today
You will know your 2 year old dev team is messed up when the 'best programmer of the bunch' does a line like:
boolean check = ...some logic...;
if(check == true) {...
:/ and I'm going to be leading this team..
rant
java