Advertisement

what lang. is the best to start programming?

Started by January 01, 2003 05:09 PM
195 comments, last by caandom 21 years, 10 months ago
quote: Original post by NotAnAnonymousPoster
So you think that the creator of C# is making a mistake? Or just trying to appeal to the market of C++ programmers?

I can't be certain, but there's certainly a large market of s/w developers and managers who have been weaned on staticically-typed languages. Making the realisation that dynamically-typed languages might be more suitable requires a revisionists approach, and many people are unwilling to take the associated risks, if they ever make the realisation. So, I certainly think appealing to C++ programmers could be a large part of the C# strategy. Hejlsberg is not stupid (by a long chalk).
quote:
Going to be learning Smalltalk as part of my course. Can't wait to get started.

I'm sure you'll find it fun. One of the things I've observed about some C++ programmers who've learned a little bit of Python is they seem to think "this is too good, there *must* be something wrong with Python". They then go searching for weaknesses of Python, as it doesn't seem "right" that they should be able to develop s/w so easily. This is what leads to silly claims that we hear such as "it's not a real programming language", which is what people spout when they can't explain why they don't like it. One of the issues which I believe lead to this behaviour is the feeling of insecurity experienced when missing something you've been taught is fundamental to correctness. In this case, if people don't have static typing they continue to believe that is a problem, even when their own results are staring them in the face as a direct contradiction of that notion. Such is dogma.

The only weakness I'm aware of is efficiency, or lack of. Even then, the rules of premature optimisation still apply, meaning that you should probably use something like Python for the bulk of your work, and then use something more efficient when performance problems are located. Python plays quite nicely with C and C++.

I asked David Ascher what I shouldn't consider using Python for. His answer was "operating systems and device drivers". IOW, anything else is fair game. My experiences with Python thus far have not actually turned-up any performance problems, and I'm now considering redeveloping a 500KLOC C++ project using Python (or Jython). Not just for the sake of using Python - it needs redeveloping anyway. I'd hazard a guess that the Python equivalent will be less than 100KLOCs, which is very important to the overall economic picture.
quote:
The quote makes me laugh even if it turns out I don't understand it.

Oh yes, the quote's amusing. I thought you were implying it was Stroustrup who said it. He didn't.
quote:
Right, okay. I've obviously misunderstood something here. Typed languages were introduced in the 50's for efficiency.

Let's be specific. FORTRAN was introduced in the 50's and was statically typed, so you probably mean that language. FORTRAN was not introduced for efficiency, it was aimed at programmer productivity. I'm led to believe that there was much concern amongst talented programmers of the time that they would lose their ability to squeeze the most out of the machine. That's the same sort of objection we hear about dynamically-typed languages.
quote:
I read that as static typed languages, but is it just typed languages in general?

Well, static typing allows the compiler to make various optimisations based on information provided by the programmer. If you have a function which looks like this (in Python):
def foo(val):  # ....  

Then you do not know what type val is going to be until it is called. Therefore, the runtime must assume it can be any type, and perform something like a dynamic cast to figure out what it is before knowing whether the operations being performed on the object are legal. Obviously, if you know that val is going to be of one particular type, it is unnecessary overhead to assume it can be any type. Python doesn't facilitate adding type information in that manner. There are dynamically-typed languages which do allow that. Lisp and Dylan, for example, allow you to introduce type-information to expressions which can be used to perform optimisations. That means you can use the same language for both rapid incremental development and highly efficient code. I believe Eiffel does something similar with it's "freeze" feature, although I don't know Eiffel so don't take my word for that. With Python, you really need to resort to C++ extensions to achieve the efficiency (if you ever need to). Obviously, Python is lacking in that regard, but I don't see it as a problem for newbies since they are unlikely to be writing systems complicated enough to require high efficiency.

BTW, if you are interested in type systems, you might like to read a bit about Standard ML, which takes an interesting approach to static typing. Basically, if the ML compiler can figure out the type of an expression, then it will do so. You only need to add type information where it is absolutely needed.

[edited by - SabreMan on January 5, 2003 9:12:07 AM]
quote: Original post by SabreMan
I thought you were implying it was Stroustrup who said it.

No, no. I was saying that, as far as I''ve read, he built C++ on C mainly because of C''s popularity, not because it was a great language to build object oriented capabilities into.
quote: Original post by SabreMan
Let''s be specific. FORTRAN was introduced in the 50''s and was statically typed, so you probably mean that language.

quote: Coplien, Advanced C++
Typed programming languages came on the scene in the 1950s, not as the "best current practices" for good design or as system structuring tools, but as a means of generating efficient object code from program source.

