I’m reading “Refactoring” by Martin Fowler.
There is a term “type code” that I’ve never seen that before.
What is a type code?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One context in which a type code can appear is in C with a
uniontype:This leads to code like:
Now, was the omission of T_LONG from the switch deliberate or not? Was it recently added and this switch didn’t get the necessary update?
When you get a lot of code like that, and you need to add T_UNSIGNED, you have to go and find a lot of places to correct. With C, you don’t have such a simple solution as ‘create a class to represent the type’. It can be done, but it takes (a lot) more effort than with more Object Oriented languages.
But, the term ‘type code’ refers to something like the
Typetype in the example.