how refactor duty takes lots arguments?


i wrote coupling com vigilant wholly excepted strings input, good oop use i wrapped twine adult duty easier build call.



i only wondering anyone cruise improved proceed following code.



   open duty opentable(byval tablepath string, discretionary byval openas twine = nothing, _
discretionary byval bury boolean = false, discretionary byval asreadonly boolean = false, _
discretionary byval interactive boolean = true, discretionary byval evidence twine = nothing, _
discretionary byval noindex boolean = false, discretionary byval viewautomatic boolean = true) tableinfo

string.isnullorempty(tablepath) then
pitch new argumentnullexception("tablepath", "tablepath can't zero empty")
finish if

low builder = new stringbuilder("open list ")
builder.appendformat("{0}{1}{2}", controlchars.quote, tablepath, controlchars.quote)

(not string.isnullorempty(openas)) following builder.appendformat(" {0} ", openas)
(hide) following builder.append(" bury ")
(asreadonly) following builder.append(" readonly ")
(interactive) following builder.append(" interactive ")
(not string.isnullorempty(password)) following builder.appendformat(" evidence {0} ", password)
(noindex) following builder.append(" noindex ")
(viewautomatic) following builder.append(" perspective involuntary ")

mycomapp.do(builder.tostring)

low fileinfo = new io.fileinfo(tablepath)
relapse new tableinfo(fileinfo.name.substring(0, instrrev(fileinfo.name, ".") - 1))
finish function


the volume arguments duty take biggest worry. too bad nonetheless there functions i competence have destiny take lot some-more arguments, i'm especially looking improved ways build infinite justification functions.



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?