Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How should I handle a deleted record at GUI level

 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Since I'm not reusing deleted record numbers, and I don't want to refresh data object cache again and again, what I'm doing is:
1) When a record is deleted, simply modify a flag
2) Never use that record number

However, at GUI level, how should I handle it?
e.g. If I removed 1st record, then when a user wants to read all records, the first record in result table is actually record number 2. So, how to map this? When user 'books' a record, he/she will simply provide new data for a record. So which approach should I follow?

1) Add a recNo field in data object. This field will be set while retrieving the record and will be referred for further operations. I'll also show this recNo in display table (though it will look a little weird if user see first record with recNo 2 - in case 1st record is deleted)

2) Since 'delete' is not a 'must' requirement, I simply won't care about this (and assume that first record is recNo 1 and so on)

I personally think that I should still go for 1st approach (since 'assumption' might be risky). Any suggestions?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I added a recNo field in data object, but didn't display it in the table, because that's internal information, no added value for the user (can only confuse him).
 
Ranch Hand
Posts: 590
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roel De Nijs wrote:I added a recNo field in data object, but didn't display it in the table, because that's internal information, no added value for the user (can only confuse him).



I took this approach too!
 
Ranch Hand
Posts: 101
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't include a recNo in the data object but the record numbers (from the database) is displayed in the GUI, this allows me to code the logic that gets the actual selected record using the table model's getValueOf(row, 0). I also provided a filter in the GUI to remove deleted records from the table model.
 
Don't listen to Steve. Just read this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic