PDA

View Full Version : About your programs...



audinue
11-01-2008, 10:31 AM
By the way... Which do you prefer?

1. A good performance, pretty fast, efficient on memory consumption but lacks of conceptual features. Just like C.

2. An easy to reuseable, extensible, well organized, reliable, etc.. etc.. but SLOW and HUGE memory consumption programs, for instance Java, .NET, Ruby...


Thanks in advance.

Elysia
11-01-2008, 10:37 AM
1. A good performance, pretty fast, efficient on memory consumption but lacks of conceptual features. Just like C.
I prefer excellent performance, very fast, efficient on memory and a great number of modern tools to make programming easier and more flexible, code reuse, well organized, reliable. Just like C++.


2. An easy to reuseable, extensible, well organized, reliable, etc.. etc.. but SLOW and HUGE memory consumption programs, for instance Java, .NET, Ruby...
They can go to the pit of doom for all I care.
And I would not exactly call them well organized.
As cpjust once quoted:

If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back. :)

whiteflags
11-01-2008, 11:04 AM
I prefer either or neither depending on the problem being solved. A real answer to this question usually turns otherwise good people toward dogma, and restricts what they could do professionally.

Dae
11-01-2008, 11:26 AM
You're putting general labels on advanced subjects. It's not as easy as black and white.

First of all, you're asking in the C forum, so you're asking C enthusiasts to defend their bias.

Java
C
C++
C#
.NET
Ruby
Python
JavaScript
ActionScript

They all have their own purposes.

Note: this is just one of the many paths you can and will go down when considering a language for a particular project.

If you want a quick, professional, easy to implement application without having to spend much time on the GUI, and more time on features, go with .NET and VC# or VC++. Examples: proxy finder application, browser app, torrent app, etc.

Is VC++ too hard for you? Then it'd be C#, or even VB, haha.

Now if you aren't sure, you re-assess your decision. Do you need cross-platform compatibility? If so, do you care about JVM being required, or will you distribute different executables for each system. Is Java's GUI and performance satisfactory?

If not you might want to distribute a Windows, Linux, and Mac version. Which leaves you with C/C++. Does your project team have the time to use a low level language? If so, then you look into libraries, frameworks, etc. to find one that IS satisfactory (eg wxwidgets, sdl, etc.) Are any of them good enough or do you have to implement your own? eg. win32 for windows, whatever for linux, whatever for mac.

Even after that, you may require the use of ASM, and that's something you need to consider even if you choose Java or C# or what have you. Anything you can't accomplish in the chosen language needs a DLL, or some linking, which means you need to know both languages, and if speed is a factor (usually isn't unless it's graphics/math).

You take many different approaches on what you're to accomplish, and based on the requirements, and the language pros/cons, decide on the best choice for that particular project.

Sometimes you might use a higher level language/library as a prototype for a lower level language with more control/speed.

The fact of the matter is that it is all moot. As a software developer you should spend at least a few months working with all of these languages eventually, and you will understand then that each of them have their own pros/cons. You cannot start programming and swear off/avoid a particular language. That's just handicapping yourself.

The best suggestion is choose your first language based on what's being taught in school, your education, or your work, because there is no "better" language here. You choose which language you decide you need to use/learn.

Oh yeah, something you'll hear often is programming languages are just tools in a programmer's belt, he choose the best one for the job.

Do you use a wrench to get a nail in the wall? It's fun, but use a hammer.

hauzer
11-01-2008, 11:30 AM
The first one I'd say.

Elysia
11-01-2008, 11:34 AM
I figure this would be about opinions, not the right tool for the right job (ie, which language do you like best)?

laserlight
11-01-2008, 11:35 AM
I have moved this to General Discussions since it is not specifically about C.

whiteflags
11-01-2008, 11:56 AM
I figure this would be about opinions, not the right tool for the right job (ie, which language do you like best)?

It's never about opinions and always about tools. Discussions like this are mostly unproductive and turn people into jerks, at least at this board. Think about what you would have done after your post:

