I'm in my first two months as a software engineer and just wanted to get advice on if this can be improved upon.
I've created a class that represents data from RFID in the form of a message:
class RFIDMessage
{
string _a;
string _b;
string _c;
string _d;
string _e;
string _f;
string _g;
string _h;
public RFIDMessage(string a, string b, string c, string d, string e, string f, string g, string h)
{
_a = a;
_b = b;
_c = c;
_d = d;
_e = e;
_f = f;
_g = g;
_h = h;
}
}
I've been reading about the Single Responsibility Principle and can't work out if this constructor can be improved upon by providing it a new data type. This message is parsed from the data read from an RFID tag and having eight parameters seems a little too many. The parameters won't change in this instance but there are other message types - this is just the default one.
My questions are:
1) Is there a way to reduce the number of parameters that makes the code more maintainable?
2) How can I change or improve the design of this class to accommodate more types of messages?
string[8]
.