Working on a project and the .NET application contained IP's all over the code. I created a class to put them in one spot based on SOLID. Looking at the below class can this be refactored? Should I create an Interface then a class that inherits that Interface and a class for each IP?
Namespace Properties Module IPAddress Private _ProdIP As String = "1.2.3.4" Public ReadOnly Property ProdIP() As String Get Return _ProdIP End Get End Property Private _TestIP As String = "2.3.4.5" Public ReadOnly Property TestIP() As String Get Return _TestIP End Get End Property Private _QAIP As String = "3.4.5.6" Public ReadOnly Property QAIP() As String Get Return _QAIP End Get End Property End ModuleEnd Namespace
I dont know how many IPs you are talking about but i think you are overcomplicating it.
for ease of maintenance I would have created something like:
Public Class addreses
Public Const ProdIP As String = "1.2.3.4"
Public Const TestIP As String = "2.3.4.5"
Public Const QAIP As String = "3.4.5.6"
End Class
for ease of maintenance I would have created something like:
Public Class addreses
Public Const ProdIP As String = "1.2.3.4"
Public Const TestIP As String = "2.3.4.5"
Public Const QAIP As String = "3.4.5.6"
End Class
or an ENUM