Skip to main content
added some formatting
Source Link
Malachi
  • 29.1k
  • 11
  • 87
  • 188

Using vector to store input record data could become very inefficient within vsSanitizeData()vsSanitizeData(). Since vectors use an array internally, when you remove an element within a vector all of the elements after the one removed must be shifted. For a long list with many remove operations that could be a lot of unnecessary work.

As a matter of design I would sanitize the records as early as possible, within the read loop. There's no point in inserting an unusable record into the list. You may also have other criteria for rejecting a record and that would be a good place to localize those concerns.

As a matter of style I agree with an earlier answer regarding Hungarian notation and the annoyance of it. I believe it is pointless to adorn variable names with type indicators. It is redundant and becomes subject to inaccuracy when code is carelessly refactored over time so it can't be relied upon anyway. Better to have narrative yet simple and concise names that are oriented toward describing the problem domain. For example, instead of "Uno"Uno I would just use "universe"universe, instead of "vPlanet"vPlanet I would just use "planets"planets.

Good start and keep at it. Coding is recoding.

Using vector to store input record data could become very inefficient within vsSanitizeData(). Since vectors use an array internally, when you remove an element within a vector all of the elements after the one removed must be shifted. For a long list with many remove operations that could be a lot of unnecessary work.

As a matter of design I would sanitize the records as early as possible, within the read loop. There's no point in inserting an unusable record into the list. You may also have other criteria for rejecting a record and that would be a good place to localize those concerns.

As a matter of style I agree with an earlier answer regarding Hungarian notation and the annoyance of it. I believe it is pointless to adorn variable names with type indicators. It is redundant and becomes subject to inaccuracy when code is carelessly refactored over time so it can't be relied upon anyway. Better to have narrative yet simple and concise names that are oriented toward describing the problem domain. For example, instead of "Uno" I would just use "universe", instead of "vPlanet" I would just use "planets".

Good start and keep at it. Coding is recoding.

Using vector to store input record data could become very inefficient within vsSanitizeData(). Since vectors use an array internally, when you remove an element within a vector all of the elements after the one removed must be shifted. For a long list with many remove operations that could be a lot of unnecessary work.

As a matter of design I would sanitize the records as early as possible, within the read loop. There's no point in inserting an unusable record into the list. You may also have other criteria for rejecting a record and that would be a good place to localize those concerns.

As a matter of style I agree with an earlier answer regarding Hungarian notation and the annoyance of it. I believe it is pointless to adorn variable names with type indicators. It is redundant and becomes subject to inaccuracy when code is carelessly refactored over time so it can't be relied upon anyway. Better to have narrative yet simple and concise names that are oriented toward describing the problem domain. For example, instead of Uno I would just use universe, instead of vPlanet I would just use planets.

Good start and keep at it. Coding is recoding.

Source Link

Using vector to store input record data could become very inefficient within vsSanitizeData(). Since vectors use an array internally, when you remove an element within a vector all of the elements after the one removed must be shifted. For a long list with many remove operations that could be a lot of unnecessary work.

As a matter of design I would sanitize the records as early as possible, within the read loop. There's no point in inserting an unusable record into the list. You may also have other criteria for rejecting a record and that would be a good place to localize those concerns.

As a matter of style I agree with an earlier answer regarding Hungarian notation and the annoyance of it. I believe it is pointless to adorn variable names with type indicators. It is redundant and becomes subject to inaccuracy when code is carelessly refactored over time so it can't be relied upon anyway. Better to have narrative yet simple and concise names that are oriented toward describing the problem domain. For example, instead of "Uno" I would just use "universe", instead of "vPlanet" I would just use "planets".

Good start and keep at it. Coding is recoding.