Skip to main content
Code Review

Return to Answer

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

@x79 @x79 is right about using a struct for this. In fact, it makes sense to think of this in terms of an abstract data type, as defined in Code Complete:

@x79 is right about using a struct for this. In fact, it makes sense to think of this in terms of an abstract data type, as defined in Code Complete:

@x79 is right about using a struct for this. In fact, it makes sense to think of this in terms of an abstract data type, as defined in Code Complete:

added 458 characters in body
Source Link
janos
  • 112.9k
  • 15
  • 154
  • 396

Think in terms of it as an ADT Abstract Data Type(Abstract Data TypeADT)

Then yourThis collection of methods together form an abstract data type. They encapsulate the operations you need, while hiding the implementation details. Users of a UrlInfo don't need to know how the operations work, they just need to know what the operations are in the ADT (create / delete / isValid / print). These methods closely collaborate with each other, emulating class-like behavior in object oriented languages.

Armed with this ADT, your main function can be rewritten in a more functional, natural way:

Think of it as an ADT (Abstract Data Type)

Then your main function can be rewritten in a more functional way:

Think in terms of an Abstract Data Type(ADT)

This collection of methods together form an abstract data type. They encapsulate the operations you need, while hiding the implementation details. Users of a UrlInfo don't need to know how the operations work, they just need to know what the operations are in the ADT (create / delete / isValid / print). These methods closely collaborate with each other, emulating class-like behavior in object oriented languages.

Armed with this ADT, your main function can be rewritten in a more functional, natural way:

added 11 characters in body
Source Link
janos
  • 112.9k
  • 15
  • 154
  • 396

DefineThink of it as an abstract data typeADT (Abstract Data Type)

Define as an abstract data type

Think of it as an ADT (Abstract Data Type)

added 4314 characters in body
Source Link
janos
  • 112.9k
  • 15
  • 154
  • 396
Loading
Source Link
janos
  • 112.9k
  • 15
  • 154
  • 396
Loading
lang-c

AltStyle によって変換されたページ (->オリジナル) /