someone gets offended
you defend your bias
someone tells you why your wrong
repeat


What did you do constructively? It's all very pointless if you make it about opinions. No one can weigh a opinion's value anymore.

matsp
11-01-2008, 12:06 PM
By the way... Which do you prefer?

1. A good performance, pretty fast, efficient on memory consumption but lacks of conceptual features. Just like C.

2. An easy to reuseable, extensible, well organized, reliable, etc.. etc.. but SLOW and HUGE memory consumption programs, for instance Java, .NET, Ruby...


Thanks in advance.

These things are not mutually exclusive. You can, with correct design, have small, efficient programs with extensibility, reliability. It's all about design, and about using the right tool for the job. Doing a layout for an application that is mainly the user-interface for some database application (e.g. customer support, payroll, and such) is a different job than writing a program that calculates PI with 4 million decimals, which in turn is a differnet task than a GUI framework for generic applications, and all of that is completely different from the engine management and ABS system in a car.

Using THE RIGHT tool gets the job done easily. Using a screwdriver to hammer in a nail and using a hammer to screw in a screw will both be pretty unsuccessful - that doesn't mean that a hammer or a screwdriver is a poor tool - just that both of those examples are "bad usage" of the adequately designed tools.

--
Mats

Elysia
11-01-2008, 12:06 PM
It's never about opinions and always about tools. Discussions like this are mostly unproductive and turn people into jerks, at least at this board. Think about what you would have done after your post:
Perhaps the OP is curious as to whether you like limited languages in terms of features or blazingly hard, but blazingly fast and efficient in speed and memory, or slow languages, huge memory consumption, where they keep holding your hand all the way.
I mean, it is a curiosity by the OP, and we must be able to ask our mind, must we not?

It is sad that we cannot discuss a favorite language without it getting out of hand today, so we will just have to hope that it does get too far out of hand this time.
I simply responded to the question about my preferences, not about stating a language which is better than another practically.


What did you do constructively? It's all very pointless if you make it about opinions. No one can weigh a opinion's value anymore.
You can blame me if you want, but the point of the reply was to say "C is old, deprecated and of no use, use C++ instead", just in a polite way (in my own view, and opinion).
Because truthfully, I would like a little of both point 1 & 2.

Dae
11-01-2008, 12:08 PM
If it was about opinions why would you ask C vs Java on the damn C board. That makes no sense.

Anyway, there should be no distinction between opinion and the right tool for the job. My opinion is that each language is a useful tool for a certain job. Not one language is better than the other in general. Specific tasks. Name the problem/project, and we'll tell you which language is a better solution for that problem. If any (and sometimes it doesn't matter which).

Edit: He gave a 1 or 2 question, not a list the pros/cons Elysia.

Elysia
11-01-2008, 12:09 PM
If it was about opinions why would you ask C vs Java on the damn C board. That makes no sense.

Because generally people do post things in the wrong section?

Dae
11-01-2008, 12:11 PM
Because generally people do post things in the wrong section?

He knew what he was doing. Follow his posts.

Elysia
11-01-2008, 12:13 PM
I do not know what "he" was doing, and I am uncertain what posts you were referring to. So whatever the motive, there are a range of posts, mostly describing the right tool for the right job, so I am just going to go standby until the true intentions of the OP comes to light. Until then I am going to assume it is about opinions.

zacs7
11-01-2008, 03:43 PM
I'd say that Java is a lot better suited than C++ in many cases, and industry seems to agree. For example, bank programs, finance applications, web-side programs, simulators, etc. But that's not to say it can take the place of C++, no sir.

Why wouldn't you want your application to be extremely portable? To platforms you've never heard of or can't have access to develop/compile on?

Note: Before you try and bash my post Elysia, do some research and also note I did not say C++ is better than Java or vice-versa.

matsp
11-01-2008, 03:45 PM
Like I said, because a screwdriver is a bad hammer doesn't make a screwdriver bad as a screwdriver. Languages are tools. Use them in the correct way and they work well. Use them for the wrong purpose, and they may do something similar to the right tool, but not as well.

