Click here to Skip to main content
15,180,225 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Thought of the Day Pin
DRHuff27-Aug-21 9:04
MemberDRHuff27-Aug-21 9:04 
GeneralRe: Thought of the Day Pin
Eddy Vluggen27-Aug-21 17:07
professionalEddy Vluggen27-Aug-21 17:07 
GeneralImposing data type and length restrictions at the database level is stupid! Pin
5teveH27-Aug-21 3:26
Member5teveH27-Aug-21 3:26 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
Richard Deeming27-Aug-21 3:36
mveRichard Deeming27-Aug-21 3:36 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
5teveH27-Aug-21 4:02
Member5teveH27-Aug-21 4:02 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
obermd27-Aug-21 4:39
Memberobermd27-Aug-21 4:39 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
RickZeeland27-Aug-21 3:43
mveRickZeeland27-Aug-21 3:43 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
raddevus27-Aug-21 4:09
mvaraddevus27-Aug-21 4:09 
What you are bringing up is a foundational challenge of the Software Developer: where is the proper place for database-related logic. IE - How much does application do versus what the DBMS does?

ASAP Data Validation
You are codifying rules into your software that some else has to learn later on when/if a new application is built on top of the data.
If that is absolutely never going to happen (the data is only used by this one app) then you are correct, keep all the rules in the application.

But, what if later on the data in the database is going to be kept and a new App is being built, but now there are length constraints that you have to find all through the code? That could be very difficult when a dev down the road could just look at the length of the target field in the DB.

Flexibility
You said, "A traditional RDBMS has a fixed data model, (defined by the schema), and will need effort every time it needs changing"
But now this makes it sound like, "well, we'll create one big wide table with fields named Field1...Field200 and we'll just use it like a bucket. Make everything a huge varchar field."
But that can make the DB extremely slow also since fields will not be able to be indexed as easily.

Use Each Tool For It's Best Purpose
I like the balance of ​letting each tool do it's own work.
Here's what I mean by that:
1) allow the DB side handle lengths by implementing the built-in type system & field size constraints.
2) allow the software side (application) to do the programmatic types of things and much of data validation (insuring phone number is valid format).
3) Another good example is not using triggers. Triggers are like secrets that fire in the DB which later do some programmatic thing that can be very invisible to the developer. But this is programmatic type of code that should probably be in the app --- which helps you remember that the app is where data manipulation really occurs.

On your point, as a dev myself I can definitely see how you'd want as much _control_ of how the data is used in the application layer since we don't want to depend upon constraints that the DB Admin puts upon us. It just makes our lives more difficult & less flexible when we need to fix a thing that is happening in production.

There is no exact answer to this, of course, it is a ebb & flow type of thing & related to each shop and how they do it.
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
User 991608027-Aug-21 5:29
professionalUser 991608027-Aug-21 5:29 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
raddevus27-Aug-21 5:44
mvaraddevus27-Aug-21 5:44 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
User 991608027-Aug-21 5:47
professionalUser 991608027-Aug-21 5:47 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
Mircea Neacsu27-Aug-21 8:11
mvaMircea Neacsu27-Aug-21 8:11 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
User 991608027-Aug-21 8:18
professionalUser 991608027-Aug-21 8:18 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
Jörgen Andersson27-Aug-21 10:07
professionalJörgen Andersson27-Aug-21 10:07 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
raddevus27-Aug-21 10:37
mvaraddevus27-Aug-21 10:37 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
Jörgen Andersson27-Aug-21 10:40
professionalJörgen Andersson27-Aug-21 10:40 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
den2k8827-Aug-21 4:22
professionalden2k8827-Aug-21 4:22 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
Jörgen Andersson27-Aug-21 10:13
professionalJörgen Andersson27-Aug-21 10:13 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
dandy7227-Aug-21 4:29
Memberdandy7227-Aug-21 4:29 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
obermd27-Aug-21 4:38
Memberobermd27-Aug-21 4:38 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
englebart27-Aug-21 4:45
professionalenglebart27-Aug-21 4:45 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
Sander Rossel27-Aug-21 5:11
professionalSander Rossel27-Aug-21 5:11 
QuestionRe: Imposing data type and length restrictions at the database level is stupid! Pin
David Crow27-Aug-21 5:49
MemberDavid Crow27-Aug-21 5:49 
PraiseRe: Imposing data type and length restrictions at the database level is stupid! Pin
Slacker00727-Aug-21 7:00
professionalSlacker00727-Aug-21 7:00 
GeneralRe: Imposing data type and length restrictions at the database level is stupid! Pin
Gerry Schmitz27-Aug-21 6:15
mveGerry Schmitz27-Aug-21 6:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.