The following are an example of methods supported by a proprietary device:
Monitor
ControlTemp
PutPeakInfo
GetPeakInfo
I have a class that builds the packets for the above corresponding methods:
GetMonitorPacket
GetControlTempPacket
GetPutPeakInfo
Example:
public byte[] GetMonitorPacket(int ddcNum)
{
byte[] monitorPacket = new byte[MONITOR_PACKET_BYTE_COUNT];
Buffer.BlockCopy(START_HEADER_BYTES, 0, monitorPacket, 0, START_HEADER_BYTES.Count());
monitorPacket[2] = (byte) ddcNum;
monitorPacket[3] = 0x01;
byte checksum = 0;
foreach (var b in monitorPacket)
{
checksum = (byte) (((ushort) checksum + (ushort) b) & 0xff);
}
checksum = (byte) (checksum ^ 0x55);
monitorPacket[4] = checksum;
return monitorPacket;
}
All they do is return the bytes in proper format, which then will be sent to the proprietary device via TCP to call the methods. Now I'm screwed on my naming convention for GetPeakInfo
method.
- How do I name this? What about
GetGetPeakInfoPacket
(two gets for a method name)? - Do I break the naming convention here as an exception case and drop one of the gets?
- Do I use some other naming convention?
Actually, GetPutPeakInfo
sounds a little bit weird too, but at least there's no duplication.
MethodInfo
for property getter?PropertyInfo.GetGetMethod()
, no problem." In your case, i likeCreate
prefix. But, iguess, its a matter of taste. \$\endgroup\$