Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Element creation (factory and helper) #27

Open
atla5 opened this issue Jun 23, 2016 · 0 comments
Open

Refactor Element creation (factory and helper) #27

atla5 opened this issue Jun 23, 2016 · 0 comments

Comments

@atla5
Copy link
Member

atla5 commented Jun 23, 2016

all Element subclasses currently contain nearly identical factor functions...

public static [Element] create[Element](String qualifierText, String value) { 
  ...
}

and different implementations of the same helper

public static String determineQualifier(String str){
  if(...){ return ...; }
  else if(...){ return ...; }
  else{ return ""; }
}

I had originally planned to put both of these into the Element superclass, make the former generic and inherited, and stub out the latter as an abstract function. I can't do this because they're static, but they need to be in order to be used to create the objects.

Finding no direct solution to this problem, having a bit of a time sensitivity, and given that it's not a functional issue at this point (code base is small, it's easy to infer, and unlikely to need revision), it stands as an ugly part of a codebase I'm otherwise pretty proud of.

I'd love some help with a solution to this while I work on other things, else I'll just come back to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant