• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

Hopefully not the typical "I want to program" thread...

bonheur

Member
Mar 20, 2011
62
0
0
...because that's not my question. Well, at least not exactly.

I graduated about ten years ago with a college degree not related in any way to computer sciences (most of the courses were related to microbiology in some way or another). My job has nothing to do with programming computers and a computer is just another tool I use to perform very few of the overall tasks that I need to do. But I was taught an introductory class to algorithms using QBasic back in the day (over a decade ago). We were not taught any specific way to program.

I've never taken use of my basic algorithm skills since programable calculators (Casio, TI, HP) fell in disuse for us--we just use computers with MS Excel now.

Currently, we mostly use MS Word and MS Excel. In fact, for most of the time we use Excel to keep relatively short lists of documents--in tables to minimize risk of data corruption while sorting the data--than actual computations.

But I was thinking that, maybe, I should put my very modest and basic skills back at work. What would you advice me to do? I do not plan on taking another college degree or changing my job field. I'm thinking what advantage I could take for myself if I were to posses some basic programming skills. I really do not know what kind of problems I could solve with this sort of knowledge or what specific skills should I learn--I'm aware that programming is a very wide domain of skills.

Maybe I should just forget about ever having learned some very basic programming skills?

I've seen that on top of brushing up--substantially--my algorithm skills, I should learn a programming language (C, Python, whichever...), plus some more sets of commands to design a graphical interface or connecting to a database or the Internet, learn how to set up the program in the operating system, etc. That's lots of things and I do not even have a personal project in mind.

Any advice will be highly welcome!
 

ikachu

Senior member
Jan 19, 2011
274
2
81
For some reason after reading your message, Python immediately sprang to mind. It's pretty readable and there's not a lot of overhead in getting your first program running. It has some nice features that other languages usually need libraries for (big number support) and it's good at parsing text.
 

YoungGun21

Platinum Member
Aug 17, 2006
2,546
1
81
Python seems fairly simple.
Perl was super easy to code with. Although, installing modules (which are required for more advanced programs) did sometimes give me trouble.
I've found C# extremely easy to at least give your program a graphical interface. It is literally drag and drop (want a button? drag it from the toolbox to your canvas). The programming itself is harder to pickup than Python or Perl, though.

These are just my views though, and I am just a beginner-level programmer. No formal classes yet, just self-teaching.
 

bonheur

Member
Mar 20, 2011
62
0
0
Thank you for your advice guys! :)

I've actually done a bit of googling and the two languages that seem to appeal to me the most are Python and C. Being C# in a distant third place. Developing in C seems very complicated for a hobbist since it seems to need libraries for many things (I can be wrong here...). Writing in Java looks complicated to my untrained eye, but I have experience with it as a user where I found out that it gives the feeling of being somewhat unresponsive (at least when dealing with the graphical interface of a JAVA program).

But the main question still remains unanswered, do you guys think that I could really take advantage of whatever skills I could acquire now by learning some programming/Python? Sure my previous knowledge may help me on the first few lessons, but after that it'll all new to me. Conversely, will I be able to use basic programming skills for something useful in the real world (outside the scope of theoretical exercises) that I cannot do now by using "general third party software"? I cannot afford to spend time learning something that will not be useful for me in the real world.
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
Thank you for your advice guys! :)

I've actually done a bit of googling and the two languages that seem to appeal to me the most are Python and C. Being C# in a distant third place. Developing in C seems very complicated for a hobbist since it seems to need libraries for many things (I can be wrong here...). Writing in Java looks complicated to my untrained eye, but I have experience with it as a user where I found out that it gives the feeling of being somewhat unresponsive (at least when dealing with the graphical interface of a JAVA program).

But the main question still remains unanswered, do you guys think that I could really take advantage of whatever skills I could acquire now by learning some programming/Python? Sure my previous knowledge may help me on the first few lessons, but after that it'll all new to me. Conversely, will I be able to use basic programming skills for something useful in the real world (outside the scope of theoretical exercises) that I cannot do now by using "general third party software"? I cannot afford to spend time learning something that will not be useful for me in the real world.

Do you ever do any kind of data manipulation or other work that could be automated with software? A lot of people find they can spend 10 hours writing a program that saves them a few hours work every week.
 

