@Vogel612 lol, I agree. Unfortunately, this thread is referenced 16 times throughout a very large project, and I'm the only person making what's supposed to be a minor change.
So I can't test every entry point, and if I blow it up, I'm screwed.
Unit testing is the hard way to learn to always extend/implement existing classes/interfaces. If you do it correctly, it means there's less code to test.
Btw, if code has a very high test coverage and a good record, do you then think it's okay to replace functionality if you see something weird in old code? More talking about code at a company here than personal code
Use Case
So our lead programmer loves to follow the NIH Anti-Pattern and consequently I'm not allowed to use Underscore.js and can only use Vanilla JS... and we have to support IE8.
The goal is to produce an aggregation of unique values from nested collections buried within various collections ...
First attempt was done here
Second attempt was done here
Huge comment at top
/*
* Export single function that creates the passportControl object
* The function has two parameters:
* app: The nodejs/express service object.
* This is used to register the...
Once you've pushed it, it's trickier. If you suspect that anyone else might have fetched or pulled it, then it's a mess to clean up. On the other hand, if it's a private branch, you could fix it locally, then do a git push -f to overwrite the remote.
I too am late to the game, let's see what I can make of this code
I would merge some things together, like your print statements, there are two places in which you have two print statements where one would be sufficient. I have moved them around, hopefully I didn't murder C in any way by doing ...
I will check back when I am done testing my code at work
I have not done any parameter checking, however I think the meat of the class is there. Let me know what you think.
#include <cstddef>
#include <vector>
using namespace std;
template<class T>
class TreeNode {
private:
T* data;
TreeNode<T>* parent;
vector< TreeNode<T>* > childre...
I am putting together a fairly simple server that listens for a connection then creates this thread - textbook java code - then accepts data on that connection.
I am following a protocol that the manufacturer has laid out for SOM and EOM as below. I then simply populate a byte array with using a...
Please be brutal, and treat this as a top 5 technical interviews.
Suppose I am asked to find the minimum number of coins you can find for a particular sum, that is say coins are 1, 3,5 and sum is 10, answer should be 2, since i can use the coin 5 twice.
Time Complexity = O(n^2)
Space Complexity...
Dabbling around with Roslyn and made a small analyzer just now. This one will show a warning in Visual Studio when you have a try-catch statement that only has a catch(Exception e).
I realize the working code (AnalyzeNode) is rather small, but I'm looking for feedback on best-practices (insofar ...
In Objective-C, many of the NSString or NSMutableString methods for comparing or manipulating strings require a range argument--that is, an argument of data type NSRange (a struct containing a starting position and a length). This applies outside of NSString (NSArray for example), but NSString i...
I'm thoroughly puzzled by your use of the response variable.
The condition for the while-loop is response != 'Y'. The first time through, response is an uninitialized variable, containing any imaginable int value. So, the behaviour of your program is undefined.
response is an int. Why are yo...
I'm not sure if there was a more diplomatic way of saying that the code is completely broken.
I have code which is matching features within regions. The first thing it does it matches features from one region to an entire database of region features.
So I have a mapping from query feature index (qfx) into database feature index (ax).
A database feature index has associated with it a reg...
I tend to disagree with the use of var for known types: from c#3.0 language reference... "Overuse of var can make source code less readable for others. It is recommended to use var only when it is necessary, that is, when the variable will be used to store an anonymous type or a collection of anonymous types." — Nick Williams1 hour ago
ugh
@NickWilliams I tend to disagree with what's considered "overuse" of var. I don't see how cutting redundant clutter reduces readability, and using var or not boils down to personal preference - in my answer I only recommended consistency in its usage. — Mat's Mug9 mins ago
So Stopwatch sw = new Stopwatch(); is so much more readable than var sw = new Stopwatch();... Holy Warz......
there's no difference whatsoever. if you don't get what the type of a new StopWatch() is, it's not because there's a readability issue on the left of the assignment, it's because you're not reading the dang code!!!
I've written this email program in python, and I would like to improve upon it. (i.e., Closing the server twice after the raw input is kind of silly.)
import console
import socket
import smtplib
from getpass import getpass
user = raw_input('What is your name? ').title()
host_name = socket.getho...
I encountered with the following code in the work. According to the explanation I got from the person who wrote this, and which supposed to be the architect of the company, the MyItemCoordinator should receive MyItem objects, process them, add them to MyItemList collection and then pass them to t...