I thought that he was specifically referring to statically typed languages, since they seemed to be the ones that offered the best means of generating efficient code.
quote: Original post by SabreMan
I''m led to believe that there was much concern amongst talented programmers of the time that they would lose their ability to squeeze the most out of the machine. That''s the same sort of objection we hear about dynamically-typed languages.

Hadn''t really thought about it like that. But when microcomputers first came on the scene, efficiency was a massive concern at every step of the way. There was a game called Exile written for the Beeb which they boasted, used every last ounce of memory in the machine. Certainly, the ability to squeeze the most out of the machine was essential for them. Those issues might not apply anywhere near as much anymore, but at one time they did. Unless I''m only talking about a very small area of computing. How long have MLOC programs been commonplace?

Anyway, I went from BBC BASIC to C++ and I don''t think it''s done me any harm. A lot of people obviously have a religious attitude, are reluctant to test whether what they have spent ages learning, or what they have always believed in, is only second rate or wrong after all. But I doubt that''s a problem confined to computer programming.
"C combines all the power of assembly language with all the ease of use of assembly language"
Advertisement
quote: Original post by SabreMan
I asked David Ascher what I shouldn''t consider using Python for.

Where was that?

"C combines all the power of assembly language with all the ease of use of assembly language"
quote: Original post by redeyegames
i cant believe this hasnt turned into a flame war!!!
yeah!!! way to go everyone!



pretty damn close if you ask me. And I belive it was at certain points. Esspecially when the more vocal people like sabreman were posting
-----------------------------AIM: Trebor DoDHompage: Thinking Digitally: My Web Blog
quote: Original post by NotAnAnonymousPoster
No, no. I was saying that, as far as I've read, he built C++ on C mainly because of C's popularity, not because it was a great language to build object oriented capabilities into.

I see what you mean and, AFAIK, you're correct.
quote:
I thought that he was specifically referring to statically typed languages, since they seemed to be the ones that offered the best means of generating efficient code.

I'm not familiar with the article (or whatever) it is that you're citing, so I can only comment on type systems in general.
quote:
Hadn't really thought about it like that. But when microcomputers first came on the scene, efficiency was a massive concern at every step of the way. [...]

You seem to be defending static type systems from a historical perspective, and that's fine. It doesn't change what I said earlier though.
quote:
A lot of people obviously have a religious attitude [...]

Well, the real problem as I see it is that very few people will actually think. As I said earlier, I disagree that C++ is a good first programming language, but my main objection is to people refusing to back up their statements. Someone says "C++ is great", I ask them to substantiate, and they go to pieces. That leads me to believe people are not thinking about what they are saying.
quote:
Where was that?

In private correspondence.

quote: Original post by Digigamer15
pretty damn close if you ask me. And I belive it was at certain points. Esspecially when the more vocal people like sabreman were posting

Actually, I am still posting and I don't see any flaming. I'd say the discussion is rather well behaved. The only real flames in this thread were directed at me from an Anonymous Poster for no apparent reason, and I was careful to not get dragged into a flamewar. Actually, I happen to be interested in the discussion I am currently having with NotAnAnonymousPoster, so unless you have something interesting and relevant to add please don't bother adding anything. I doubt anyone is interested in your previous comment.

[edited by - SabreMan on January 5, 2003 1:55:08 PM]
quote: Original post by NotAnAnonymousPoster
Where was that?

Actually, I decided to dig out exactly what David did say. Here's the relevant bits:
quote:
I've led the development of a project which includes about 65kLOC of Python code. In that project, Python isn't the bottleneck -- as per usual, bad algorithms, poorly designed interactions, unfortunate reentrancy, and poor design are all issues that have had performance impact, but "Python" isn't really the issue. The same performance problem would occur if every line of Python was written in C++ -- it would just take a lot longer to rewrite the code to fix the problem =).

quote: Python function calls tend to be relatively slow compared to e.g. C function calls, so recursive approaches to solving problems don't work very well in Python. Python data structures like dictionaries are very fast, so most high-performance solutions use them extensively.


> What should we definitely not use Python for?
quote:
Device drivers or production operating systems.

Don't use pure Python for numeric computations (use C/C++/fortran extensions wrapped in Python).

Don't use Python if you need a very small "self-contained" executable.


[edited by - SabreMan on January 5, 2003 2:00:38 PM]
Advertisement
quote: Original post by SabreMan
I''m not familiar with the article (or whatever) it is that you''re citing, so I can only comment on type systems in general.

You are familiar with the book. You were referring to it in the "C++''s type system is idiotic" thread. I found the quote when I looked up "type system". Page 7 of Coplien''s Advanced C++.
quote: Coplien, Advanced C++
Typed programming languages came on the scene in the 1950s, not as the "best current practices" for good design or as system structuring tools, but as a means of generating efficient object code from program source.