Cogman

Lifer
Sep 19, 2000
10,286
145
106
do you guys think that I could really take advantage of whatever skills I could acquire now by learning some programming/Python? .

I don't know that anyone can really answer that for you. Leros's answer is probably the best you'll get (as programming really is all about the automation of data manipulation.)

What happens when you know programming is that you'll start seeing places where "Hey, I could write a program that could do that!"

With that said, while it may not be directly applicable in your daily life, I think it is still a useful skill to develop, just like painting or piano playing can be a worthwhile endeavor.

Some things you should consider
Fast development time with good libraries - Python
Needs to handle lots of data with a high degree of control (also has good libraries, though is more verbose) - C/C++
Fun syntax that grows on you - Ruby (in fact, I would recommend Ruby in place of Perl anywhere).
Runs (almost) anywhere on any platform - Java
Cleaner syntax than Java without running everywhere - C#
Great numbers manipulation - Matlab
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
BASIC is probably still the best example of a language that was easy to get into, easy to learn, and provided a foundation to build on. Early successes are what's needed, and if your initial language has too steep a learning curve you might very well not progress.

I don't know whether Visual Basic is simple enough in approach to fall into the same category, or if there is any other viable BASIC you can use. The problem with learning to program now is that most languages you might attempt are intertwined with code frameworks that are themselves deep and often difficult to master.

Perhaps using VB to create console apps is about as close as you can get these days.
 

Cogman

Lifer
Sep 19, 2000
10,286
145
106
BASIC is probably still the best example of a language that was easy to get into, easy to learn, and provided a foundation to build on. Early successes are what's needed, and if your initial language has too steep a learning curve you might very well not progress.

I don't know whether Visual Basic is simple enough in approach to fall into the same category, or if there is any other viable BASIC you can use. The problem with learning to program now is that most languages you might attempt are intertwined with code frameworks that are themselves deep and often difficult to master.

Perhaps using VB to create console apps is about as close as you can get these days.

While the frameworks are attached to everything, I would say that learning programming now is easier than ever. When I first got into programming, online tutorials for programming were few and far between. Today, people almost make the tutorials before the languages :D.
 

Pia

Golden Member
Feb 28, 2008
1,563
0
0
Fast development time with good libraries - Python
Yup
Needs to handle lots of data with a high degree of control (also has good libraries, though is more verbose) - C/C++
AFAIK the only reasons anyone would choose C/C++ over other languages is speed, to use existing code, or satisfying realtime guarantees in very-special-purpose use. These days even the speed benefit has gotten small.
 

Cogman

Lifer
Sep 19, 2000
10,286
145
106
Yup
AFAIK the only reasons anyone would choose C/C++ over other languages is speed, to use existing code, or satisfying realtime guarantees in very-special-purpose use. These days even the speed benefit has gotten small.

Not really. Speed is still important in a lot of places. Check out was Carmik recently said on the subject.
http://www.youtube.com/watch?v=4zgYG-_ha28&feature=player_detailpage#t=54m00s

And for all their quirks, C/C++ are still quite decent languages. There is a library for EVERYTHING with them, and they are pretty much the only language that every other language can communicate with.

They are more verbose, but not terrible.
 

Wyndru

Diamond Member
Apr 9, 2009
7,318
4
76
I enjoy coding various projects on my own. I have a CS degree, and know a few languages (from school), but sitting down and coming up with a problem and solution is fun to me. I like to think it keeps my troubleshooting skills sharp, which helps with logic/reasoning in other aspects of my life.

I do write some scripts at my job, so some of this knowledge comes into play at work, but for the most part I do it for my own enjoyment. Recently I've rebuilt a webpage for my family to upload pictures to and share them. I learned a bit about php, javascript and css, much more than I learned in the classes I took.

The best part about doing it on your own is that you don't have any deadlines, so if you get frustrated, you walk away for a bit and I find the answer usually comes while just casually thinking about it.
 

Pia

Golden Member
Feb 28, 2008
1,563
0
0
Not really. Speed is still important in a lot of places. Check out was Carmik recently said on the subject.
http://www.youtube.com/watch?v=4zgYG-_ha28&feature=player_detailpage#t=54m00s
I didn't say speed isn't important, but that the speed benefit of using C and C++ isn't what it used to be. The compilers, interpreters and performance-related facilities of other languages have improved by a ton. You can choose a much handier language and lose very little performance in the process, whereas in the past you would have lost a lot of it.

