boilerplate

Is there a better way to write this repetitive event-declaration code in C# when implementing an interface explicitly?

I have a lot of code like the following, where I explicitly implement some events required by an interface. public class IMicrowaveNotifier { event EventHandler<EventArgs> DoorClosed; event EventHandler<EventArgs> LightbulbOn; // ... } public class Microwave : IMicrowaveNotifier { private EventHandler<EventArgs> _doorClosed; ...

Is Project Lombok suitable for large java projects?

Is anybody out there using Project Lombok for a large scale production system? How does it influence your compile process (i.e. does it do two-pass compilation, slow it down, make it more fragile)? ...

Best way to help eliminate boilerplate when converting between data models

I'm working on a project where there are two sets of XML schema-generated objects which are two entirely different sets of classes with a similar structure. Conversion between the the two sets consists of a huge amount of boilerplate redundant coding (such as converting elements withing several nested layers of collections). I'm interes...

Is there any way to reduce the amount of boilerplate code for IDisposable?

My project has many reader and writer classes. I started implementing IDisposable, but I believe that it adds many boilerplate code to my classes. For each of the classes, I need to implement: A destructor. A Dispose() method. A Dispose(bool disposing) method. A "bool disposed" field. A check to see if the object is already disposed on...

State monads: trading one pattern for another?

So I'm writing a game in Haskell, and I'm expressing a player's turn as a series of state-altering functions that correlate to various turn phases. Originally, this looks something like: let game' = phase1 game game'' = phase2 game' -- etc. Prime candidate for State monadosity, right? This leads to the more elegant: do phase1 ...

Using metamorphic code to reduce boilerplate

Has anyone seen metamorphic code -- that is, code that generates and runs instructions (including IL and Java Bytecode, as well as native code) -- used to reduce boilerplate code? Regardless of the application or language, typically one has some database code to get rows from the database and return a list of objects. Of course, there ...

Scrap Your Boilerplate in f#

I've used the Scrap Your Boilerplate and Uniplate libraries in the Haskell programming language, and I would find that form of generic programming over discriminated unions to be really useful. Is there an equivalent library in the f# programming language? ...

How can I configure AutoMapper to convert all collections of reference types to collections of integers?

Let's say I have the following entity: public class Store { public List<Product> Products { get; set; } public List<Employee> Employees { get; set; } public List<Camera> Cameras { get; set; } } In other words, a Store that has Products, Employees, and security Cameras. I want to convert this Store to a StoreDTO: public cl...

what html5 boiler plate stands for ?

Like its style.css has body {background:transparent} So am i suppose to keep background transparent always to make good html5 website ? Are these default ? Should i override them as per my website ? ...

Question about cl_mem in OpenCL

I have been using cl_mem in some of my OpenCL boilerplate code, but I have been using it through context and not a sharp understanding of what exactly it is. I have been using it as a type for the memory I push on and off the board, which has so far been floats. I tried looking at the OpenCL docs, but cl_mem doesn't show up (does it?). I...

What is boilerplate code?

A coworker had never heard of this, and I couldn't provide a real definition. For me, it's always been an instance of 'I-know-it-when-I-see-it'. Bonus question, who originated the term? ...

Is an Extension Method the only way to add a function to an Enum?

I have a Direction Enum: Public Enum Direction Left Right Top Bottom End Enum And Sometimes I need to get the inverse, so it seems nice to write: SomeDirection.Inverse() But I can't put a method on an enum! However, I can add an Extension Method (VS2008+) to it. In VB, Extension Methods must be inside Modules. I r...