Tag Info

New answers tagged

0

the spaceCount loop counts all of the actual spaces in the string, and ignores the spaces at the end (since you've been given the actual length of the string minus the trailing space in the length parameter). The spec doesn't say that the amount of space left at the end of the string coincides exactly with the required space to hold the additional ...


1

The definition you posted says: You may assume that the string has sufficient space at the end of the string to hold the additional characters. And not: You may assume that the string has exactly enough space at the end of the string to hold the additional characters. Lesson 1 in code interviewing is to read (or listen to) the specification ...


0

Private functions do not necessarily need to do the same data validation that public functions need to do. Since some private functions are solely for doing data validation, it would be incorrect to say that they never need to do any data validation. But it is (or should be) perfectly acceptable to have a private function that requires a certain state ...


1

Yes. A private, internal function is called by some other function (or is dead code). While a private function is not part of a public interface for a class, namespace, or module, it still can produce useful work for functions that are part of the public interface. While not exposed directly, it does contribute to the public interface transitively. ...


2

YES. Private methods should be held to the same standards as public ones. Recall that there is a Bell Curve. Recall that about 50% of programmers are below average. By definition. Assume that you will NOT be the only person who ever works on your code. Assume that at least one of the people who works on your code will be someone who should not be ...


2

When it comes to checking for invalid data, (and also invalid state,) there are two types of checks that you can perform: development-time-only assertions, (in short, assertions) which happen only in development environments and are skipped on production environments. production-time checks, (in short, checks) which happen both on development and on ...


0

Write the minimum amount of code to do the job properly. In your example I'd say don't bother, if there is no way (without code modifications) that it make loops then don't bother accounting for it. You'll end up writing less code which you can expand on later, rather than too much code which could potentially get confusing later on.


0

You are not alone in this, my friend. I cannot speak for every programmer that there is in the world, but from conversations and empirical experience when faced with much complex code to work/refactor we obviously feel anxious or confused, but that can be related with us being humans and not specifically a subspecies. I can recommend this though, take it ...


3

This is normal. Some context: I am a junior developer at a midsize telecommunications company. I have a Master's degree in computer engineering and was programming in college for 3-4 years before I went into the professional world. I have been programming professionally for about a year now. This has been the most difficult programming experience ever. No ...


0

You actually demonstrate one use of this question in your edit, where you fail to design a workable model. public class ParkingLot { IVehicle Vehicle {set; get;} List<Slot> GetEmptySlots() { }; } public class Vehicle : IVehicle { Slot SlotNum {set; get;} } public class Slot { int Row {set; get;} int Column {set; get; } } var parkingLot ...



Top 50 recent answers are included