Even between C and C++ the game has changed. At some point a lot of people were choosing C over C++ for performance reasons. C++ now occasionally beats C in performance in real-world tasks.
They are more verbose, but not terrible.
If verbosity was their major fault, then a language like Java would have never gotten off the ground. It's much worse that they are unreliable and inflexible.
 
Last edited:

Cogman

Lifer
Sep 19, 2000
10,286
145
106
I didn't say speed isn't important, but that the speed benefit of using C and C++ isn't what it used to be. The compilers, interpreters and performance-related facilities of other languages have improved by a ton. You can choose a much handier language and lose very little performance in the process, whereas in the past you would have lost a lot of it.
I disagree
http://shootout.alioth.debian.org/u32/benchmark.php?test=all&amp;lang=python3&amp;lang2=gpp

Every benchmark I've seen puts C/C++ at the top by a LARGE margin. Hardware has gotten faster which has made interpreted languages look faster. Only compiled languages really stand a chance when it comes to speed.

Even between C and C++ the game has changed. At some point a lot of people were choosing C over C++ for performance reasons. C++ now occasionally beats C in performance in real-world tasks.
If verbosity was their major fault, then a language like Java would have never gotten off the ground. It's much worse that they are unreliable and inflexible.
C++ is still slower than C (when used in a c++ fashion). But we largely just ignore the difference now because the speed difference is miniscule on modern hardware.

As for unreliable, bullcrap. They are just as reliable as any other language. As for inflexible, what does that even mean? How are they inflexible and Java flexible?
 

bonheur

Member
Mar 20, 2011
62
0
0
Thank you guys for all your enlightening words, your discussions certainly help me frame what I want to do.

I guess Python would be my #1 choice, but since you're discussing C (C++ looks way complicated for me right now--it's advanced programming concepts) as well, I'd like to ask you something:

A code example between Python and C, let's say a small utility that has a graphical interface with one single button: Button#1 fetches the following file: http://127.0.0.1/myfiles/inv-list.zip from the Internet and stores it on the hard disk. While this piece of software is fetching the inv-list.zip file, said Button#1 offers the option to cancel this operation. Eventually, once the file has been successfully saved on the local hard disk, this button gives you the option to quit this small utility. There is no need for a "retry" option.

I hope this will be a short program to write in both languages, but it should be good enough to show some of the main differences between Python and C on this practical case.
 
Last edited:

Pia

Golden Member
Feb 28, 2008
1,563
0
0
I disagree
http://shootout.alioth.debian.org/u32/benchmark.php?test=all&amp;lang=python3&amp;lang2=gpp

Every benchmark I've seen puts C/C++ at the top by a LARGE margin. Hardware has gotten faster which has made interpreted languages look faster. Only compiled languages really stand a chance when it comes to speed.
Those are a limited number of artificial benchmarks. Still, Lisp SBCL isn't doing too shabby in many of them compared to GNU C.

Here's one paper on Lisp and C speed:
http://www.lrde.epita.fr/~didier/research/verna.06.ecoop.pdf

Another on Java numeric computation:
http://scribblethink.org/Computer/javaCbenchmark.html
C++ is still slower than C (when used in a c++ fashion). But we largely just ignore the difference now because the speed difference is miniscule on modern hardware.
It's at least as fast as C, because nothing stops you from using C code, but you have access to some no-cost features. C++ is able to be slightly faster than C.
http://unthought.net/c++/c_vs_c++.html
As for unreliable, bullcrap. They are just as reliable as any other language.
Memory leaks, undefined behavior, different results based on platform... LOL, no.
I don't ever want to formally prove a nontrivial C program to be correct.
As for inflexible, what does that even mean? How are they inflexible and Java flexible?
It means the ability to rapidly evolve your design to fit the requirements you encounter. C is about as bad as you can get. Java is not particularly flexible - in some ways, C++ is above it. Python, Ruby and the like are much more flexible. At the extreme end of flexibility you have Common Lisp, OCaml and so on.
 

