tags:

views:

752

answers:

12

I have learned programming on .NET. It's been 4 years since I have started (serious) programming, I gained experience in VBA, JavaScript but mainly C#. I have spent a lot of time trying to grasp the good coding practices, object orientation etc.

Now finally I have a job. The job is fixing/upgrading an ERP on a daily basis. Creating reports and maybe sometimes new stuff. I have absolutely no experience in Delphi, and no motivation to learn it especially when people are moving to .NEt from Delphi not in the reverse direction sa my manager expects :)

The question is that are there any tools that I write C# code and compile into this object pascal or whatever it is. Thanks in advance.

A: 

I'm sure you have to learn Delphi to do successfully that job. For example simple bugfixes will have to be done in the Delphi. Also user interface should be consistent over the product. So it should be created in Delphi. Even for new features.

Sure also there are possibilities to call external code from a Delphi code. Options might be DLLs or as WebService.

And that external code could be done in .Net.

Tomas Tintera
Yes they are so right, that's why they are re-compiling the whole erp when they add a new label. It looks so right compiling millions of line of code in every change. Then they talk about OOP. It is really fun to be a programmer :)
emray
@emray: Delphi doesn't compile everything when you add a new label. It does incremental compilation and linking, unless *you* tell it to do a full build. Trying to blame the language or IDE because you don't know enough to tell the difference between "Compile" and "Build" doesn't make the language or IDE bad.
Ken White
yeah but it does help me learn real quickly.. look at all those answers :)
emray
A: 

Yes I believe delphi is a sunk language considering even it's inventor Anders Hejlsberg is the chief architect for C#. Having said that if you have to support legacy technology, you should look to see if Delphi Prism (Delphi for .NET and Mono) can help your project.

http://www.embarcadero.com/products/delphi-prism

mythz
+3  A: 

That people is migrating to .NET does not mean that .NET is the best for all projects. You should look at the needs of each particular system. I'm sure that some will be better .NET and Delphi will be more optimal for others.

Read this article please.

Ragards.

Neftalí
+5  A: 

You can convert C# code to Oxygen (=Delphi Prism = almost Delphi): http://code.remobjects.com/p/csharptoxy/downloads/

André
+25  A: 

If you can program, you can program in Delphi. It shares most common modern programming paradigms with languages like C#. If you can't quickly make the transition from C# to Delphi you need to invest some time learning general programming concepts.

If you're going to attempt to maintain a large system written in one language (any language, doesn't have to be Delphi) while refusing to understand the language the application is written in you are unlikely to be successful. Similarly, if you make a habit of posting about the crappy architecture of a system you've just been hired to support, and the technical incompetence of your manager, you're unlikely to hold onto any job for a long time. That's true even if the architecture is genuinely crappy and your manager is a genuine idiot.

Frankly, I can't understand how you got hired to maintain a large Delphi system without knowledge of Delphi, or why you chose to take the job when there must be many more jobs available the require C#

Larry Lustig
It must be the local management practices.
emray
All programmers have committed the sins of arrogance and hubris at one time or another. He'll learn one way or another.
ddimitrov
@ddimitrov: Hubris and arrogance are sins? I'd say his cardinal sin here is false laziness, with false impatience close behind.
David Thornley
+12  A: 

"I have absolutely no experience in Delphi, and no motivation to learn it [...] The question is that are there any tools that I write C# code and compile into this object pascal or whatever it is."

LOL.

A good programmer /should/ be able to quickly adapt to different languages and tools when required.

Go overcome your prejudices and start learning Delphi.

Moritz Beutel
I agree. There's an awful lot of languages out there that I've tried and found that I don't like, but I can still operate in them just fine when I have to. I won't try and meld my favorite language to it either, that just causes confusion for the rest of the team.
Brian Knoblauch
+8  A: 

Imho, such tools would make more harm than good. And this is because:

  1. Fist of all because in some areas Delphi is more expressive language than C#. For example see here for a very quick glance. Note that on the above StackOverflow question, Delphi is by far the most upvoted answer. And the question sounds "What is your favorite language..."
  2. Delphi is a language for high-performance applications. It produces much more performant executables compared with .NET. (for ex. see here and here for a very small (imho) collection). Having such a conversion tool will simply cut down all Delphi's power. Also, don't forget that Delphi has explicit memory management.
  3. Of course, there is all the maintenance problems: bug-fixing, GUI consistency etc.

