composition

Java GC: top object classes promoted (by size)?

本小妞迷上赌 提交于 2020-01-12 05:35:08
问题 Please let me know what is the best way to determine composition of young generation memory promoted to old generation, after each young GC event? Ideally I would like to know class names which are responsible say, for 80% of heap in each "young gen -> old gen" promotion chunk; Example: I have 600M young gen, each tenure promotes 6M; I want to know which objects compose this 6M. Thank you. 回答1: There is no easy way to do this, however, I have recently been analyzing memory performance of

Specifying multiple interfaces for a parameter

≡放荡痞女 提交于 2020-01-12 02:58:07
问题 I have an object that implements two interfaces... The interfaces are: public interface IObject { string Name { get; } string Class { get; } IEnumerable<IObjectProperty> Properties { get; } } public interface ITreeNode<T> { T Parent { get; } IEnumerable<T> Children { get; } } such that public class ObjectNode : IObject, ITreeNode<IObject> { public string Class { get; private set; } public string Name { get; private set; } public IEnumerable<IObjectProperty> Properties { get; set; } public

Should I extend an ArrayList (is-a) or should I include it as a member (has-a)?

痴心易碎 提交于 2020-01-11 05:13:41
问题 I'm making a simple program that maintains a list of numbers, and I want this list to also have a name. Which is the best approach: have my list class extend ArrayList or have it include an ArrayList member? In both cases, there would of course be a "name" String member. The first approach means I only have to implement a getter & setter for the name, but I think this would tie my class too closely to a particular implementation? For example, if I wanted to later use a Vector, than I would

Liskov Substition and Composition

落花浮王杯 提交于 2020-01-09 18:40:35
问题 Let say I have a class like this: public sealed class Foo { public void Bar { // Do Bar Stuff } } And I want to extend it to add something beyond what an extension method could do....My only option is composition: public class SuperFoo { private Foo _internalFoo; public SuperFoo() { _internalFoo = new Foo(); } public void Bar() { _internalFoo.Bar(); } public void Baz() { // Do Baz Stuff } } While this works, it is a lot of work...however I still run into a problem: public void AcceptsAFoo(Foo

Liskov Substition and Composition

ぐ巨炮叔叔 提交于 2020-01-09 18:38:40
问题 Let say I have a class like this: public sealed class Foo { public void Bar { // Do Bar Stuff } } And I want to extend it to add something beyond what an extension method could do....My only option is composition: public class SuperFoo { private Foo _internalFoo; public SuperFoo() { _internalFoo = new Foo(); } public void Bar() { _internalFoo.Bar(); } public void Baz() { // Do Baz Stuff } } While this works, it is a lot of work...however I still run into a problem: public void AcceptsAFoo(Foo

Liskov Substition and Composition

妖精的绣舞 提交于 2020-01-09 18:38:13
问题 Let say I have a class like this: public sealed class Foo { public void Bar { // Do Bar Stuff } } And I want to extend it to add something beyond what an extension method could do....My only option is composition: public class SuperFoo { private Foo _internalFoo; public SuperFoo() { _internalFoo = new Foo(); } public void Bar() { _internalFoo.Bar(); } public void Baz() { // Do Baz Stuff } } While this works, it is a lot of work...however I still run into a problem: public void AcceptsAFoo(Foo

Liskov Substition and Composition

若如初见. 提交于 2020-01-09 18:38:02
问题 Let say I have a class like this: public sealed class Foo { public void Bar { // Do Bar Stuff } } And I want to extend it to add something beyond what an extension method could do....My only option is composition: public class SuperFoo { private Foo _internalFoo; public SuperFoo() { _internalFoo = new Foo(); } public void Bar() { _internalFoo.Bar(); } public void Baz() { // Do Baz Stuff } } While this works, it is a lot of work...however I still run into a problem: public void AcceptsAFoo(Foo

PyYAML - how to deal with composition

走远了吗. 提交于 2020-01-07 03:37:09
问题 I've been trying to use YAML as I love the readability of it. However, I'm a bit stumped at the best way to put in components/deal with composition. Let's say I have this as a class I'm trying to replicate: basicai = aggressiveAI() fightercomponent = fighter(strength=10, dexterity=5, death=dramaticdeath()) orc = Object(name='orc', hp=100, fighter=fightercomponent, ai=basicai) How would be the best way to do something like this in YAML? Mostly, I'd like to be able to not end up with a long

Writing multiple functions in SML - Sequential Composition

依然范特西╮ 提交于 2020-01-06 08:23:55
问题 I would like to understand how sequential composition works much better than I do now in SML. I have to write a program that takes a list of integers and moves the integer at index zero to the last index in the list. ie. [4, 5, 6] -> [5, 6, 4]. The code I have right now is: - fun cycle3 x = = if length(x) = 1 then x = else (List.drop(x, 1); = x @ [hd(x)]); val cycle3 = fn : 'a list -> 'a list The question lies in my else statement, what I want to happen is first concatenate the first term to

Questions on MEF strategy and structure

那年仲夏 提交于 2020-01-03 17:31:06
问题 I am tasked with modularizing a C# app that is a rewrite of a very large Delphi app (the DB has 249 tables!). Business constraints proscribe a complete redesign for .NET and better overall architecture, so we are basically just incrementally rewriting module for module of the Delphi app in C#. Until finished, the suite will comprise a mixture of pending rewrites, and C# app modules I want to integrate using MEF. The app concerns itself with Time-and-Attendance and Access-Control, and has