Tag Info

Hot answers tagged

16

So am I missing something important here? YES While these look like the same thing, and represent the same thing in the domain, they are not the same (OOP) objects. One is the Order as known by the data storage part of the code. The other is the Order as known by the UI. While it's a pleasant coincidence that these classes have the same properties, ...


12

Yes, storing strings instead of numbers can use more space. The reason that high-profile pltforms are doing it anyway is that they think the benefits of that solution are greater than the cost. What are the benefits? You can easily read a database dump and understand what it's about without memorizing the enum tables, and even semi-official GUIs might ...


7

The purpose of the View Model is to provide decoupling in two ways: by providing data in the shape that the View requires (independent of the model), and (especially in MVVM) by pushing some or all of the View logic back from the View to the View Model. In a fully normalized model, Customer would not be represented in the Model by a string, but rather by an ...


2

It's far easier to roll back changes made in a database that it is at the "other end" of an API call. Here's how I'd do it: Start a database transaction and make the changes there. Do the API calls. If those work, then commit the database changes; if not, roll the changes back.


2

You can use triggers. CREATE TRIGGER notifyMe ON table1 AFTER INSERT, UPDATE, DELETE AS EXEC msdb.dbo.sp_send_dbmail @profile_name = 'DB AutoMailer', @recipients = 'user@example.com', @body = 'The DB has changed', @subject = 'DB Change'; GO


2

In some respect you are right: They both refer to the same domainobject, which is called order. But you are wrong in as far, it is not a real duplication than a different representation - originated from different purposes. If you want to persist your order, you e.g. want access to each and every column. But you do not want to leak that to the outside. ...


2

I propose looking into in code migrations for your language or technology. I have .NET stack and I can use Entity Framework Migrations where every schema change is single migration that can be automatically applied to database when needed. What is also possible is downgrading database, so pattern for db migration is that you have method for Up() and Down() ...


1

The approach that I follow is based on the following premises: Developers are not to be bothered with production data. That's for the operations department to worry about. Configuration xml files, scripts, etc must be kept at a minimum. Everything must be in the source code repository. The source code repository is to contain only diff-able text files, ...


1

Yes, storing things such as yes or true will take more space than a tinyint. This should not be surprising. It also makes indexing and thus joins less efficient for the database. It also has the penalty of possible confusion for what is the correct value (yes vs y). However, there are many approaches that look similar to storing strings in the database (in ...


1

Maybe consider a variation of two-phase commit: Make and commit your changes to the database first, then do your API calls. If the API calls fail, then make compensatory changes to the database (basically, update the database with the previous values). This had the virtue of not locking the database for any appreciable length of time, but gives you a method ...


1

It mostly depends on the size of the data you return and whether the user is expected to use all the data at once. For instance, if it's a list containing hundreds of thousands of complex entries: The response served as a single JSON will be rather large, and: It is unlikely that the user will actually need to see all the data at once. Instead, the user ...


1

Since you are not developing a website or a web application, but a desktop application which stores its data on a server, there are indeed a few layers you can skip. A common approach, in this situation, is to use web services. When a service should be lightweight and interoperable (that is, you can use it with ease from virtually every programming ...


1

I designed and implemented a hierarchy like this many years ago (before generics) so here are some comments. They may help stop you from repeating my mistakes :) The proliferation of methods like parseNumber(), parseName() suggests that the class hierarchy needs adjusment, yet your hierarchy looks well designed. My approach would be a combination of ...


1

Data is not 'object in nature' or 'relational in nature'. Any kind of data can be represented in both relational or a object model/graph structure. What is appropriate depends on how the data is going to be used by the applications. Often you might even have both. For example data used on a website could be stored in a relational database, but on-demand ...



Only top voted, non community-wiki answers of a minimum length are eligible