Tag Info

Hot answers tagged


If a function performs two tasks, or one task in two different ways, it should be two functions. This is the single responsibility principle. While the code may "compare strings" in both cases, the inputs might be different or the way in which it compares strings might be different. The keys to remember when thinking about it being "clever" to overload a ...


The value of bob is 1 as of the first line of code which assigns 1 to a variable named bob. Then the string "bob" is assigned to the variable bob, replacing the value of 1. It's the same variable, just with different values. This is dynamic typing since the program will be type checked when these lines of code are executed. "Strong" and "Weak" typing are ...

Only top voted, non community-wiki answers of a minimum length are eligible