quote: Original post by SabreMan
You seem to be defending static type systems from a historical perspective...

Yes I am. I just want to give the poor guys a break.
quote: Original post by SabreMan
I ask them to substantiate, and they go to pieces. That leads me to believe people are not thinking about what they are saying.

We''ve had this discussion before. We''re human beings. We do this sort of thing a lot. This is a public forum and that means you''ll get a full spectrum of posters here, including people who can''t substantiate what they claim as fact. But that''s another road we probably don''t want to go down.

One thing I will add, when I program in what is regarded as a difficult language I generally feel good about myself. With the notion that C++ is difficult, I feel a massive sense of achievement that I am part of the elite who can "grasp" it. It automatically leads more to the conclusion that if you choose to work with easy tools, you must be an incapable programmer. But if this is a problem, and I think it is, I''ll still say it''s not exclusive to programming.
"C combines all the power of assembly language with all the ease of use of assembly language"
quote: Coplien, Advanced C++
Typed programming languages came on the scene in the 1950s, not as the "best current practices" for good design or as system structuring tools, but as a means of generating efficient object code from program source.

That sounds like a bogus claim. In the 50''s, most systems were built using assembly, which does not have a type system. Adding a type system does not magically mean you will generate more efficient code, but it does help the programmer efficiently write correct code. A statically-typed system has the opportunity to make type-based optimisations during code generation time, which means such a type-system can outperform a dynamically-typed equivalent. However, efficiency does not come for free.
quote:
We''ve had this discussion before. We''re human beings. We do this sort of thing a lot. This is a public forum and that means you''ll get a full spectrum of posters here, including people who can''t substantiate what they claim as fact.

The big problem is the people who implode when asked to substantiate their statements. All of a sudden, it''s no longer a discussion about technical issues, but about how SabreMan is a big nasty bully. For some reason, such people demand that other members of the community be held responsible for their own failings.
quote:
One thing I will add, when I program in what is regarded as a difficult language I generally feel good about myself.

You won''t feel good when other programmers using "easier" tools consistently code you into a cocked hat.
quote:
It automatically leads more to the conclusion that if you choose to work with easy tools, you must be an incapable programmer.

Do you understand why that is an idiotic line of reasoning?
Start with assembly.

I''m serious! Anyone who understands C++ language but doesn''t know how it will be compiled to assembly is not a good C++ programmer. C++ works very close to the processor and so if you want to start with the BASICs, start with assembly.

Contrary to what most people believe, assembly is not hard at all. It''s as simple as your pocket calculator: add this to that. Move this value from this register to that memory location, jump to that address, etc. It takes a lot of instructions to build a program, but THIS is programming at it''s purest.

For example the concept of pointers in C++ is extremely easy to understand if you first learned assembly. You''ll also understand a lot more about the problems you can encounter when programming in C++. You''ll even understand virtual functions better.

After assembly, try C. You will find that it is very close to assembly, but you''ll be able to do more with less typing. After a year of C programming you''ll be ready for C++ to abstract things even futher. But your assembly knowledge will remain very valuable to keep your feet on the ground and get the job done instead of loosing yourself in code that can''t do anything...
quote: Original post by SabreMan
That sounds like a bogus claim.

I was wondering whether I''d just misunderstood it. The only way it made sense to me is if Coplien''s definition of ''typed'' meant, ''strongly typed'', as opposed to what had previously been available as ''weakly typed''. Perhaps the claim is false and that wasn''t the case. Either way, my argument was that strong typing was not necessarily an idiotic concept. But I won''t dispute that its ability to outperform dynamic typed languages comes at a more significant cost for most modern projects.
quote: Original post by SabreMan
All of a sudden, it''s no longer a discussion about technical issues, but about how SabreMan is a big nasty bully.

I should imagine that some of the things you say do make people feel very small. We''ve got very different views on the relevance of that, and I doubt we''ll be able to reach a common conclusion on it. Suffice to say, the problem isn''t going to get fixed any time soon.
quote: Original post by Me
It automatically leads more to the conclusion that if you choose to work with easy tools, you must be an incapable programmer.

quote: Original post by SabreMan
Do you understand why that is an idiotic line of reasoning?

lol. Yes. It''s totally idiotic. I was trying to point that out when I said it. But it''s a really easy conclusion to reach, and I''ve had to say to myself "hold on a minute, let''s think about this" to realise that it''s a load of bollocks.
"C combines all the power of assembly language with all the ease of use of assembly language"

This topic is closed to new replies.

Advertisement