Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Reuse other program's logic

runtime

  • Please log in to reply
4 replies to this topic

#1 pavelmh

pavelmh

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 10 August 2008 - 12:21 AM

Heya all,

I have a program written in C# .NET 2.0 with UI and a lot of business logic, the "old" program.

I am also building a "new" version of the above program and wish to be able to have control over an instance of the "old" during runtime using COM+ or anything else proposed.

Meaning that on init of the "new" program i will bind to certain events of the "old" and receive them in the "new" runtime.

Meaning that I also will be able to invoke methods during runtime in the "old".

All that with minimal code change to the "old" assembly.

Can anyone suggest an architectural design which will allow me to do it like described above?

Be it of whatever trickery and complexity.

Thanks.
  • 0

#2 gaylo565

gaylo565

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 258 posts

Posted 10 August 2008 - 04:42 PM

All you need to do is add the classes that you need from your old program to your new one and then call the class instance of the older method from your new program:) This is one of the great parts about using OOP.
  • 0

#3 whoiga

whoiga

    CC Newcomer

  • Just Joined
  • PipPip
  • 15 posts

Posted 10 August 2008 - 09:44 PM

Reusable code is awesome, and a lot of times abstraction expands the re-usability in my opinion. Good luck pavelmh. Be sure to let us know how it goes.
  • 0

#4 pavelmh

pavelmh

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 11 August 2008 - 08:59 AM

Great replies, Thank you !

Actually I was wondering how could I leave the previous assembly intact, execute the program and leave it running, but also have control over the inner workings from another new interface side by side.Only minimal modification of the old code is allowed.

For example:

I thought that I just fireup 2 Shells, the "old" and the "new" and pass an instance of the "old" to the "new". Then in the logic of the "new" I will access stuff from the old and attach to events of the "old" ... something like that...

Or maybe something like in Java called JMX...

Ideas?
  • 0

#5 gaylo565

gaylo565

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 258 posts

Posted 11 August 2008 - 09:12 AM

That I haven't done but if you come up with a good way to do this please do share:)
  • 0





Also tagged with one or more of these keywords: runtime

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download