Thursday, August 6, 2009

CS programming with C++, C#

C++ 이랑 C# 이랑 client - server 프로그래밍을 할 때,
When we are programming a client-server application by C++ and C#,

예를 들면 서버는 C++, 클라는 C#. 또는 그 반대로.
For example, servers written by C++, clients written by C#. or vice versa.

신경써야 할 부분이 공통 자료형과 열거형이다.
One thing we should keep in mind, common data structure and enumeration.

공통 자료형과 열거형을 따로 분리해서 하나로 만들지 않으면
If we didn't create a separated method for common data structure and enumeration,

양 쪽에 모두 존재하게 되는데, 이런 경우에는 잠재적 위험성이 내포되어 있다.
Two projects (client and server) need to have it individually, then there is a potential dangerous thing.

특히 시간이 지날 수록, 작업자가 많아서 머지가 많아질 수록.
In particular, as time goes by, getting more programmers, getting more counts for merge,

어느 순간 패킷 번호가 달라져 있다던지. 구조체 멤버변수의 순서가 바껴있다던지.
It can silently happen to change a packet number, or mixed order of member variables in a structure.

디버깅하기 아주 괴로운 상황에 처할 수 있다.
This makes a debugging hell.

예전에 흥배님께서 python 으로 C++ 코드를 파싱해서 C# 쪽 패킷 번호와 구조체를 생성하는 툴을 사용하셨다는데
A few months ago, Mr. 흥배 used a tool which parses C++ codes, then creates common data for C# by python.

좋은 방법이긴 하지만, 뭔가 확실하게 integrated 된 방법은 없을까 하는 생각도 든다.
It's a good way. But, I think there are some full integrated ways. maybe.

좋은 idea 있으신 분은 넌지시 알려주시면 정말 감사하겠습니다.
It would be really appreciated if you let me know any ideas.

4 comments:

  1. 때이 잘 지내냐.

    메타 관리를 위한 프로토콜 정의(xml, asn.1 신텍스 스타일 등) 를 해두고, 여러 언어로 컴파일해서 쓰는 방식도 있더라.

    그리고 google protocol buffer 같은건 어때?

    ReplyDelete
  2. //홍기옹. 오오. 캄사합니다. xml 을 사실 좀 번거로운 부분이 많아서 꺼리고 있었는데, 다른 애들도 함 살펴봐야겠어요. google protocal buffer 도 알아봐야겠군요!

    ReplyDelete
  3. 1. 똑똑한 프로그래머를 뽑느다. ㅋㅋㅋ

    프로그래머가 신경만 써주면 문제 안생김.

    ReplyDelete
  4. 아니면 boost::wave로 preprocessing 하는 방법도 있겠네요. 하지만 최선은 제가 볼 때는 DSL를 하나 만들어서 그걸로 C++, C#, Python 소스를 뽑아주는거 같습니다.

    ReplyDelete