Sunday, July 24, 2011

Advantage of the object oriented programming

I think the advantages of the object oriented programming are following.


  1. We can easily modularize programs with the class. 
  2. We can easily commonalize the code by the inheritance.
  3. We can easily commonalize with the inversion of control by the polymorphism.
  4. We can easily read the code for the order of words with S + V + O.
  5. The type system built by the class is usable.
These are achieved effectively by thinking that the all are the objects.

Monday, July 18, 2011

Memo of my tool for aiding design of web applications (2)

It is important that we consider the constraints of the resource items.
Those must be the definition of validation for user input and other request parameters.
I want my tool aiding the viewpoint.

Sunday, July 10, 2011

Memo of my tool for aiding design of web applications

I am making the tool for aiding design  of web applications.
I think it is good that Web applications have REST architecture.
So I want my tool make easy to design in REST architecture.

Sunday, July 3, 2011

I tried re-mix.

I tried re-mix. It's interesting!
I show the example using re-mix.
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Remotion.Mixins;

namespace ReMixSample
{
  [TestClass]
  public class ReMixSampleTest1
  {
    [TestMethod]
    public void TestMethod1()
    {
      ReMixSample s = ObjectFactory.Create<ReMixSample>();
      Assert.AreEqual("A", s.A());
      Assert.AreEqual(3, s.B());
    }
  }
  public class MixinSample1<T> : Mixin<T>
    where T : class
  {
    [OverrideTarget]
    public string A()
    {
      return "A";
    }
  }
  public class MixinSample2<T> : Mixin<T>
    where T : class
  {
    [OverrideTarget]
    public int B()
    {
      return 3;
    }
  }
  [Uses(typeof(MixinSample1<ReMixSample>))]
  [Uses(typeof(MixinSample2<ReMixSample>))]
  public class ReMixSample
  {
    public virtual string A() { return default(string); }
    public virtual int B() { return default(int); }
  }
}

But sadly(perhaps for the limitation of the .NET framework), the methods A and B of ReMixSample class cannot be abstract methods.
Therefore the methods need the body and it will not be significant.
So I think it's easy to understand that the methods are mixed-in if we write the body is the following unified form:
virtual {Return type} {Method name}(...) { return default({Return type}); }

Sunday, June 26, 2011

Excel-DNA

I have known the Excel-DNA recently.
That's good!

I want to know the manner of connection of Excel-DNA and WPF , Rx, etc.

This technology makes me to write "NO" VBA and it's my wish from some years ago (when C# 1.0 appeared!)... :-).

Sunday, June 19, 2011

Design Supporting Tool

I have started making a aiding to design a web and RDB-base business application.
It is a WPF application and the screen capture is below:
The background color is for test :-)

Sunday, June 12, 2011

Example of translation for Object Oriented style and Functional style.

In C#,
public class X
{
  public string S1 { get; set; }
  public string S2 { get; set; }

  public virtual string A()
  {
    return S2;
  }
}

public class Y : X
{
  public string S3 {get; set; }

  public override string A()
  {
    return S3;
  }
}

In F#,
type X = string * string
type Y = X * string
type Z =
  | X of X
  | Y of Y

let A(z : Z) =
  match z with
    | X (s1, s2) -> s2
    | Y (x, s3) -> s3