• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Program design

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I want to develope an program which checks a file for several things.
The file which should be checked is an CSV file, delimiter is semicolon.
The program should contain following features / functions:



My questions is how is the best way to design the program.
How to inport the file and do the checks for each column?
Should I use an database to store the values and compare or use Strings?
How about the other features? Any suggestion how to implement the features above?
 
Sheriff
Posts: 17137
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Robert Sta wrote:
The file which should be checked is an CSV file, delimiter is semicolon.


That's contradictory. CSV is a de facto standard and has well-established formatting rules. The file you're processing is either CSV, in which case, delimiters are double quotes or it's not CSV and has semicolons as delimiters. Which is it? If delimiters really are semicolons, then you shouldn't say it's a CSV file; Delimiter-separated values would probably be a better term for it.
 
Junilu Lacar
Sheriff
Posts: 17137
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At the very least, you want to have good Separation of Concerns. Assign different concerns to different parts of your program and have each part do one and only one thing well (Single Responsibility Principle)
 
Robert Sta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:

Robert Sta wrote:
The file which should be checked is an CSV file, delimiter is semicolon.


That's contradictory. CSV is a de facto standard and has well-established formatting rules. The file you're processing is either CSV, in which case, delimiters are double quotes or it's not CSV and has semicolons as delimiters. Which is it? If delimiters really are semicolons, then you shouldn't say it's a CSV file; Delimiter-separated values would probably be a better term for it.




Hey Junilu,

thanks for your quick response.
I'm not sure if I understand you right. How ever, the following example should show what I meant:

Example of an analogous European CSV/DSV file (where the decimal separator is a comma and the value separator is a semicolon):

Year;Make;Model;Length
1997;Ford;E350;2,34
2000;Mercury;Cougar;2,38



 
Junilu Lacar
Sheriff
Posts: 17137
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know this is nitpicky but CSV stands for Comma Separated Values -- if the delimiters value separators are semicolons, then it's not CSV. That's all I was pointing out.
 
Marshal
Posts: 8427
606
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are these all your requirements you putted as a comment? Is it homework?
 
Ranch Hand
Posts: 75
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:I know this is nitpicky but CSV stands for Comma Separated Values -- if the delimiters value separators are semicolons, then it's not CSV. That's all I was pointing out.



It's actually pretty common that CSV files would have a different separator, and most of the times it would be semicolon. Eg. on windows platforms, it gets the separator from the regional settings.
So I wouldn't say it's all that wrong.

As for the program, do you have anything so far ?

Claudiu
 
Saloon Keeper
Posts: 14318
321
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Claudiu Chelemen wrote:It's actually pretty common that CSV files would have a different separator, and most of the times it would be semicolon. Eg. on windows platforms, it gets the separator from the regional settings.
So I wouldn't say it's all that wrong.



Then they're not CSV files. It's like saying I'm going to store something as an XML file, but instead of using text, I'm going to store pictures of my notepad.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Then they're not CSV files. It's like saying I'm going to store something as an XML file, but instead of using text...


Well, to give Claudiu his due, the Wiki page does say that " In popular usage ... the term CSV may denote some closely related delimiter-separated formats".

@Robert: Parsing CSV (or DSV) files is not as simple as you might think, because a "field" might contain the delimiter you use (which is just one of the reasons I prefer TAB-separation) - and a fair bit of the standard is taken up in describing how to encode (and parse) those sorts of situations.

There are, however, several open-source libraries around for doing it, so I suggest you take a spin on Google. Alternatively, someone here may be able to suggest a good one.

HIH

Winston
 
Bring out your dead! Or a tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic