Generic List of Generic Interfaces not allowed, any alternative approaches?

public interface IPrimitive { } public interface IPrimitive<T> : IPrimitive { T Value { get; } } public class Star : IPrimitive<T> //must declare T here { } Then you should be able to have List<IPrimitive> primitives = new List<IPrimitive>; primitives.Add(new Star()); // Assuming Star implements IPrimitive primitives.Add(new Sun()); // Assuming Sun implements IPrimitive

Interface + Extension (mixin) vs Base Class

Downside of extension methods: clients pre-C#3/VB9 won’t be able to use it as easily. That’s about it as far as I’m concerned – I think the interface-based approach is significantly nicer. You can then mock out your dependencies nicely, and everything is basically less tightly coupled. I’m not a huge fan of class inheritance unless … Read more

TypeScript Interface Function Property: What’s the difference?

1.) There is a difference between method and function property declaration: interface InterfaceA { doSomething(data: object): boolean; // method declaration } interface InterfaceB { doSomething: (data: object) => boolean; // function as property declaration } 2.) TypeScript 2.6 introduces a compiler flag for stronger-typed, sound function types: Under –strictFunctionTypes function type parameter positions are checked … Read more

Is an interface a class?

An interface isn’t a class, but you could say that both interfaces and classes are types. From the Java specification: In the Java programming language, every variable and every expression has a type that can be determined at compile-time. The type may be a primitive type or a reference type. Reference types include class types … Read more

Why shared libraries between microservices are bad? [closed]

The evils of too much coupling between services are far worse than the problems caused by code duplication The author is very unspecific when he uses the generic word “coupling”. I would agree with certain types of coupling being a strict no-no (like sharing databases or using internal interfaces). However the use of common libraries … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)