which programming language should I use for FreeBSD software

Hello,

I would like to write simple program for FreeBSD. Which programming language should I use? I am programming in Visual Basic but I think VB is not the best solution for FreeBSD.

Thanks in advance.
 
C or C++
Or
Sh, perl

Later two are scripts (but just because it's script it doesn't mean it's not a programing language).


It all depends on what do you want to write.

There are of course others, but If I wanted to write something I would pick from this list
 
+1 on C++ and Perl, those are the exactly the languages I first think about (although in reverse order) even if BSDs are written in C and Sh.

You still have them all .. so I'd say that you'd be better off by first taking a look at your problem and then picking the language that best suits your need.

my 2 cents
Best Regards and happy coding :)
 
Which language to use for software *on* FreeBSD is not a useful question. If you are changing parts of FreeBSD itself, the best approach will almost always be to use the language in which those parts are already implemented. For doing something new, however, pick the appropriate language for your application; it will almost certainly already be supported on FreeBSD.
 
If you are used to VB, and have a goal of writing "simple" programs, I'm inclined to send you to a so-called scripting language like Perl or Python or Ruby.

You can do an awful lot in Python with very little code.

If you define what sort of "simple" programs you are thinking of writing, you'd get more accurately aimed suggestions.
 
If you used VB and like point and click stuff where you just write code for function, try QT which uses C++. It is used by KDE, Google Earth, Skype, Adobe, Virtualbox, Nokia and many more.

It comes with Qt creator a cross-platform C++ integrated development environment which is part of the Qt SDK. It includes a visual debugger and an integrated GUI layout and forms designer.

Again, lots of things depends upon your requirements. A simple program can be as follows:
Code:
#include <QtGui/QApplication>
#include <QtGui/QLabel>
 
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QLabel label("Hello, world!");
    label.show();
    return app.exec();
}

http://www.qtsoftware.com/products
 
guys many many thanks for replies.

I would like to make small "communication" program - it should encrypt text with blowfish and send some encrypted (SSL, for example via stunnel) information to remote server and recieve answer from server. I think it would be better to use C or C++ fo this (but firstly I must learn myself C or C++ :) So I'm making decision now
 
Real men code in HEX! But I'm going to write my first FreeBSD program in pure assembler and if something minor get in my way I'll do the remained of it in straight C.

My list for FreeBSD is:

Sh - Required and Quick
Python, Perl - Slow but Resourceful
C++ - Faster but Slow and Insane
C - Faster
ASM - Pure Lighting (easier)

My list for Windows is:

ASM - Pure Lighting (easier)

In the end you'll do them all.
 
I would like to make small "communication" program - it should encrypt text with blowfish and send some encrypted (SSL, for example via stunnel) information to remote server and recieve answer from server. I think it would be better to use C or C++ fo this (but firstly I must learn myself C or C++ So I'm making decision now

You can accomplish this with a scripting language such as Python in less than ~100 lines of code -- It's also possible in C of course, but it will require more work (Especially if you need to learn the language first!).

C is useful for more low level things when you need to be relatively close to the hardware, for many user-land applications scripting languages (Python, Perl. Ruby, Java, etc.) are more suited, they are slower, but on today's hardware the difference is often hardly noticeable.
 
The two best languages are C++ and Python. C++ is for fast native code and Python for fast and flexible scripting. C is a subset of C++, so it comes for free. Bourne shell is also a good choice, but it's limited to just shell scripts.
 
C++ - Faster but Slow and Insane

Care to shade some light? I don't think so C++ is slow as compare to C as it is nothing but superset of C. Today compilers are optimized nicely. Ever tried out Intel compiler? In theory only assembly can beat C/C++, but considering the optimizations done by the compiler I don't see anything that can beat C++.

HTH
 
Even 32bit can be faster than 64bit. It all translate into machine code but (c++) vs ASM on FreeBSD? Examples comes first! I like ia64.
 
Carpetsmoker said:
You can accomplish this with a scripting language such as Python in less than ~100 lines of code -- It's also possible in C of course, but it will require more work (Especially if you need to learn the language first!).

Absolutely agree.
 
C++ is a horrible language, it has every feature you can think of and then 10 times more, no sane human being can fully understand the language without 10 years of solitary study with the Monks of C++.
 
Since everyone has an opinion... here is mine. ;)

It seems my opinion jibes pretty closely with Carpetsmoker's in this thread.

When I have the time, patience, (and ability), I prefer to write utilities in C. You have complete control over every byte of data you touch, and of course it is quick.

For most other scenarios I love Python. It is, IMO, everything a high-level (scripting oriented, but also OO) language should be. Easy to learn, pretty to read, terse enough, lots of useful libraries.

