How can I learn programming?
I'f like to take the opposite tack. The evolution of tools means we dont have to fuss with pushing registers onto the stack each time we need to write a loop.
I like details. I LOVE assembler. But continuously reinventing the wheel doesnt make sense.
Integerated circuits were created so you dont have build NANDS out of resistors and transistors each and every time you build a new device. You dont have to test or trouble shoot each piece of that NAND either. The growth of technology means that we get closer to creating from pure thought. The idea is to get away from burning your fingers on a soldering iron.
Same goes for programming. Its important that we abstract our attention from the details so that we can flesh out the overall design. machine code begat assembler, and assembler begat the C generation. I think that C++ is somewhat of a dead end. It doesnt draw together the needs of modern technology like multi threading CPUs, hugely sublinked libraries and the like. Like ASM, its focus is too narrow to deal with the complexities of modern programming needs, which is why we are seeing larger and larger programming teams. Its like medical specialization; one doctor cannot know it all.
And this is sad, because the days of one man(or woman) creating something novel and exciting is gone. Its just too much work.
The binding of machine code into C/C++ routines allowed programming to abstract and programs could become more complicated. In essense, it was like turning transitors into ICs. Efficiency was gained. Now it is time to take those functions and bind them like ICs became CPUs. A new generation of programming languages is needed.
All that has gone before has been well bug checked, optimized and documented. Now its time to bring programming one step closer to human language.
But I fully advocate at least getting a basic idea of what goes on in your routines and functions. Just dont expect to work much magic there.
After all, I'd love to know how a microwave works, even if i dont need that to use it.
I like details. I LOVE assembler. But continuously reinventing the wheel doesnt make sense.
Integerated circuits were created so you dont have build NANDS out of resistors and transistors each and every time you build a new device. You dont have to test or trouble shoot each piece of that NAND either. The growth of technology means that we get closer to creating from pure thought. The idea is to get away from burning your fingers on a soldering iron.
Same goes for programming. Its important that we abstract our attention from the details so that we can flesh out the overall design. machine code begat assembler, and assembler begat the C generation. I think that C++ is somewhat of a dead end. It doesnt draw together the needs of modern technology like multi threading CPUs, hugely sublinked libraries and the like. Like ASM, its focus is too narrow to deal with the complexities of modern programming needs, which is why we are seeing larger and larger programming teams. Its like medical specialization; one doctor cannot know it all.
C++ is far from a dead end. Unlike Java and any other OO-based language, C++ allows you write efficient programs, AND you can access hardware as needed. I understand that languages will keep evolving closer to human language, as well they should, but with each step closer you loose efficiency. That doesn't matter if you are writing small apps, but it sure does when you are writing large ones, or time-critical ones, or safety-critical ones, or libraries that may be used in a variety of situations, or ones that need a small footprint, or embedded ones (iphone, ipod, and just about every modern device that uses electricity).
Also, the less people know about what happens at the low-level, the worse of a programmer they are. How can you possibly write efficient code if you don't understand how or why? Again, this doesn't matter for small apps, or apps with limited users, but it matters for everything else. The problem with abstracting away low-level knowledge is that you end up writing bad code.
But you are right that there certainly will be another level coming MC -> asm -> C -> C++ ->??? No, java or Ruby is not next on the list. I actually like Java alot because it's easy. But it's slow and takes away from your ability to write efficient code. Great for the internet, bad for everything else.
Quite right. Perhaps I should have spoke more cleanly; it is always needed to have the C family and asm, but most of the work should be done as high level as possible; it is only when you need to streamline that you fall back on writing in C++. if that doesn't do the trick, you fall back and write it in assembler.
Sorry for my rant. I've heard too many people in programming talk about how they hate C++. The real reason is they don't want to have to THINK about their code. They'd rather have a slow language like Java do the work for them so they don't have to think. I just don't see why it's so difficult to take care of how a program uses memory, or where pointers are pointing and how to properly manipulate them? I'm not a C++ guru, but I love the power it yields! Also, I'm a software wienie so I'm protective about outsiders who aren't true programmers. I have no problem with languages evolving to where non-programmers can use them. My problem is when people who think they are programmers want to use those dumbed-down languages as a shortcut to thinking.
Yeah, I'm a little egotistical!
Yeah, I'm a little egotistical!
Sorry, but you keep on plugging C++, which I believe is just about the worse thing that ever happened to programming.
At about the time that C++ appeared, I was using Delphi, and quite enjoying it. I have been a C guru since about 1979. Pascal was neatly extended to make Delphi a coordinated object oriented package. C had some off-key bells and squeaky whistles duct-taped onto it, along with a mass of verbiage, to make it into an oddly-obscure dialect.
Musing... I wonder what my criteria are for a "good" language? It certainly has nothing to do with "where pointers are pointing", etc.
A good language certainly should not make a user "THINK about their code". That's a disaster, unless the language is directed specifically at teaching basic coding techniques, and has no other purpose whatsoever.
A good language is one that assists the person using it to produce an elegant solution in the context of the particular problem. Ideally, the person should have minimal effort involved in learning whatever subset of the language they need to produce the solution.
Good languages have their context. LISP likes AI. Forth likes process control. Bash likes operating systems. Java is odd, but prefers the web, for its platform independence. C++ sits well with nothing, although I guess it is as good for headaches as INTERCAL, which certainly is the language that makes you think most about coding. C# is much nicer. C is awfully ambiguous at times, but is good if you need something one step up from assembler. Assembler is appropriate for very tightly crafted inner loops and hardware access, but NOTHING else. Direct machine code can even be useful at times (most assemblers don't allow you to generate every instruction that the machine can execute... occasionally you have to break free).
==========
Incidentally, I'm confused as to what you mean by "a software wienie"? Wienie = weiner = sausage? Maybe it doesn't translate well into English... now there's a strange language! As in:
"yields falsehood when appended to its own quotation" yields falsehood when appended to its own quotation.
_________________
"Striking up conversations with strangers is an autistic person's version of extreme sports." Kamran Nazeer
whitespace
My first language was pascal. It taught me a lot about programming. Next I learnt VRML because I was interested in CAD.
I would say Ruby is a good first language.
How a language abstract is specified and how it can be currently implemented are two different things. There are many brilliant ideas that have never happened. Some aren’t feasible and some are.
People who say stuff like "that's not a 'proper' programming language..": a) what are they talking about 'proper'? b. they best be talking about the language itself because if not they should be more specific.
If you are you are learning your first programming language you want something that is going to give you a good grasp of the concept. Technically a language could be anything, but there are loose schools as well as concepts which would be fruitful for learning more.
Maybe I'm not experienced enough to understand how that could possibly be?
When I say thinking about code, I guess I'm talking more about design and efficiency. To think about what your code is actually doing. I believe this is an essential part of programming. Nothing annoys me more than seeing poorly thrown together code. Yeah it may bearly work, but it's a shortcut to thinking. That's not to say I'm in favor of complexity, just the best possible solution. Perhaps it is because I have always worked on large projects where code and efficiency standards are at the highest possible levels.
Lau certainly must agree about coding cleanly; I'd hazard a guess that he agrees about that. But if i read him right, i think he means that one shouldn't have to grind the flour to bake a cake. measuring it is enough.So to speak.
Also, What i mean is brought to example by you. You said
Now I think you will agree its more efficient when one person is used instead of two. A small team is more efficient, provided everyone can do the work. and thats the crux of it. its simply easier, and less error prone to type printf than to push registers to stack, point to the memory location and call an interupt.A good programmer shouldnt have to think about things like those; he stands on the shoulders of other good programmers(that make the language he uses).
Its a little hard to conceive, but the next level of programming will do that to C/C++, lisp, all the rest.
Perhaps a better analogy would be driving. you dont want to have to fuss with correcting your fuel flow all the time, you want to pay attention to where you are going. Other people have taken the chore out of doing that.
I suggest Java or PHP.
Both have really good documentation: Java manual, PHP manual.
I'd suggest PHP for a newbie, because you don't have to deal with Object Oriented coding, unless you want to, which can be a bit confusing when you're just starting off.
PHP is like being downtown on a Friday night, high on LSD and with a VISA card without credit limit: You can do anything!
You can either use PHP as a command-line interpreter, or hook it up with a web server and do some web coding.
If you have access to a web server then maybe they have PHP there, in which case you can just get to it.
Open a .php document in your web server document root and write:
<?php
echo 'Hello World!';
?>
(Everything outside the <?php ?> tags will be interpreted as normal HTML.
Then open that page on your server with your browser.
_________________
Nae king! Nae quin! Nae laird! Nae master! We willnae be fooled again!
Some more random thoughts....
I'll admit to being a tad biased about C++. I just didn't much care for it when it came on the scene. I was already using stuff that "worked for me", and didn't see the point in C++, which seemed to preserve all the worse aspects of C and add verbiage.
What has just occurred to me is how there seem to be a lot of not-C++-lookalikes around, these days, all of which have their staunch supporters, but all of which (to me) look like near carbon copies of one other.
I thought this was quite apposite.
Then I found this, where I counted about 60 entries I have actually used. I found the one starting "Sh" quite amusing.
Back to the "real" world... out of shear curiosity, a few days ago there was a problem published on the alt.math.recreational newsgroup:
Give a nine digit number using the nine digits 1 through 9, such that the whole value is divisible by nine, the first eight digits form a number divisible by eight, the first seven digits form a number divisible by seven, and so on.
My C program for this was quite messy, didn't take long to write and got the desired results. It's down the bottom. Make of it what you will. It's a blend between a pure "sledge hammer" approach and algorithmic ideas that occurred to me as I coded it. The elapsed time between reading the problem and having the answer was something like an hour.
Someone else, "The Qurqirish Dragon", a little later, came up with a clear English language, argued solution, which involved merely a quick verification of half a dozen possibles for divisibility by seven.
However, even later, "Dana" gave:
1
Select[Permutations[Range[9]], fx]
That is Mathematica. If you want to solve a mathematical problem, maybe using a language tailored to mathematics is a good idea.
==============================
Here's my C code, which I cannot suggest I'm proud of. It violates almost every principle I can think of. It's ONLY justification is that it works.
#include <stdlib.h>
#include <string.h>
#include <math.h>
int target = 0;
int main(int argc, char *argv[]) {
if (argc != 1) target = atoi(argv[1]); {
int dig1; for (dig1 = 1; dig1 < 10; dig1 += 2)
if (dig1 != 5) {
int dig2; for (dig2 = 2; dig2 < 10; dig2 += 2) {
int num2 = dig1*10 + dig2;
int dig3; for (dig3 = 1; dig3 < 10; dig3 += 2) {
if (dig3 != 5) if (dig3 != dig1) {
int num3 = num2*10 + dig3; if (!(num3%3)) {
int dig4; for (dig4 = 2; dig4 < 10; dig4 += 2)
if (dig4 != dig2) {
int num4 = num3*10 + dig4; if (!(num4%4)) {
int num5 = num4*10 + 5;
int dig6; for (dig6 = 2; dig6 < 10; dig6 += 2)
if (dig6 != dig4) if (dig6 != dig2) {
int num6 = num5*10 + dig6; if (!(num6%6)) {
int dig7; for (dig7 = 1; dig7 < 10; dig7 += 2)
if (dig7 != 5) if (dig7 != dig3) if (dig7 != dig1) {
int num7 = num6*10 + dig7; if (!(num7%7)) {
int dig8 = 2 + 4 + 6 + 8 - dig2 - dig4 - dig6; {
int num8 = num7*10 + dig8; if (!(num8%8)) {
int dig9 = 1 + 3 + 7 + 9 - dig1 - dig3 - dig7;
int num9 = num8*10 + dig9;
printf("%d\n", num9);
} } } } } } } } } } } } } }
return 0;
}
_________________
"Striking up conversations with strangers is an autistic person's version of extreme sports." Kamran Nazeer
Hmm
I wouldn't suggest PHP. Yes it is easy to learn, however it is an example of a very scrappy language. It doesn't exactly encourage good practice. Try reading somebody else's php script. Not great.
I'm not sure Java is the best choice either, though it replaced pascal as the common first language in schools for some reason. That era would be over.
Most of what work? The problem is the higher the level and abstraction of the language, the slower and bigger the program. If you want a fast program, you'd sure as heck better not want to use Java or any other high-level language that makes things easy. Why do you think they don't write resourse-intensive games, or heavy computation programs, or time-critical, or safety-critical or, or, or ... in Java or a similar high-level language?
I understand it would be nice to be able to write everything as high level as possible, but most real-world situations dictate that such is not the case. If it were, we would all use Java for everything because it's very very easy to learn, fully portable, with a huge set of ever-expanding libraries to help you do just about anything.
By that logic, assembly language is the only way do do anything, ever.
But of course it isn't. C++ offers much more to the programmer, like functions and classes, and the code the compilers generate is almost as good as hand-tuned assembler. So most coders sacrifice a little bit of execution speed in order to get the program written some time this year, and the code down to a manageable size. Well, if you sacrifice a bit more speed than that, you can have your program written in a few weeks, and the source code will be really short, highly readable, and also easy to understand and modify.
For some areas, this trade isn't worth making - like games, which need to be as fast as possible, and are optimized in assembly. But for most programs, it's more important to have a feature now than to have it go fast, when and if the coder manages to force the logically simple ideas into the few basic low-level abstractions the language provides.
I've coded in Lisp and having to repeat myself in C# sucks. I really hate having to do it. Any time a piece of code looks almost the same as any other, I start itching to write a macro - only to realize that I can't, because C# is too low-level for that. I actually have to type out the code more than once, if it's not something a function could abstract - like the separate code to read and write my XML format. Both have a doctype, then the main tag, then a loop for the item tags, then a data sub-loop inside that - but I can't abstract out that pattern easily. I really don't care that it's a bit faster in C#, and I'd write the project in lisp except I already have a few thousand lines of C#, and I'm still learning lisp.
_________________
I need to find an avatar.
Similar Topics | |
---|---|
Grace Hopper - Pioneer of Computer Programming |
24 Oct 2024, 10:47 pm |
how to learn facial emotions ? |
15 Nov 2024, 9:09 am |