architecture

Clean Architecture, UseCases and Entities

你离开我真会死。 提交于 2019-12-23 01:36:08
问题 Okay, so I just started a new Android project and wanted to try implementing the Clean Architecture by Uncle Bob. I have a nice beginning using RxJava and stuff from GitHub samples & boilerplates and Fernando Cerjas' blog (like this article), but still have some questions on how to implement some UseCases. TL;DR Should an Entity have fields that are another Entity (in my example, User having a List<Messages> field)? Or should the Presenter combine UseCases to build a ViewModel mapped on

Build enterprise application without service layer

瘦欲@ 提交于 2019-12-22 14:57:12
问题 There are so many tutorials that teach us to use for example some ORM directly with database, but in real life i cant remember a big project that was working directly with database and not with services, so the amount of that tutorials seems strange to me. Directly connected applications have real benefits in speed of data transitions between database and the app, and they do not have restrictions in functionality that appear because of service layers(for example lets take Entity framework

configuration settings and IoC

假装没事ソ 提交于 2019-12-22 14:49:06
问题 I use IoC (DI) approach and usually have parameters, which are being read from configuration settings (i.e. connection strings, static values etc) by the lowest layer (DB layer etc). What is the best way to do it? Read directly in this the lowest layer, i.e.: string sendGridApiKey = ConfigurationManager.AppSettings["SendGridApiKey"]; It works, but need to add also this key to config file of unit test project. Also, assembly depends on configuration file Read it in the highest layer (i.e. web

configuration settings and IoC

蹲街弑〆低调 提交于 2019-12-22 14:49:01
问题 I use IoC (DI) approach and usually have parameters, which are being read from configuration settings (i.e. connection strings, static values etc) by the lowest layer (DB layer etc). What is the best way to do it? Read directly in this the lowest layer, i.e.: string sendGridApiKey = ConfigurationManager.AppSettings["SendGridApiKey"]; It works, but need to add also this key to config file of unit test project. Also, assembly depends on configuration file Read it in the highest layer (i.e. web

Circular dependency with the relationships “contains” and “is in”

本小妞迷上赌 提交于 2019-12-22 13:52:46
问题 I would like to gather opinion from you about the following problem. We have a class called "Room". Each room may contain zero or more instances of a class "Person", so the Room stores a collection of Persons (e.g. vector). It owns them. However, there is some time-consuming logic related to moving Persons between Rooms, so the Person also contains current Room they are in. It is just a pointer without ownership . This information is theoretically redundant, because one could derive it from

How can SQLServer notify a vb.net application of an event?

孤街浪徒 提交于 2019-12-22 12:26:43
问题 Is there a relatively simple way that my VB.NET application can be notified of the fact that a new value has been written to a table in SQL Server Express 2008? Polling is not an option since I'd need to do that every 10 seconds nonstop. 回答1: Take a look at having your application subscribe to Query Notifications. Also Using Query Notifications in .NET 2.0 to handle ad-hoc data refreshes 来源: https://stackoverflow.com/questions/6617278/how-can-sqlserver-notify-a-vb-net-application-of-an-event

solr multicore vs sharding vs 1 big collection

你。 提交于 2019-12-22 10:55:10
问题 I currently have a single collection with 40 million documents and index size of 25 GB. The collections gets updated every n minutes and as a result the number of deleted documents is constantly growing. The data in the collection is an amalgamation of more than 1000+ customer records. The number of documents per each customer is around 100,000 records on average. Now that being said, I 'm trying to get an handle on the growing deleted document size. Because of the growing index size both the

How to implement List, Set, and Map in null free design?

泪湿孤枕 提交于 2019-12-22 10:53:21
问题 Its great when you can return a null/empty object in most cases to avoid nulls, but what about Collection like objects? In Java, Map returns null if key in get(key) is not found in the map. The best way I can think of to avoid null s in this situation is to return an Entry<T> object, which is either the EmptyEntry<T> , or contains the value T . Sure we avoid the null , but now you can have a class cast exception if you don't check if its an EmptyEntry<T> . Is there a better way to avoid null

Populate the domain model from data layer, or query database direct?

别来无恙 提交于 2019-12-22 10:12:10
问题 Say I have a domain model where 3 objects interact, Reservation , Vehicle and Fleet . The Fleet has many Vehicles, and each Vehicle can have many Reservations. e.g. Fleet -1--*- Vehicle -1--*- Reservation If I want Fleet to have a method getMostPopularVehicle() , I could have it iterate each Vehicle and count the number of Reservations. If I then want to introduce an ORM for persistence, should I (1) have getMostPopularVehicle() call a data layer method to populate the Fleet, Vehicles and

BL Services: Exception or Method Result?

北城以北 提交于 2019-12-22 09:47:53
问题 What is the best way and why? V1: try { var service = IoC.Resolve<IMyBLService>(); service.Do(); } catch(BLException ex) { //Handle Exception } V2: var service = IoC.Resolve<IMyBLService>(); var result = service.Do(); if (!result.Success) { //Handle exception } 回答1: Exceptions are better in my opinion. I think that DDD code is first and foremost good object oriented code. And the debate about using exceptions vs return codes in OO languages is mostly over. In DDD context I see following