Cogman

Lifer
Sep 19, 2000
10,286
145
106
Those are a limited number of artificial benchmarks. Still, Lisp SBCL isn't doing too shabby in many of them compared to GNU C.

Here's one paper on Lisp and C speed:
http://www.lrde.epita.fr/~didier/research/verna.06.ecoop.pdf

Another on Java numeric computation:
http://scribblethink.org/Computer/javaCbenchmark.html
It's at least as fast as C, because nothing stops you from using C code, but you have access to some no-cost features. C++ is able to be slightly faster than C.
http://unthought.net/c++/c_vs_c++.html
You'll notice that only two languages are about as fast as C++ and both of those languages are either compiled, or extremely optimized (JIT). Even then, they are NEARLY as fast, but not as fast. You'll never see an interpreted language match the speed of C/C++.

You made the claim that interpreted languages are just as fast as C/C++, I claim that it isn't even close. Show me a case of python or ruby working just as fast as C/C++ (and not one of those cases where they use a specialized library that was compiled in C/C++).

Memory leaks, undefined behavior, different results based on platform... LOL, no.
Memory leaks are programmer error, not language error. C/C++ don't just randomly leak out memory. In fact most programs WITH garbage collectors often have more problems with memory than C/C++ ever run into.

Undefined behavior.. Umm, EVERY language has SOME undefined behavior. The fact is, you're code has to look REALLY crappy before you hit the corner case of undefined behavior with C/C++. You'll almost never run into that case, and if you do, throwing in a few parentheses will almost always fix the problem.

Different results based on platform.. Wait, when did we start talking about java? C/C++ is surprisingly consistent when it comes to platform independence. The behavior is very consistent. What isn't consistent is libraries used across platforms. The only times you really run into issue is, again, when you start to make assumptions about the platform you are working on. Again, this isn't a language problem, this is a programmer problem.

Listing off a whole bunch of issues that a programmer can run into by implementing incorrect logic is NOT something that is the fault of a language. It's like saying threads are unstable because of deadlocks.

For a programming language to be unreliable, the code it some how much implement code in an undefined way. Or it would have to produce buggy code that cannot be corrected. C/C++ does neither. The fact that it is used as a systems software and in pretty much every driver should be indicator enough of how reliable it is.

On the other hand, languages like Java, Ruby, or Python will more commonly behave in unexpected ways than C/C++ will. Garbage collection tends to make it impossible for a programmer to know if their high memory consuming program is going to work correctly from one instance to the next.

I don't ever want to formally prove a nontrivial C program to be correct. It means the ability to rapidly evolve your design to fit the requirements you encounter. C is about as bad as you can get. Java is not particularly flexible - in some ways, C++ is above it. Python, Ruby and the like are much more flexible. At the extreme end of flexibility you have Common Lisp, OCaml and so on.
So correctness is flexibility? Seriously, what do you consider "flexible"? You've listed a whole bunch of languages and then said "And these are flexible!" without ever really nailing down what you mean by the term.

Do you mean "They can handle various inputs?" because if you do, then I've seen ruby and python fail just as hard when input isn't expected as C/C++. Do you mean "it is dynamically typed?" If so, that is a quality that is not always a good thing. Do you mean "you can redefine datatypes on the fly"? What is "flexible"?
 

bonheur

Member
Mar 20, 2011
62
0
0
I found out there's too stable releases of Python: 2.7.2 and 3.2.1. I guess I'll be going with 2.7.2 just to make sure I have more learning materials available to me. Is this the correct choice?

If I go with the 2.7.2 release, will it be a problem moving to the newer version in the future?
 

Cogman

Lifer
Sep 19, 2000
10,286
145
106
I found out there's too stable releases of Python: 2.7.2 and 3.2.1. I guess I'll be going with 2.7.2 just to make sure I have more learning materials available to me. Is this the correct choice?

If I go with the 2.7.2 release, will it be a problem moving to the newer version in the future?

You should go with the 3.x release. The reason there are 2 versions is because the 3.x release had some significant non-backwords compatible syntax changes. Unless you are doing legacy support (the reason for the two stable versions) the biggest number is best.
 

bonheur

Member
Mar 20, 2011
62
0
0


Thank you, Sir!

