Yes, that’s a bad idea if you really don’t care about the GUI being dependent. In some cases, especially for “quick and dirty” tools, this is really the right choice. If this means that you can get something for a user who will still use it for a couple of days and takes care to do the work soon, and not always have a responsive interface, then it makes little sense to spend time switching between threads.
But no, that’s not how you intend to develop database applications that should remain responsive.
However, I can understand why books and textbooks do this - at least to some extent. If they try to teach you access to a database rather than streaming, it means that most of the code will be relevant to the subject than if everything were absolutely “production code”. From experience, I know that it is difficult to keep the "training code" as clean as I would like.
However, I think it would be nice if such textbooks and books explained this directly in front of you, so they do not lead to bad habits.
source share