--
Mats

robwhit
11-01-2008, 06:47 PM
What Mats is saying sounds about right.

But how do you determine whether to use Java or C++ in a project? They both seem pretty similar in terms of capabilities.

matsp
11-01-2008, 06:57 PM
What Mats is saying sounds about right.

But how do you determine whether to use Java or C++ in a project? They both seem pretty similar in terms of capabilities.

Sure, that's like choosing between a Phillips screw & screwdriver or a pozidrive screw & screwdriver. They are also pretty much similar (with care, you can even swap a Phillips screwdriver with a Pozidrive one, or the other way around). Likewise, most projects where Java can be used are suitable for C++ implementation and the other way around. The details of the languages and application type would determine which is better in that particular case.

[By the way, the Phillips slot is more suitable when you have lower torque, whilst the Posidrive (and even more so more modern "star" patterns, such as torx) is more suitable for higher torque situations - this is probably why plasterboard/drywall screws are Phillips, whilst screws to hold for example floorboards are Pozidrive - http://en.wikipedia.org/wiki/Henry_F._Phillips.

--
Mats

SlyMaelstrom
11-01-2008, 07:14 PM
The truth is that professionally... at least in my experience... you don't normally have a choice in what language you program in. Perhaps when you get to a more managerial level than I am, these decisions can be made by you... but even then you'd still like either be coming into a project that's already been implemented or your company is licensing components of your system written in a specific language that you now have to adopt.

My only professional programming experience has put me in positions where I've joined the project and they tell me what to write and in what language. Even if you look at most job applications they ask you to know several languages. So... whether or not you prefer one language over another... whatever you're programming in, you'd better make your code as efficient, reusable, and well-organized as allowable. Even if you feel the project would be done more suitably in another language.

The only time I've found that I have a choice in what language to use is when I'm writing a small side script that is assisting myself or others but unrelated to the project... or if I'm in a job that isn't really directly related to programming (I work in Finance, as well) and I'm the only one developing some small system for them. In either of those cases, my go to language is usually either Perl or C. :)

matsp
11-01-2008, 07:20 PM
I agree with SlyMaelstrom - it's usually not "your" choice in a larger company. I have been the only programmer in the company when I was working for really small companies. That was great, you could do as you like. But then if it's gone wrong, it's your own fault!

In later years, I don't think I've ever been allowed to choose the language something is implemented in. It's been determined by either the rest of the environment (it's much easier to add a few hundred or thousand lines of C code to an existing project, than it is to add the same bit of code in C++ or Java) or by the project leader(s) etc [or, most likely BOTH of those - that is, the PL's say "this has to be done in X because the rest of the code is in X"].

--
Mats

maxorator
11-02-2008, 07:29 AM
1. A good performance, pretty fast, efficient on memory consumption but lacks of conceptual features. Just like C.
Lacking conceptual features means you can't do some thing with it. C has no limitations, so you can do everything you could do with a higher level language with it (plus a lot more things, like self-modifying code), just in a different way. If you don't like C, try C++. And if you don't like C++ either, don't bash people who do.

VirtualAce
11-02-2008, 10:17 AM
[By the way, the Phillips slot is more suitable when you have lower torque, whilst the Posidrive (and even more so more modern "star" patterns, such as torx) is more suitable for higher torque situations - this is probably why plasterboard/drywall screws are Phillips, whilst screws to hold for example floorboards are Pozidrive - http://en.wikipedia.org/wiki/Henry_F._Phillips.


Hehe. A screw's ability to hold torque has much more to do with how much torque can be exerted on the metal before it reaches elasticity and less to do with the type of 'interface' it has to become torqued.

I've torqued large old-fashioned nuts to well over 1500 ft-lbs and they held up just fine. I've also torqued 'torx' head screws to 60 ft-lbs and had them snap right off. It really doesn't matter if it's torx, phillips, standard, hex, etc. as to how much torque they can handle. The key is to torque the fastener to a point that it maintains it's spring - which is essentially what any fastener is. The point at which it becomes elastic is the point of no return. You have stretched the metal, lost the torque, and seriously compromised the composition of the metal. It's then that I would call salvage for help to remove my fastener and they would proceed to get very angry at me and remove my fastener in whatever way possible from the component. I overtorqued one inside an engine compartment once...with the engine in and had to call salvage. They weren't happy at all. The industry I used to work in had very high torque specs and I never came across any fancy fasteners. Just good old hardened nuts and bolts.

And now...

As to the argument of speed or re-usability I would say first reach for re-usability. At the point it becomes necessary to optimize and it is already working then go for speed. Half the time re-usability is enough and, to me, is worth more than speed in some cases. But it doesn't have to be either or since you can do both as long as you approach them the right way.

CornedBee
11-02-2008, 02:26 PM
Independently of the language, I always go for reusability and good organization first. If you don't have good organization, your program will be incorrect - if not at first, then after the first round of maintenance. There is simply no point in having a fast program if it doesn't do what it should.

Or, in the words of John Ousterhout (whoever that is): "The best performance improvement is the transition from the nonworking state to the working state."

Mad_guy
11-03-2008, 05:42 AM
I would rather have something work first and be fast later than just it being really fast, going nowhere.

There seems to be an extreme case of cognitive dissonance in the sense that we cannot get well performing code and good, reusable and modular abstractions. My question is: why can't we have both? :] I've found in my travels of developing with languages like Haskell, you can preserve good things like polymorphism and static typing, but still get raw performance when it's necessary which I think is fabulous (and it's true of many other languages too, do not get me wrong.)

As a programmer, I like to think of myself as an artisan. Writing code that you know is both efficient and beautiful is a wonderful feeling - the same feeling one gets when he builds a sturdy, beautiful wood chair. But without making the right choices in things like, say, tools, your life and job can be a lot harder than it has to be, and the end result can end up less beautiful than it could or should be.

CornedBee
11-03-2008, 11:10 AM
Also, there is still the underlying assumption here that a program can only be written in a single language. This is not only untrue, it's also far from the reality of most large projects. Two languages (typically a high-level langauge for the boring stuff and some C or C++, possibly mixed with Assembly, for the core algorithms) is probably the most common case.

Mad_guy
11-03-2008, 11:59 AM
Also, there is still the underlying assumption here that a program can only be written in a single language. This is not only untrue, it's also far from the reality of most large projects. Two languages (typically a high-level langauge for the boring stuff and some C or C++, possibly mixed with Assembly, for the core algorithms) is probably the most common case.

This is a good point - people should keep in mind it is entirely reasonable (dare I say, encouraged?) to develop the bulk of an application in one language, with more speed-critical parts written in say, C, and bringing that fast code in through a foreign function interface (just about every language worth the cost of its own domain name can interface with C these days.) Which is a perfectly reasonable approach - you may have that gnarly 10% speed-critical part of the code, but I think that would be a reasonable price to pay for the other 90% being higher level and developed/hacked on more rapidly.

A good example I saw recently (I think, anyway) is pycuda (http://mathema.tician.de/software/pycuda) which allows you to interface to CUDA from python - all the power of the GPU + the rapid development of python. Delicious. :]

Akkernight
11-03-2008, 12:25 PM
You use C++, 'cause it has a better name and Java applications never work :P

whiteflags
11-03-2008, 12:27 PM
You're probably using an application built with Java right now.

Akkernight
11-03-2008, 12:29 PM
Well, I mean applications that show the Java screen/logo in the beginning :P And I'm using Firefox, I think it's in C++...?

CornedBee
11-03-2008, 03:10 PM
Firefox is a perfect example of the multi-language approach. Its core is written in C++, a few low-level libraries (network, security and OS abstraction) in C, and the bulk of the UI in JavaScript, with the help of a few declarative languages (XUL and CSS, mostly).