I had 20 credit hours of C++ crammed down my throat while doing my CS degree years ago. The language is powerful and all, but IMO it is not designed for humans. (At least not this human.) Steer clear.
 
C, Python and Perl are most recommended for BSD cause there are many samples and people to help you. C can really be hard to debug if program get too big. They all are just as difficult to learn when first getting started so might as well do ASM and Python or the most recommended C and Python. I love asm but I wish I had learned some C first for the knowledge. It was a hard decision.
 
I read a line or two about d++ in web development. I think its like a super low-level Python, Ruby, Perl etc, and is very web intensive. I think Microsoft created it in hope to invade, I mean create cross-platform applications for even BSD.

D++ should be the next thing to pure C but don't nobody seem to trust it last I read and it's missing a lot of functionality that even Perl can offer. So why waste your time. Might as well do C if not ASM, including a dash of Perl or Python.

There's just too much pain there. d++ is one of those languages.
Writing for BSD and not Linux or Windows you are in total control. You have no concern about portability so the real choice is, 32bit, 64bit or wait for Quantum (four years to eternity). Don't believe the hype. Just let-em ride. Everyone thinks he/she made the right choice and will do battle if you say difference. C and ASM will live forever.. EVERYTHING else comes down to at lease C or it would have never been invented.
 
If you have a background in VB, then gambas might be an interesting choice. I've written a couple of things in it; a few notable differences between the dialects but nothing you can't figure out pretty quickly, despite the total crap documentation. I don't know how well it would work for what you want to do though...it has some pretty severe limitations regarding the GUI.

As for the whole C vs C++ thing...C is not a subset of C++, C++ is a superset of C. C will always have more potential for higher performance, since C++ abstracts a bit too much and is more complex than it needs to be. Potential doesn't mean guarantee though...I've seen programs written in QuickBASIC that run circles around botched x86 assembly programs. When you code in C, you aren't too far off the metal much of the time...the same can't be said for C++. Of course, with modern computers being so fast and compilers being so intelligent, the gap has closed tremendously, but some of us still prefer the knowledge that our C-based programs, even if only 0.1% more efficient, are still going to be that much more efficient. :)
 
Shell or C is my choices. This thread kinda reminds me of an old UNIX saying "If you can't do it with a shell script use C" or something like that. I wish I could find out who said that, but searching Google didn't help.
 
Eponasoft said:
If you have a background in VB, then gambas might be an interesting choice. I've written a couple of things in it; a few notable differences between the dialects but nothing you can't figure out pretty quickly, despite the total crap documentation. I don't know how well it would work for what you want to do though...it has some pretty severe limitations regarding the GUI.

As for the whole C vs C++ thing...C is not a subset of C++, C++ is a superset of C. C will always have more potential for higher performance, since C++ abstracts a bit too much and is more complex than it needs to be. Potential doesn't mean guarantee though...I've seen programs written in QuickBASIC that run circles around botched x86 assembly programs. When you code in C, you aren't too far off the metal much of the time...the same can't be said for C++. Of course, with modern computers being so fast and compilers being so intelligent, the gap has closed tremendously, but some of us still prefer the knowledge that our C-based programs, even if only 0.1% more efficient, are still going to be that much more efficient. :)

Few things about C++ incorrect there.

You have started off with the fact that C++ is a superset of C, but not vice-versa. The categorization is irrelevant, given the fact that nowadays any ANSI compliant C++ compiler will compile a well written C program (that leaves out really archaic C language features) with minor warnings.

The speed thing is another FUD propagated by people that never use C++ for large scale industrial grade development.

Is a C++ binary larger (implies slower) than that of a comparable C program? Yes, if you use make use of advanced features like overloading and templates.

Is the difference noticeable? No, not even on elderly 486s.

>>

People tend to forget that a C++ class method after all is good old C function.

If your compiler (and later the loader) doesn't have to muck around deciding whether Foobar() means Foobar@# or Foobar %$ in the current context then the generated opcode for Foobar from a C++ code is similar to a C one...byte by byte.

The moral of the story is C++ doesn't puts a gun on your head to use templates or virtual functions.

They are features that makes your program structure maintainable, extendable and reusable at the fraction of speed penalty.

>>

Does anyone uses inline assembly inside C++ program? Do that and you'll have the benefit of assembly code inside a structured program.

>>

How many of the forumites here maintain product lines that involves system software with LOC running into half a million or so?

I do and I say with authority that a C++ codebase is easier to maintain in an environment that sees occasional handover of code, new staff induction, emergency fixes by relatively junior developers.

A large C++ application enforces certain degree of structural discipline which is important if you let the application to be handled by a people with varying degree of experiences.

>>

If speed is an arguement then one should code in assembly. C is a trade off you need readibility and portability and similarly C++ is a trade off if you need structural integrity in the application.
 
Back
Top