Skip to main content
added 1 character in body
Source Link
Sixro
  • 117
  • 2

I won't answer to your question, but I think that an issue is created by the terms you have used. E.g.

XmlReader.read => twice "read"

I think you need an XML so I'll create an object XML that can be created from a textual type (I don't know C#... in Java it's called String). E.g.

class XML {
    XML(String text) { [...] }
}

You can test it and it's clear. Then if you need a factory, you can add a factory method (and it can be static like youyour 2nd example). E.g.

class XML {
    XML(String text) { [...] }

    static XML fromUrl(url) { [...] }

}

I won't answer to your question, but I think that an issue is created by the terms you have used. E.g.

XmlReader.read => twice "read"

I think you need an XML so I'll create an object XML that can be created from a textual type (I don't know C#... in Java it's called String). E.g.

class XML {
    XML(String text) { [...] }
}

You can test it and it's clear. Then if you need a factory, you can add a factory method (and it can be static like you 2nd example). E.g.

class XML {
    XML(String text) { [...] }

    static XML fromUrl(url) { [...] }

}

I won't answer to your question, but I think that an issue is created by the terms you have used. E.g.

XmlReader.read => twice "read"

I think you need an XML so I'll create an object XML that can be created from a textual type (I don't know C#... in Java it's called String). E.g.

class XML {
    XML(String text) { [...] }
}

You can test it and it's clear. Then if you need a factory, you can add a factory method (and it can be static like your 2nd example). E.g.

class XML {
    XML(String text) { [...] }

    static XML fromUrl(url) { [...] }

}
Source Link
Sixro
  • 117
  • 2

I won't answer to your question, but I think that an issue is created by the terms you have used. E.g.

XmlReader.read => twice "read"

I think you need an XML so I'll create an object XML that can be created from a textual type (I don't know C#... in Java it's called String). E.g.

class XML {
    XML(String text) { [...] }
}

You can test it and it's clear. Then if you need a factory, you can add a factory method (and it can be static like you 2nd example). E.g.

class XML {
    XML(String text) { [...] }

    static XML fromUrl(url) { [...] }

}