Tag Info

New answers tagged

0

Using tokens is very common in APIs, these tokens are usually sent as a header and have a clear life cycle. Think for instance OAuth. Regardless of your programming language or framework, REST APIs are similar. I can think of several scenarios where you want to limit concurrency, two of them are: Multiple clients updating the same resources like a ...


1

In CQRS, queries are not allowed to have any side effects, and thus they cannot change any data. Commands on the other hand must not return any data, but change the state of the application. With these definitions and your problem domain the question becomes this: What does the search functionality do? If it's purely for finding an order, then it is not ...


0

This is going to depend on what language you're using, but you should have one configuration for debug and one for production. You can either focus on ensuring the wrong config is never deployed with your project, you can never run the project on the same server as the database is on (assuming you have disabled remote DB connections), or you can make sure ...


1

A number of options: Using firewall, block anything from accessing production database except a few servers that are allowed. This should be done always in production. Define production configuration on the production server and don't check it in source control. Source control should maintain only development configuration file with the development ...


3

What you encountered is called double dispatch and what you have implemented is some form of Visitor pattern. The problem you encountered is one of the limitations of Visitor pattern. You usually have to choose between inheritance and visitor. When you have one, it makes the other harder. C#'s type and method dispatch system is simply not powerful enough to ...


-1

I just realized, C# has dynamic types! interface I { int Precedence { get; } } class A : I { public int Precedence { get { return 0; } } public R Foo(A a) { return ...; } } class B : I { public int Precedence { get { return 1; } } public R Foo(A a) { return ...; } public R Foo(B b) { return ...; } } class C : I { public int ...


1

Actually this can be relatively simply resolved with the C# trick of using dynamic to do double dispatch. You simply need a method on base class I like: public R Foo(I i) { return (i as dynamic).Foo(this as dynamic); } The viewer can call this, because it knows it has an instance of I. The trick here is that when you cast to dynamic, you always pick ...


0

How should you implement it? You should adopt some convention, like the class made last, gets to implement the behavior and the other one simply forwards the call. Ideally, you can implement them as static methods so that a method and its mirror live next to one another in code. Yes, this means you have to modify the set when they're expanded. Annoying, ...


1

It sounds like your method Foo should not exist in your I subclasses. As you mentioned, with your suggested approach adding a new I subclass violates the Open/Closed principle. Instead, try moving Foo to a new class responsible for the symmetrical operation abstract class SymmetricalFoo<T,U> where T : I where U : I { public R Foo(T t, u ...


0

In the bigger view, this sounds like an Anemic domain model (Martin Fowler - https://en.wikipedia.org/wiki/Anemic_domain_model) These Data Access Objects are a direct mapping to the database and do not reflect your business logic. The way to go would probably be a CQRS (https://en.wikipedia.org/wiki/Command–query_separation) model, but it would probably ...


0

You would probably want some layer(Facade pattern may be) that would expose only the necessary fields. Sounds like right now you are exposing your ORM models to all the layers and creating a spaghetti/unsecure code :) Start by defining clear responsibilities of each layer and only exposing the model data that is necessary for the layers above. If it ...


2

I would suggest the following structure due to my experiences in some other applications. First of all I would build a language table: language_id (PK) iso_country_code iso_language_code codepage translation_id (FK) The language_id would represent the primary key. Each available language is added to this table. iso_country_code can contain the ISO ...


2

The best (and probably the most fail-safe) approach would be to authenticate users against a database. If you are not doing that, how would you know if John Doe is from Company A or Company B? There are some techniques in .NET which can tell about the demographic area a user/computer is located. But this would not work if majority of the users are in the ...


2

From a pure architecture standpoint, IQueryable is a leaky abstraction. As a generality, it provides the user with too much power. That being said, there are places where it makes sense. If you are using OData, IQueryable makes it extremely easy to provide an endpoint that is easily filterable, sortable, groupable... etc. I actually prefer to create DTO's ...


1

I write this from the perspective of a long-time .NET developer being pulled inexorably into the client-side JavaScript world, so I assume that I probably share some of the same biases as you. I only bring this up because I think a lot of your bullet points are probably biased by your experience and relative comfort with C# and .NET over JavaScript. For ...


0

I think many of your main points are quite misguided; claiming that "yes browsers can do it but Visual Studio is better" is not going to convince your coworkers (who probably are more used to debugging JS than to working with VS). Also: number 3 is not an actual issue; you can write JS that does not rely in the browser version and that means no more ...


4

Well, for a start, the IOCFactory, or rather the way you described it being used, is a bold-faced lie, because it involves no inversion of control. If you continue calling getInstance() yourself, you should a least rename the alleged IOCFactory. As Ben Aaronson pointed out, a container without inversion of control is just a Service Locator. A lot has been ...


1

but I couln't convince him to use it because he thinks that the IocFactory "works as well so why not use it"... Because it's more complicated? Rather by definition, code that is doing more things has more things that can go wrong. For IoC containers, that often means lots of things going on under the covers to discover the various dependencies, resolve ...


2

The usual way to do this is to update an application that is packaged into a Windows installer msi using group policy. Its quite easy to do as long as you're a doman admin in an AD domain.


2

You are quite close to answering your own question. :) In the Observable/Observer pattern (note the flip), there are three things to bear in mind: Generally, the notification of the change, i.e. 'payload', is in the observable. The observable exists. The observers must be known to the existing observable (or else they have nothing to observe on). By ...


1

Do you still use VCR that you bought back in 1995.? 4 + 1 was applicable back then when software was in it's infancy. But even then, nobody ever used more than 2 or 3 "views". In the last 20 years software engineering changed. Nowadays, scope/context and conceptual and logical and physical and ... are all differentiated. A lot of COTS solutions have to be ...


1

Sure, this sort of Software as a Service stuff has existed for quite some time now. Are there any pitfalls to this setup? Yeah, non-functional internet makes it hard for web services to work without some sort of local caching layer. The latency you talk about can be a concern. It can be harder to test your application depending on how it is designed. ...


1

The pitfalls range from Nothing to Everything, with your real-world results lying somewhere in between. Standard libraries are used everywhere. For example, we have the C++ standard library that almost all C++ programs are based off of to some degree. Even this standard library changes depending on your compiler, in that the standard library that ships with ...


1

I would use a central, unified authentication system and have separate permissions/stats for each microservice (sort of like how I can't yet upvote on this stack exchange site but I can in stack overflow while using the central stack exchange authentication system). One of my current projects will involve this approach in the near future, which will be nice; ...


0

Is it normal design to save all this information outside of the code. I think it is perfectly normal. You can use Observable pattern for handling events dispatching and store its configuration (actual subscriptions) inside, say, database. I do not respect storing information in plain files. It is difficult to atomically change them and they are not ...


1

I guess, if there is an XSD schema, you should be able to validate everything against it. Well, it is the purpose of itS existence ;) So, I guess they just need to release a new version of their schema for you to update your software. As for adding a new field into a reply... Well, if there was no schema, I would think that should not be considered a BC ...



Top 50 recent answers are included