As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 13 years ago.
I need a programming language to make tiny applications. As a C++ programmer, I think C++ is not practical for this purpose, because it takes too much effort to create a new application from scratch and to deploy it. However, I'd like to use a language equally powerful, so I was wondering whether C# can be used as a scripting language?
Read this one
CS-Script - The C# Script Engine
CS-Script is a CLR (Common Language
Runtime) based scripting system which
uses ECMA-compliant C# as a
programming language. CS-Script
currently targets Microsoft
implementation of CLR (.NET
2.0/3.0/3.5) with limited support on Mono.
CS-Script is an open-source initiative
that is distributed under the license
agreement, which can be found here.
However commercial support is also
available.
CS-Script combines the power and
richness of C# and FCL with the
flexibility of a scripting system.
CS-Script can be useful for system and
network administrators, developers and
testers. For any one who needs an
automation for solving variety of
programming tasks.
and
Treating C# Like A Scripting Language
You could try Python, which is both a very understandable and powerful language.
It is possible to parse/execute Python from many languages.
For example: Use SWIG to use C++ code in Python or Boost to embed Python code in your C++ app.
I would say that the usual benefits of a scripting language are:
It normally has a command line interpreter
You don't necessarily have to compile it
It's easy to change the code - because the source file is the actual 'executable'
These are not features of C#, so a language that can do pretty much all that would be powershell, as it uses .net so it has access to all the features you might use in c#.
Edit: Just to resurrect this one from the dead...
Had a chat with a colleague, after thinking a bit about scripting languages that I have used like Ruby and Python.
One of the most important features for me in a scripting language is the ability to have code run directly in the script, without needing a main function. You don't do this in c#. However you do this in all the scripting languages that come to my mind:
eg, Ruby, Python, Javascript, Powershell
An other useful tool if you want to use C# for scripting is http://www.mono-project.com/CsharpRepl : a C# interactive prompt from the mono team.
I'd say that Mono in particular provides all of the tools to use C# as a very effective scripting language, and nearly anything you write in will run fine in .net if thats your main target environment.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I have to develop a testing application to test some of the features of the graphics driver.
By making use of the standards exposed by Microsoft, like DXVAHD.h,DXVA2Api.h (Directshow) and other Microsoft APis.
As coding in C# is very easy compared to C++, why cant we use C# instead.
Is it because, we can't use header files in C# (As there is a concept of packages)?
Can anyone kindly let me know why do one prefers C,C++ over C#, when it comes to system level programming. ? Any links or learning materials W.R.T. these would be greatly appreciated.
Thanks in advance.
When you write system software or drivers, you want tight control over your environment: memory usage, time constraints etc.
With C# it is not possible. Even if you ignore the fact that you run on top of a VM which introduces significant overhead, you still have no control over memory allocation/deallocation policy, you are never sure when GC thread will kick in and block your worker threads, etc.
Besides that, there are many low level operations that you just can't do in C#: starting with reading/writing the value of device registers or direct access to the memory and moving onto more specific tasks.
There's no real reason why you couldn't do it in C# other than some of the APIs being C++ APIs. Unlike what some people have said in the comments, you are not creating a driver, you are creating (quote) "a testing application to test some of the features of the graphics driver". (And why would anyone create a driver unless they're hardware manufacturers?)
Popular APIs like DirectShow have C# bindings. For those that don't, you can easily create your own by wrapping the APIs in C++/CLI assemblies that the C# code references.
C is called middle-level language because it is actually binding the gap between a machine level language and more conventional high-level languages. User can use c language to do System Programming (for writing operating system) as well as Application Programming (for generate menu driven customer billing system ). So that it is called middle level language.
High level - Java- Ada , Modula-2 , Pascal, COBOL, FORTRAN, BASIC
Middle level - Java(through C interface), C++, C, FORTH, Macro-assemble
Low level - Assembler
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have experience in C/C++ and C#, and I'm planning to create a large software with the help of my friends, which will also include a GUI. It will focus on computer security and analysis, something like penetration testing, risk management, etc. The point is that I want it to be multi-platform software. I want it especially to work in Windows, Linux and Mac OS X. The point is that I don't know which programming language and programming paradigms/tools to use for this purpose. I want to hear your suggestions, any suggestion is highly welcomed. I plan to do several large software developments in the next few years, therefore, I'm even highly willing to learn new programming languages or tools, which will be useful and ease my job.
C++ with Qt is multiplatform as well. It contains nice GUI libraries and Qt-containers such QString, QMap which make you work easier.
EDIT:
Using QtCreator you can design your GUI by 'Drag and drop'.
You could use Mono to develop c# projects cross platform.
http://www.mono-project.com/Main_Page
Mono is a software platform designed to allow developers to easily create cross platform applications. It is an open source implementation of Microsoft's .Net Framework based on the ECMA standards for C# and the Common Language Runtime. We feel that by embracing a successful, standardized software platform, we can lower the barriers to producing great applications for Linux.
I think Java is a good candidate for this. It works on all platforms where JVM is installed, it has many components you might use (GUI, security etc), and very easy syntax. Typically development in Java is much faster than in C++.
Hope this helps
You might be fine with a Web App.
If your audience is developers, then you might consider Java, or you might consider a language for a common backend (e.g. C++) with either dependence on a common UI library or dependence on platform specific UI libraries. Even if your audience is for developers, you can lose people's interest if it does not have a native-feeling UI. So you have a bit of a decision to make to determine how important that native look and feel is versus the amount platform specific code you write -- that really can't be answered by us.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Today the Common Language Run Time Supports Many Languages including Iron Python and Iron Ruby. We can similarly can use J Ruby and J Python in Java Run Time environments . If so why the .net frame work common language run time cannot support for Java? Um just curious to know though u may see this as a dumb question .
The CLR was actually designed so that it could do everything required to run Java. (Indeed, there are some warts in the way IL is defined which are there specifically for compatibility with Java.) You just need a way of converting bytecode to IL, or compiling from Java source code to IL. J# was one way of doing this, but the limitation of using Java 1.1.4 was a pretty huge one.
I suspect the reason for not going further wasn't an issue with running Java as a language, but the fact that system libraries would need porting. If you were willing to write Java-like source code but target .NET framework libraries (and only .NET framework libraries), with a version of the JLS which switched java.lang.String to System.String etc, it would be doable. I don't think there'd be much benefit though, when C# is simply a nicer language in almost all ways.
You may be interested in looking at IKVM.NET though - an implementation of Java running on the CLI.
First of all, Java may only be called Java if it compiles to JVM bytecode and runs on a certified JVM (iirc), those were the reasons behind Microsoft's efforts being named J++ and J#.
Then there is still J#, which is something close to Java, running on the CLR.
Then there is IKVM which is an implementation of a JVM and the class library on top of the CLR.
Actually, the class library might be the most annoying thing in this case. J# comes with an own library containing the Java core classes just for that purpose and the language closely ties in with that class library (just as it does in .NET).
The final thing though is probably: Why bother at all? Java itself would be a sub-par language on the CLR, where careful effort is needed to recreate things like its not-actual generics. Due to this interoperability with other CLR languages will likely be limited, too. There are powerful translators from Java to C# if you have a large Java codebase and want to use .NET, but a CLR-native Java, compatible with SuOracle's would be a lot of effort for something that you'd only want to touch for compatibility purposes and which poorly interfaces with the CLR or other .NET languages.
CLR does support J#. In an utopian world CLR should have supported C# and Java, but Java is a competitor to Microsoft's C# and hence it won't support Java.
The way I see it, C# is a superset of Java, so you should technically be able to compile a Java class to CIL.
As others have pointed out, Microsoft has no intention of supporting their competition, however I see there have been some projects, such as Ja.NET, to compile Java code to the CLR. There's also IKVM.NET, which among other things seems to be able to translate Java bytecode to CIL, and includes the Java class library from OpenJDK compiled to .NET.
The respective Virtual Machines act on Intermediate Code in a different language (CIL for .net), and IL for .net and JVM are incompatible with each other.
The IL and Runtime features sometimes disallow a few things, for example Generics in C# are closely tied to how Generics in the .net Runtime work, while Java has a completely different implementation.
Still, there shouldn't be much technically preventing Java from running on .net, just no one did it yet. It's a massive effort, for what? Is there really enough money to make? If there is a business, someone will do it. But if you're in the business of Java, then most likely you are also tied closely to it's tools and environments, e.g. Eclipse and Tomcat, possibly Ant and Maven.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm a teacher(instructor) of CS in the university. The course is based on Cormen and Knuth and students program algorithms in C++. But sometimes it is good to show how an algorithm works or just a result of task through GUI. Also in my opinion it's very imporant to be able to write full programs. They will have courses concerning GUI but a three years, later, in fact, before graduatuion. I think that they should be able to write simple GUI applications earlier. So I want to teach them it.
How do you think, what is more useful for them to learn: programming GUI with QT or writing GUI in C# and calling unmanaged C++ library?
Update.
For developing C++ applications students use MS Visual studio, so C# is already installed. But QT AFAIK also can be integrated into VS.
I have following pros of C# (some were suggested there in answers):
The need to make an additional layer.
It's more work, but it forces you
explicitly specify contract between
GUI and processing data. The border between GUI and algorithms becomes very clear.
It's more popular among employers. At least, in Russia where we live. It's rather common to write performance-critical algorithms in C++ and PInvoke them from well-looking C# application/ASP.Net website. Maybe it is not so widespread in the rest of the world but in Russia Windows is very popular, especially in companies and corporations due to some reasons, so most of b2b applications are Windows applications.
Rapid development. It's much quicker
to code in .Net then in C++ due to
many reasons.
And the con is that it's a new language with own specific for students. And the mess with invoking calls to library.
It is better to familiarize students with Qt, as Qt is actually C++. C# is a completely different beast, and if you use C#, you will very likely get your students confused about what things are Microsoft- or C#-specific vs. what is actually defined in the ISO C++ standard, whereas this will be more obvious with just C++. Moreover, Qt and C++ are portable, so your students who are using Mac OS X or Linux will thank you for choosing a cross-platform framework (Qt also works on Windows); whereas, if you use C#, you will force your students to use Windows (yes, there is Mono, but it doesn't work nearly as well as Qt does across platforms).
You might also be interested in using my C++ Project Template which provides sufficient infrastructure for devleoping a Qt GUI application in C++ using CMake, and has been tested and verified to work under Mac OS X and Ubuntu Linux (and, if I get feedback on Windows, I will ensure it works there too). The template includes code that brings up a "Hello World" GUI in Qt when run with the "--gui" commandline option.
I would recommend Qt simply because it is C++, and not C#.
Interfacing between C++ and C# can be messy, and in my opinion would distract students from the object of the exercise (the algorithms, as you said).
Qt -- P/Invoke to use a C++ library from C# adds a whole 'nother layer of nonsense you don't want to even think about. If you were going to use .NET, it might be worth considering using C++/CLI, which linking managed and native code much easier.
I would use C# for the GUI stuff.
There are way more C# jobs out there than C++ using Qt, so why not prepare them for what they are most likely to encounter after they graduate?
One problem I have seen with academia quite often is not teaching what is used in the real world. Sure, all that other stuff is cool, and I personally like it. Experience of real world use after school would be my priority though.
Also, I don't think asking a bunch of programmers is generally the best source of advice on this subject. I would look at what technologies most companies are hiring for in your location, very likely for most desktop GUI stuff it will be .NET or Java.
writing GUI in C# and calling unmanaged C++ library because VS is a good starting IDE and .NET is the most comprehensive set of libraries available. This assumes your students have access to Windows computers. If they are on linux, QT would be the way to go.
Here's a wild idea, (re)write the algorithm in C# for the GUI app. This serves too purposes, 1) it neatly sidesteps the whole mucking with P/Invoke, C++/CLI or COM just to draw some pretty pictures and 2) unlike using Qt it gives you the opportunity to emphasize the distinctions between an algorithm, a program and a programming language.
I don't think it makes any sense to start creating C++/C# unmanaged/managed hybrid applications here.
For teaching it will certainly be easier if the students don't have to learn a new programming language for the Gui. Also interfacing between managed and unmanaged code and the different types in the different languages will complicate things unnecessarily. Much time and effort will be wasted on these topics, not helping anybody to learn the algorithms that are the topic of the course.
Also for "real life" usefulness I think it's clear that only very few projects will use a C++/C# hybrid. If you do your GUI in C# you will also do the logic behind it in that language. I don't see what would be gained from creating the GUI of a C++ application in C#.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 13 years ago.
I want my code to be as secure as possible.
I do not think that the security of your source code is a good reason to choose between C # and Delphi. if you create an .Net executable you can protect it with a tool like .Net Reactor, on the othe hand the win32 executables are by definition very difficult to disassemble (get the original source code) unless you include debug information in them.
You should compare other features, in my opinion you should use the language with which you feel more comfortable and you have more skills.
In my case it always chooses delphi, because it has an excellent and fast compiler and thousands of third party components and in addition to generating executables without dependencies. ;)
You can check this question
What language or RAD IDE do you recommend for building shareware?
Also you can check this list of applications built with Delphi
Good Quality Applications Built With Delphi
Among them Skype, TOAD, FL Studio.
It depends on your needs. But in the absence of additional information: If it's a shareware program, I'd go for Delphi, mainly because it compiles into relatively small and fast native code executables.
Should you be concerned about modern (Delphi 2010) apps being less secure than older ones because of the new, enhanced RTTI - that can be turned off with a compiler switch.
Delphi is your best choice for shareware software : you can distribute your app in a single exe file , you can embed whatever resource you want to : html pages, images, even your dbserver (look for firebird embedded).
Lots of shareware software was developed with delphi : EMS products (EMS SQL Manager for MySQL, IB, Oracle...), Skype, 7zip...
Have fun with DELPHI
Best Regards
Deleting this because everyone is down arrowing my response simply because their opinion is different than mine. It was an answer to his question, but an unpopular one, so people decided to start taking points away from me.
That's not the purpose of the down arrow, to remove points from people who disagree with you. Your childish and ingnorant actions will subtract from the quality of this site.
In Delphi, you can use pointers (and sometimes they are necessary, for API calls for example) - so you are closer to C than with C#. There is a reason why Java and C# do not have pointers: security.
"Most studies agree that pointers are
one of the primary features that
enable programmers to inject bugs into
their code."
http://java.sun.com/docs/white/langenv/Simple.doc2.html
In the C# programming language,
pointers are supported only under
certain conditions: any block of code
including pointers must be marked with
the unsafe keyword.
http://en.wikipedia.org/wiki/Pointer_%28computing%29#C.23
"Pointers are like jumps, leading
wildly from one part of the data
structure to another. Their
introduction into high-level languages
has been a step backwards from which
we may never recover."
— C.A.R.Hoare "Hints on Programming Language Design", 1973, Prentice-Hall collection of essays and papers by Tony Hoare
Use C# just because it has more mainstream support. Plus it is sure to be backed by Microsoft. Which adds incremental features to the language from time to time.
Also, the main architect of C# in Microsoft is Anders Heilsberg which was the co-creator of Turbo Pascal and Delphi of Borland before he got pirated by Microsoft.
It doesn't really matter in which programming language you create your "secure" application as long as you know what you want keep working until you get the result.
If you build an application in python or any other scripting language for instance you can still have good security.
As a good friend of mine told me few times "it's all you! programming language is just an extension of your mind!"
Both are good. Both are secure. Plenty of people are around who work with either of them.
The support for "enterprise" features like heavy Web services, distributed applications and componentized applications is better using the .NET Framework. Similarly there's no direct equivalent to the vector-based forms possible with WPF.
But if your application will never need them - then go with what you feel most comfortable.
As with most of the posts here, I would agree that security is in how you write the program. Not is what language you use.
I use several different languages, depending on the project.
On top of asking your self which you would be more comfortable with, you should ask your self if you want to support multiple platforms.
My company does a lot of cross-platform development, and as such, we don't use C# on those projects.
There is the mono project that aims to allow .net code to run on mac and Linux, but between the two, Delphi, being pascal is somewhat more portable.
( On our cross platform projects, we use either C or C++ )
Use the language you are most familiar with. That way you can hopefully avoid pitfalls and gotchas of using an unfamiliar language.