For now, I'll be doing this introductory course so I can remember what I used to do back in the day: http://ocw.mit.edu/courses/electric...r-science-and-programming-fall-2008/index.htm This course uses the 2.x series, but this page should help me out: http://docs.python.org/py3k/whatsnew/3.0.html

Can any of you recommend me any other tutorial or course to schedule after the MIT one? The videos are interesting, they make me feel like I was back in my college days! I never thought I'd miss those days...
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
So correctness is flexibility? Seriously, what do you consider "flexible"? You've listed a whole bunch of languages and then said "And these are flexible!" without ever really nailing down what you mean by the term.

My sense of it was that by "flexible" he meant "amenable to change." By that metric higher level languages would be more flexible because you have less work to do to change the behavior. I don't necessarily agree with that point, if in fact I have it right.
 

Pia

Golden Member
Feb 28, 2008
1,563
0
0
You'll notice that only two languages are about as fast as C++ and both of those languages are either compiled, or extremely optimized (JIT). Even then, they are NEARLY as fast, but not as fast. You'll never see an interpreted language match the speed of C/C++.

You made the claim that interpreted languages are just as fast as C/C++, I claim that it isn't even close.
I made no such claim. I didn't even claim that another compiled language would be just as fast as C/C++ on average. What I said was that the speed differential has shrunk and you no longer need to pay very much in performance if you choose not to use C/C++.
Memory leaks are programmer error, not language error.
...
Undefined behavior.. Umm, EVERY language has SOME undefined behavior. The fact is, you're code has to look REALLY crappy before you hit the corner case of undefined behavior with C/C++.
...
Again, this isn't a language problem, this is a programmer problem.
...
Listing off a whole bunch of issues that a programmer can run into by implementing incorrect logic is NOT something that is the fault of a language.
If the language makes it so easy to accidentally trigger undefined behavior that even people writing compilers do it en masse, then it is a serious reliability shortcoming. The fact is C/C++ leaves a ton of situations undefined in order to enable compilers to pursue more aggressive optimization. That makes sense for (some) performance intensive purposes, and is a conscious decision instead of a design fault, but it obviously makes those languages worse for general purpose use.
Assume you have a local variable int foo which may contain any valid integer. Then, for every operation out of:
foo /= -1;
foo++;
foo << 32;
you are risking undefined behavior if you didn't first check for a precondition. Maybe you do that. But do you do that every time without fail?
For a programming language to be unreliable, the code it some how much implement code in an undefined way. Or it would have to produce buggy code that cannot be corrected. C/C++ does neither. The fact that it is used as a systems software and in pretty much every driver should be indicator enough of how reliable it is.

On the other hand, languages like Java, Ruby, or Python will more commonly behave in unexpected ways than C/C++ will. Garbage collection tends to make it impossible for a programmer to know if their high memory consuming program is going to work correctly from one instance to the next.
I don't really see how such hiccups in garbage collection would affect the correctness of the program, instead of just performance.
So correctness is flexibility?
No, you split my quote from the wrong spot. Correctness is reliability.
 

Pia

Golden Member
Feb 28, 2008
1,563
0
0
My sense of it was that by "flexible" he meant "amenable to change." By that metric higher level languages would be more flexible because you have less work to do to change the behavior. I don't necessarily agree with that point, if in fact I have it right.
Yes, I said as much. Flexibility and expressive power will mostly go hand in hand. It's not just about changing output, either, but also about how fast you can adjust performance in parts which turn out to need it, and about how easy it is to avoid introducing bugs or causing a maintenance headache while doing these changes.

One example of what C++ has over Java in flexibility is that you can structure your code primarily as a computation process or a bunch of objects depending on what is most natural for the problem, while in Java you have to stuff everything into objects whether it makes sense or not.

The highest-level languages have many more approaches on tap. You can more easily create domain specific languages, or modify your production language itself with macros to include extra facilities you need. You aren't as married to your initial decisions of the data structures and the shape of the computation. Some data structures like infinite lists you can filter and merge with each other (a very natural way of thinking about some mathematical problems) are trivial to make from the building blocks the language gives you, whereas they would be hard and virtually unmaintainable in C.
 

Modelworks

Lifer
Feb 22, 2007
16,240
7
76