What is a driver class? (Java)

后端 未结 4 1971
走了就别回头了
走了就别回头了 2020-12-06 04:34

I was reading through a Java textbook, and it mentions something called a \"driver class\". What is it, and how is it different from a normal class?

4条回答
  •  自闭症患者
    2020-12-06 05:28

    "driver class" could refer to a procedural programming style involving: (1) "container classes" and (2) "driver classes"

    Say that you are creating your own object as a container for data. Then you might want to create two types of classes: "containers" and "drivers"

    The "container class" might contain: - instance variables to hold the relevant data - getters and setters - methods to support moving data in/out of class (parsing, translation) - limited computations

    The "driver class" might contain: - main method that drives the execution of the overall task (aka entry point for execution) - calls to static methods, as with procedural programming - instances of container class objects to hold different data (may be organized in other data structures, e.g. arrays; manipulated to solve overall task)

提交回复
热议问题