Also, about everyone (and everything) is going from Delphi to .NET I humbly think that you're a little bit off here. Of course (as you say) you don't have experience with Delphi (not a bad thing per se), but believe me, here on StackOverflow and also on Delphi's forums (at Embarcadero's site and elsewhere) there are a plethora of new users of Delphi. It is easy to spot them from their questions.

Also, in order to be constructive, I recommend you, in order to get started, have a look at Delphi's Wiki which is a good portal which gather more or less enough interesting links for the newcomers. There's also Delphi Basics which is a very good resource to start with.

But first of all there are Delphi's newsgroups, which is an invaluable resource of information - feel free to post there and also here on StackOverflow. Beware, on Delphi's forums you'll have the best experience using an NTTP newsreader.

Also, if you want to have two-way communications between Delphi and managed code you can have a look here and here. Also you can work with .NET assemblies "directly" (eg. by using COM) - but believe me, do it only if it is really necessary, because your very small (I mean exe size) and fast application most probably will became slower and will depend of a big runtime - thing which is very bad if your app is sold as a shrinkwrap software. But, of course, there are scenarios in which .NET dependency won't hurt.

FTR, we have an ERP developed in Delphi which is in production from 9 (nine) years now and is continuously updated. However we don't think any moment to change our development tool, even if we could do that with ease. But of course, YMMV.

+1  A: 

I'm now working mainly with C# but for years I wrote Delphi applications. The Delphi IDE was way ahead of it's time for many years. I stopped working with it with D7. I didn't like D8 and now that they have prism. You may be able to port the Delphi code to Delphi.net. Then you could convert it to C#. Probably need to ask the manager first though! :)

Delphi is an easy to learn language. You should be great at it within a few months. Learn Delphi. Here's a few of the standard books for Delphi Mastering Delphi 2005

Delphi 2009

Steve
+6  A: 

I'm a former Delphi developer who now works primarily in .NET/C#.

It is straightforward to write maintainable, well-designed code in Delphi. It's a strongly-typed OO language. While some Delphi developers have a RAD mentality (code under buttons), you can do that in C#, too. Model-View-Controller and its variants are certainly possible. You can even be test-driven with DUnit.

If you are using a .NET version of Delphi, there's a Reflector add-in for the Delphi language. This would let you write C# code, compile it to IL, and disassemble it in Delphi. That's probably not practical for large-scale development, but might be a learning aid.

For older (Win32) versions of Delphi, you have fewer options. You'll need to learn Delphi or find another job. Really, the main thing you lose over .NET/Java is garbage collection. If you think of every object as implementing IDisposable, though, it's not hard. Alternately you could use reference-counted interfaces, but I wouldn't recommend that for every class. The main learning curve is going to be the VCL, which has many similarities to the .NET FCL.

Good developers generally know multiple languages. Treat it as a learning experience.

TrueWill
+3  A: 

You probably recognize the following pattern:

Developer1 creates AppX, works on it for years. Developer1 gets bored or decides he can make more money somewhere else. Of course without leaving documentation. Good for him.

Now we enter this loop:

  1. AppX needs to be maintained, so a new developer (DeveloperX) gets hired;
  2. DeveloperX doesn't understand the code or the workings of AppX;
  3. DeveloperX convinces his manager that it's better to rewrite (preferably using some "cool" technology);
  4. DeveloperX fails to "get things done";
  5. DeveloperX gets fired or quits;
  6. Go back to 1.

Emray is currently between step 2 and 3.

Anyway, I conclude that the application is in danger.

I've personally seen many Emray's come and go over the years. Wants to work with cool new technologies but doesn't have experience or the drive to actually learn stuff unless it looks cool on their CV.

There will be people like us who have to clean up the mess after him.

Wouter van Nifterick
A: 

You could try to learn by doing: just choose an Open Source projet written an Delphi and have fun :) In your case, an open source ERP would be perfect : OpenGestionale for instance is an italian ERP developed in Delphi (2007).

A: 

First, I will say upfront that unwillingness to learn an unfamiliar language is not a good enough reason to attempt what I'm about to describe.

The original poster's lack of enthusiasm for Delphi not withstanding, there are program transformation tools that can be useful for project migration, re-engineering or even on-the-fly language translation. (this is certainly not their only use)

http://www.program-transformation.org/ has a wealth of information of the subject. Semantic Designs is one of the more well known commercial developers of program transformation tools. They do have a selection of tools for translating C# into other languages.

Note

These kinds of tools are complex and have a high learning curve (a lot higher than learning Delphi to be sure) but are tremendously powerful. The commercial tools are also a bit expensive. A developer using these tools needs a thorough understanding of both the source and target languages you intend to use.

codeelegance