@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:
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: