Does OData upset the separation of concerns?

I watch OData and it is very powerful, at the same time it is very embarrassing. This is the equivalent of exposing your data source to a remote user. There is nothing naz in the service and very few injection points, which leads to an almost ridiculous architecture with 2 levels.

My problems:

  • It is difficult to apply a template such as DDD when using OData.

  • It is also difficult to use OData for a set of Soa data transfer objects, since they are usually not requested. that is, when you receive a DTO, the database query is executed, but OData is just beginning. There is no great value in the request for it, since the DTOs are already in memory.

  • I can create an idea of ​​the database itself, which is a representation of an OData object, but this raises the question of user interface constancy. Big no no.

  • In the best case, combining a result set from various DDD services now occurs at the user interface level using kludgy javascipt, a maintenance nightmare with poor reuse records.

  • Another possibility is to write a translator for an OData object, which is most likely a ViewModel level class, which is then converted to DTO, which is then translated to Domains, which is then translated to ConceptualModels, otherwise ORM can handle. But this will require an excessive amount of resources.

In short, how do you make OData a good game with the principles of encapsulating SOA, OO, DDD and just a good old SOC?

+4
source share
1 answer

There should be a clear separation between the OData standard and the OData implementation.

Regarding the standard:

The standard itself allows you to have an accessible OOTB data endpoint with complete metadata in a portable way. With relationship and forecasting support, consumers can create viewing models on the server or later on the client. It is important to note that OData supports operations (functions) that must be open, so at the top of the automatic crud you can have remote methods that integrate easily into the relational template (functions can have results that you can request more, the server, as well functions can act as a smart author code).

To wrap this up: OData gives the form to what actually happens in most cases when someone needs massive access to REST data: formalizes ordinary, always-repeating scripts, such as requesting data or sending data back. This may be affected by what you write in step 4, but in my opinion this is not an OData-related issue. It's just how AJAX and Mashups work: you will have a client with a lot of code related to data federation.

You can answer your other questions by choosing the most appropriate server implementation. There are already several implementations:

  • EF4 / EF5 + WCF data services are the most "automatic". In this case, you may just be right about some of your problems, but: with the EF thin extensibility model, you can interact with automatic operations as you see fit. Having an application that is driven by a real EDMX model is a true DDD scenario.

  • The ASP.NET Web API allows you to make full use of code based on what you perceive as a static relational endpoint, so here you can think in three layers: DB, the middle level for navigating between database data and what works best for customers, and customer level as a smart consumer for this model.

  • JayData provides them in JavaScript on the server side with added JavaScript dynamics.

  • SAP NetWeaver Gateway provides sophisticated SAP data for easy use for simple scenarios.

OO: With V3 OData, we now have “instance methods” (which are also server methods), so what SOA actually picks up with a strict separation of data and functionality, OData really returns: definition of functionality + encapsulated data, but displayed in the SOA concept of static methods with context data that act like "this" .

2 Experience: IMHO 2Tier architectures became “ancient” not because the client had too much knowledge about the structure of the server part, but because they did not scale well and the new thin wedges were dumb to act like a real database client. In fact, 2tier has always been easier to work with (from the developer's point of view), and now that the OData server implementations are really mid-level with logic, you can actually get the best of both worlds: - the code again uses a virtuoso two-tier architecture - and scaling as a normal n level application can.

+3
source

Source: https://habr.com/ru/post/1441976/


All Articles