Skip to main content
Code Review

Return to Question

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

Based on this this question and this this answer, I decided to try the enum approach to do some more conversions I need in my application. This time I required to convert between the different field naming conventions I use in my application:

Another example would be a matching I do between file headers in a CSV file (in the headers I accept any of the three naming conventions) and the field structure required for the CSV processing to be successful, which I get from a Java Bean whose fields (named using my JAVA convention) represent the list of headers I need to get on the file (with their expected data types). (This design is the outcome of several comments made in that that same question).

Based on this question and this answer, I decided to try the enum approach to do some more conversions I need in my application. This time I required to convert between the different field naming conventions I use in my application:

Another example would be a matching I do between file headers in a CSV file (in the headers I accept any of the three naming conventions) and the field structure required for the CSV processing to be successful, which I get from a Java Bean whose fields (named using my JAVA convention) represent the list of headers I need to get on the file (with their expected data types). (This design is the outcome of several comments made in that same question).

Based on this question and this answer, I decided to try the enum approach to do some more conversions I need in my application. This time I required to convert between the different field naming conventions I use in my application:

Another example would be a matching I do between file headers in a CSV file (in the headers I accept any of the three naming conventions) and the field structure required for the CSV processing to be successful, which I get from a Java Bean whose fields (named using my JAVA convention) represent the list of headers I need to get on the file (with their expected data types). (This design is the outcome of several comments made in that same question).

added 4 characters in body
Source Link
carlossierra
  • 548
  • 1
  • 5
  • 18

I would appreciate feedback regarding my coding style, the decision to use enums for this type of task and the solution I am trying to implement to the naming conversion problem I am facing (do you face this same problem? How do you approach it?).

My questions are:

  1. I would appreciate feedback regarding my coding style, the decision to use enums for this type of task and the solution I am trying to implement to the naming conversion problem I am facing (do you face this same problem? How do you approach it?).
  2. Do I need to program more defensively (check for several spaces/underscores in malformed names, null/empty names, etc)? Or should my contract just process names properly formed (according to one of the three conventions above) and produce unexpected results when something else is provided to it?
  3. And as a side question, would you use lambdas here? How? How can I improve this code further?

I would appreciate feedback regarding my coding style, the decision to use enums for this type of task and the solution I am trying to implement to the naming conversion problem I am facing (do you face this same problem? How do you approach it?).

My questions are:

  1. Do I need to program more defensively (check for several spaces/underscores in malformed names, null/empty names, etc)? Or should my contract just process names properly formed (according to one of the three conventions above) and produce unexpected results when something else is provided to it?
  2. And as a side question, would you use lambdas here? How? How can I improve this code further?

My questions are:

  1. I would appreciate feedback regarding my coding style, the decision to use enums for this type of task and the solution I am trying to implement to the naming conversion problem I am facing (do you face this same problem? How do you approach it?).
  2. Do I need to program more defensively (check for several spaces/underscores in malformed names, null/empty names, etc)? Or should my contract just process names properly formed (according to one of the three conventions above) and produce unexpected results when something else is provided to it?
  3. And as a side question, would you use lambdas here? How? How can I improve this code further?
deleted 5 characters in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Enum for Converting Between Field Naming Conventionsconverting between field naming conventions

  1. SQL naming convention (used for my field names in SQL DBs): field_name.
  2. JAVAJava naming convention (used for variables, iei.e. in beans): fieldName.
  3. TITLE naming convention (used for display purposes, iei.e. in GUI): Field Name.

I would appreciate feedback regarding my coding style, the decision to use enums for this type of task and the solution I am trying to implement to the naming conversion problem I am facing (do you face this same problem? howHow do you approach it)?).

BTWAlso, am I getting 'too clever' with these design decisions? My ultimate goal is to become very good at producing simple, understandable and correct code!

Enum for Converting Between Field Naming Conventions

  1. SQL naming convention (used for my field names in SQL DBs): field_name.
  2. JAVA naming convention (used for variables, ie. in beans): fieldName.
  3. TITLE naming convention (used for display purposes, ie. in GUI): Field Name.

I would appreciate feedback regarding my coding style, the decision to use enums for this type of task and the solution I am trying to implement to the naming conversion problem I am facing (do you face this same problem? how do you approach it)?

BTW, am I getting 'too clever' with these design decisions? My ultimate goal is to become very good at producing simple, understandable and correct code!

Enum for converting between field naming conventions

  1. SQL naming convention (used for my field names in SQL DBs): field_name.
  2. Java naming convention (used for variables, i.e. in beans): fieldName.
  3. TITLE naming convention (used for display purposes, i.e. in GUI): Field Name.

I would appreciate feedback regarding my coding style, the decision to use enums for this type of task and the solution I am trying to implement to the naming conversion problem I am facing (do you face this same problem? How do you approach it?).

Also, am I getting 'too clever' with these design decisions? My ultimate goal is to become very good at producing simple, understandable and correct code!

added 425 characters in body
Source Link
h.j.k.
  • 19.3k
  • 3
  • 37
  • 93
Loading
Source Link
carlossierra
  • 548
  • 1
  • 5
  • 18
Loading
lang-java

AltStyle によって変換されたページ (->オリジナル) /