You are not logged in.

#1 2008-07-28 05:25:07

kalinatek
Member
From: Boston
Registered: 2007-01-07
Posts: 20

New to programming, don't know what to program...

Hello, my name is Mike, and I'll be honest with you, I'm fifteen years old, about to turn sixteeen. But don't let that fool you.

I've been using arch for almost two years, I've tried ubuntu, gentoo, debian, fedora, vector, DSL... and more, but I just keep coming back smile I feel comfortable with Linux, I'm posting from a fresh Arch that I got going in about an hour, complete with WPA-PSK connection to my WiFi and a basic fluxbox setup.

So anyway, I've got these two giant books in my closet, they say C and C++ on the front. Reference books, full of the basics and, seemingly, the impossible. I've dabbled in C and C++, and at one point tried to write a basic graphic program for Qt but got tired of fooling with it.

So after all this bullshit, my question is, is C just way too much for me and I need to step down to python or something of the sort? And whether it's python, C, or... assembly even, my biggest problem is I don't know WHAT to program. I understand classes and pointers (mostly...) and the sort but I don't know what to do with all of it. I feel like there is this huge gap between writing simple command line programs and the simplest of programs that I use on the command line in Linux. I tried to decipher the sources of the most basic of command line programs that ship with Linux and I couldn't make sense out of them.

Bah, I don't know. Apologies for the length of this post. Help pls?

Offline

#2 2008-07-28 07:26:03

josomebody
Member
Registered: 2008-06-20
Posts: 190

Re: New to programming, don't know what to program...

Basically when you need code, code it. If you want to program just as an exercise to keep your brain working or as a hobby, any time some simple need arises, instead of hunting half an afternoon for a program to do it, write your own. Also, it's always good to write simple games. They give you some visual feedback in return for the time spent coding, and it's something to keep around and show your friends later.

Some examples of simple hacks to kill an afternoon when you feel like coding:
one day I wanted a custom app to read an acpi temperature sensor, convert it from C to F, and output the text so it could be read in genmon. I wrote it in a mishmash of bash and C, took about fifteen minutes, and I was proud of it and used it for a long time, and I learned how to use sed. Another day I wanted a simple ncurses desktop switcher that would take a list of profiles, pick one, and rewrite .xinitrc on the fly. Good excuse to learn curses. Most of it was in Python. Yet another day I got this bright idea to combine overhead tank combat game style with Legend of Zelda (original NES version) style dungeons, and give the bad guys combat algorithms that evolved to match the player's fighting style. Prototyped it in Python in a couple of days, wrote a level editor for it, and am gradually porting it to C++. It was an excuse to learn how to make Python write its own code.

Basically, if you need a simple utility for a specific purpose, use it as an excuse to throw down some quick code. If you're bored, make games or something.

Python's good and easy for simple graphical apps or heavy text processing or mixed-paradigm needs. C and C++ are good for speed-crucial apps, but are a little lower level, and if you're pretty new to it, look forward to spending a lot of time tearing your hair out getting your code to compile, but it is pretty much industry standard. Bottom line, do something that'll be fun for you and you'll have an easier time sticking with it and learning something.


: () { : | :& } ;:

Offline

#3 2008-07-28 08:19:19

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: New to programming, don't know what to program...

I agree with josomebody, programming can be fun when you are programming something useful for you.
And when using Linux daily, there must be some times when you need to write something on your own.
Though sometimes, it is more handy to just write a sh script and reusing all existing tools like grep, sed, find, cut, whatever.
But python is very practical too.

If you really lack ideas, you could try fun exercises like the ones on http://projecteuler.net/ :

Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.

Once you get familiar with programming, if you want to give something back to the ArchLinux community, you might want to have a look at ArchLinux projects and see if you have any ideas how to improve them, or just help their development :
http://projects.archlinux.org/
These are mostly bash and python scripts, C programs and as far as I know, python+django for the main web site and the AUR. And you have likely used the majority of them.

Edit : I forgot to say that I don't know if I am a good example, but after learning the K&R C programming book, I did not do anything useful with it until I started hacking pacman. Well I am not convinced I did anything useful there either, but at least I learned a lot smile

Last edited by shining (2008-07-28 08:24:37)


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#4 2008-07-28 09:58:36

Zeist
Arch Linux f@h Team Member
Registered: 2008-07-04
Posts: 532

Re: New to programming, don't know what to program...

When you are new to programming syntax is most likely going to feel confusing, and as has been said before it will be very frustrating if you don't have anything you're really trying to achieve with your programs as then you're likely to not be motivated to continue.

I do not really know if it is better to use a higher level language since I have programmed long enough to not see syntax as a problem and then going from one language to another is incredibly easy. Not having to fight with syntax until you've grasped the basics of programming may be helpful though as that allows you to explore the basic concept of putting together a program.

The first language I programmed in was Amiga Basic and that is far from complex which I guess may have helped in making it more fun. I mainly started out in writing games and small apps that did calculations for me and similar things. Then after that it was on to C, the first C program I wrote was a hack for a game I liked that went into the memory and re-wrote some bytes to make it not crash due to that I had hardware that was a bit under what was required.

Once you start to get some programs together you can start to work on learning algorithms, data flow and handling of data structures. Also it might be interesting to start looking into the basics of object oriented programming as that is quite useful to know. In the end knowing these things is what programming is about, programming isn't really about just knowing the syntax of a certain language as in knowing how to solve problems. As such programmers that are tied down to just knowing one language are generally not very good programmers and it is quite good to stay diverse to use the best language for the situation.


I haven't lost my mind; I have a tape back-up somewhere.
Twitter

Offline

#5 2008-07-28 20:24:00

Kadrus
Member
From: Lebanon
Registered: 2008-04-27
Posts: 4

Re: New to programming, don't know what to program...

I agree with shining,projecteuler is a great set of exercises that will improve your programming skills through mathematic problems as you will learn how to write algorithms and recursion to help you solve your problems.I am 15 too by the way,and age doesn't really matter,you can enjoy programming through different aspects,weather it's game programming,web development,software programming,etc.And get involved with some open source projects,as you can modify the code of a program you like and make it act the way you want.

C just way too much for me and I need to step down to python or something of the sort

Well Python is an easy to learn language and used in a lot of apps under Linux,so you can learn it quickly and start hacking programs,and messing around with the code.

Offline

#6 2008-07-28 21:20:37

catwell
Member
From: Bretagne, France
Registered: 2008-02-20
Posts: 207
Website

Re: New to programming, don't know what to program...

Most of the times, when I want to learn a new language, I either code 2D SDL games or reproduce nehe's OpenGL tutorials.

Last edited by catwell (2008-07-28 21:21:15)

Offline

#7 2008-07-28 21:25:05

pauldonnelly
Member
Registered: 2006-06-19
Posts: 776

Re: New to programming, don't know what to program...

kalinatek wrote:

So anyway, I've got these two giant books in my closet, they say C and C++ on the front. Reference books, full of the basics and, seemingly, the impossible.

Have you got Stroustrup's book? Don't feel bad if that one loses you—it's about as clear and well-designed as C++ itself.

kalinatek wrote:

So after all this bullshit, my question is, is C just way too much for me and I need to step down to python or something of the sort? And whether it's python, C, or... assembly even, my biggest problem is I don't know WHAT to program.

Yes, stepping up to Python is a good idea. How about programming some simple games? It's a good way to get some experience managing data and writing logic without needing to think up or implement a program that has to be useful. Writing programs you need is good, but maybe there's nothing in particular that you need that would be an appropriate project for a beginner. If you make a list of program ideas (amusing games, useful things for your desktop (even if they are not projects you could complete now)) that cross your mind you may find it easier to come up with a project—you can check the list to see if anything catches your eye, rather than sitting in front of a blank text editor trying to think up something to do.

Offline

#8 2008-07-28 21:46:02

Kadrus
Member
From: Lebanon
Registered: 2008-04-27
Posts: 4

Re: New to programming, don't know what to program...

True.Plus,developing simple games with Python can be easy using PyGame,plusPyWeek can make it more exciting by writing a game in a short amount of time.

Last edited by Kadrus (2008-07-28 21:46:30)

Offline

#9 2008-07-28 22:16:12

Asgaroth
Member
From: Hesse, Germany
Registered: 2008-03-26
Posts: 58

Re: New to programming, don't know what to program...

I second that using Python instead of C is probably a good idea. In Python you have a clearer syntax and way more expressiveness without having to caring about things like manual memory management, which, in 90% of the software isn't needed and the small performance overhead of garbage collection is insignificant compared to the clarity of the program and the time saved to write it.
For any bigger project that's not low-level stuff, I would rather choose Python, Lisp or Haskell than C or C++, because the former are just better designed languages( in my opinion) which lead to clearer, more readable and more reliable code in a shorter time.
</anti-c-rant>

Offline

#10 2008-07-28 23:07:27

Zeist
Arch Linux f@h Team Member
Registered: 2008-07-04
Posts: 532

Re: New to programming, don't know what to program...

pauldonnelly wrote:

How about programming some simple games? It's a good way to get some experience managing data and writing logic without needing to think up or implement a program that has to be useful.

I'm going to have to agree, games are incredibly useful in learning new things. Once upon a time I used to write quite a few pointless games. Even though it is quite a few decades ago now the things I started with on programming at first back in the day were primarily games. It may have had to do with that I was six or seven and really liked computer games, but I still write game engines for fun these days as tests of my theories even though I barely play any games any more.

Asgaroth wrote:

I second that using Python instead of C is probably a good idea. In Python you have a clearer syntax and way more expressiveness without having to caring about things like manual memory management, which, in 90% of the software isn't needed and the small performance overhead of garbage collection is insignificant compared to the clarity of the program and the time saved to write it.
For any bigger project that's not low-level stuff, I would rather choose Python, Lisp or Haskell than C or C++, because the former are just better designed languages( in my opinion) which lead to clearer, more readable and more reliable code in a shorter time.
</anti-c-rant>

I can't say I find Python more or less clear than C. It has it's own little quirks which are a bit illogical just like C does... and most other languages. Not having to manage memory is a huge advantage if one is new to programming however and in general it saves time debugging as one doesn't have to spend as much time stress testing a program to find leaks. There are more languages to look at than python when it comes to looking at memory managed languages with a wide usage today though such as C#, Ruby, Perl, Java and Lua which are all also completely valid options and they all have situations when they can provide the best solution.

I can't say that I have any language that I'd most want to use for all projects that I could possibly use it in. I think it requires research of the situation and the problem you are going to solve to pick what language to use regardless of if the situation requires a lower level or a higher level language. For learning however, I think one can pick more or less any language as then reaching an optimal solution is hardly an issue.


I haven't lost my mind; I have a tape back-up somewhere.
Twitter

Offline

#11 2008-07-28 23:24:40

Asgaroth
Member
From: Hesse, Germany
Registered: 2008-03-26
Posts: 58

Re: New to programming, don't know what to program...

Zeist wrote:

I can't say that I have any language that I'd most want to use for all projects that I could possibly use it in. I think it requires research of the situation and the problem you are going to solve to pick what language to use regardless of if the situation requires a lower level or a higher level language. For learning however, I think one can pick more or less any language as then reaching an optimal solution is hardly an issue.

I agree, these 3 languages were rather examples for a type of languages, since I would prefer automatic memory management and convenient usage of common structures like lists or similar things for any project that doesn't require low-level access, which just isn't practical and sometimes not even possible in languages like python.(For example writing drivers or performance-critical applications for which the overhead of a GC is an issue)

I can't say I find Python more or less clear than C. It has it's own little quirks which are a bit illogical just like C does... and most other languages.

I just think that C has more of these quirks and since clarity is a subjective thing it's just my opinion that python and others are clearer than C, since one doesn't have to deal with pointers and memory management, which tends to make programs a lot more complex and unreadable.

Offline

#12 2008-07-30 09:36:57

kalinatek
Member
From: Boston
Registered: 2007-01-07
Posts: 20

Re: New to programming, don't know what to program...

Thanks everyone. smile

I think I'm going to take a look at Python, because before worrying about memory management and stuff, I feel like I need to just... write some code, build some confidence and spend time thinking in terms of how to go from idea --> functional program... I'll come back for C in the future though, promise.

Offline

#13 2008-07-30 09:59:19

nesrecar
Member
From: Germany/Munich
Registered: 2004-06-06
Posts: 79

Re: New to programming, don't know what to program...

I wrote a long time ago a simple python script to monitor rtorrent progress. It's quite simple and basic to understand, you can look over it, if you want, might be helpful:

http://freeforge.net/~ssimon/files/other/rtstat.py.txt


Public Key 0x24685E35 available from any key server you trust.

IRC: ssimon/Nesrecar

Offline

#14 2008-07-31 09:37:58

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: New to programming, don't know what to program...

python's good.

Just find something on your desktop you don't like, think of some tool you'd find useful, or work out what's missing from your desktop, and there's a project. If it seems hard -- good, you learn more.

I havn't got any big projects to show for it, but I learnt a tonne with python, and could probably write some useful apps cleanly and quickly now.

Offline

#15 2008-07-31 18:29:39

pauldonnelly
Member
Registered: 2006-06-19
Posts: 776

Re: New to programming, don't know what to program...

kalinatek wrote:

I think I'm going to take a look at Python, because before worrying about memory management and stuff, I feel like I need to just... write some code, build some confidence and spend time thinking in terms of how to go from idea --> functional program... I'll come back for C in the future though, promise.

I think that's a good idea. And don't get too hung up on C. If you want to implement language runtimes or device drivers it's a must, as well as for some kinds of resource-constrained computing—but for nearly any purpose other languages are more suitable. C is portable assembly language. If you need that, or if you're interested a program that happens to be written in C, great! Learning a new language is always good, and C is a fairly handy one to have in the toolbox. But it's like one of those screwdrivers with a triangular head. Sometimes it's exactly what you need, but mostly it's not. So don't feel like it's some kind of essential language that you will eventually graduate to. A person could write useful programs for several lifetimes without needing to touch C.

Offline

#16 2008-08-19 19:14:01

alienman
Member
From: Mexico
Registered: 2008-07-08
Posts: 106

Re: New to programming, don't know what to program...

I maybe know how you feel. It happens to me to, but what I'm going to do is to help porting some of my favorite applications from kde3 to kde4, I will try to help in the development of Kmess2.

I dont have enough time right now and I will begin by reading some tutorials about kde4 and QT4. Myabe you can do something similar if you like kde3 applications, if not you can helop any other projects smile

Opensource will always need you.


ISC - Ignacio Marmolejo
ArchLinux & GNOME User.

Offline

#17 2008-08-29 15:07:54

DBerest
Member
Registered: 2006-02-15
Posts: 46

Re: New to programming, don't know what to program...

Also, you can have a go at http://www.pythonchallenge.com/

it doesn't seem to be worked on at the moment, but there are some interesting ideas in there

Offline

#18 2008-08-29 23:17:45

lang2
Member
Registered: 2006-02-10
Posts: 386

Re: New to programming, don't know what to program...

Programming on Linux is basically PC programming, which, IMO, is a suitable task for high level language such as python. One can argue that C++ with QT is high level as well. If you want to go deep and program for the kernel, driver, hardware, etc, you need to learn C and learn it well. Maybe some assembly as well. Just my 2 cents.

Offline

#19 2008-09-13 23:07:30

dante4d
Member
From: Czech Republic
Registered: 2007-04-14
Posts: 176

Re: New to programming, don't know what to program...

When I was using Window$, I spent lot of time playing with OpenGL and graphics. It was very easy to use Visual Studio and compile stuff. I was quite happy with that. Then I found Eclipse and Java with refactoring. From that point of view, I'd say Java is maybe best to learn programming, because Eclipse gives you lots of help with code refactoring, completion, builtin help... And it doesn't have obscure (complex, ambiguous) syntax like C/C++ and lots of scripting languages.

If you want to learm programming idoms, I'd say Java, many schools use it and there are lot's of examples of common object design patterns.

pauldonnelly wrote:

Have you got Stroustrup's book? Don't feel bad if that one loses you—it's about as clear and well-designed as C++ itself.

lol

Offline

#20 2008-09-18 21:14:02

B15HOP
Member
From: Australia
Registered: 2005-02-10
Posts: 138

Re: New to programming, don't know what to program...

I find that ironic that people say C is way too much. I found python a headache and couldn't wait to go back to C!


"The ecological crisis is a moral issue."

Offline

#21 2008-09-19 01:32:26

dav7
Member
From: Australia
Registered: 2008-02-08
Posts: 674

Re: New to programming, don't know what to program...

That's an excellent example of how people are different. Some people will like low-level complexity, and others need to be able to use a higher-level language to keep a clear head and make their goals reachable without failing and giving up for whatever reason. For example, one might find C or similar languages employ too many lines of code to reach a goal and therefore they find these languages impractical for their use.

Others prefer being able to manage the system at the lowest of levels, know exactly what's going on, manage memory themselves, and enjoy hand-writing code optimizations into their software to keep fellow developers up all night figuring out what goes where tongue

So it's just a matter of taste, kalinatek: you'll find the language that's right for you eventually - you just have to find it. I can personally recommend you take a look at the common "3 Ps", Perl, Python and PHP, but also peek at Ruby, REBOL/ORCA (same language, ORCA is the free but not as extensive implementation, but REBOL is free for non-commercial use), Haskell, Lua, and so on. Each language has its own pitfalls and the little issues it solves.

At the end of the day, code is code no matter the language it's written in - it tells the system to do something. Different languages are simply used to achieve different goals. Find what works for you *now* (ie what your brain can understand without difficulty), and learn it until you like it.

-dav7


Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.

Offline

#22 2008-09-19 17:58:32

cschep
Member
Registered: 2006-12-02
Posts: 124
Website

Re: New to programming, don't know what to program...

All very good advice. One thing I would emphasize, only because it was a trap I fell into during my schooling, is try to focus on learning languages instead of tools. Sometimes I feel like my CS degree is a degree in MS Visual Studio. I had a highly Microsoft focused education. That's what you get for living in WA state I guess. My strongest language coming out of school was C#. Not terrible, but as I started to learn what was more important to me (open source, freedom, etc...) I was bummed that if I was to get a job that was in line with these beliefs, I'd have to do some re-learning quickly, or take a lower level position.

Focus on learning open source languages. They are tested, proved, and universal.

No one here brought up closed source languages, but I just felt like throwing it out there. My university taught C++, which is definitely open source, but I just feel like I got the windows version of it. Disappointing as I look back on it.

I hope you found some good inspiration, and found a fun problem to tackle. Best way to learn.

Offline

#23 2008-09-19 19:00:45

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: New to programming, don't know what to program...

I suggest C...   I dont like the idea of an interperter running my code.
Also, if you know C good enough, most scripting languages will become easy to read and understand.
How about you think about a GUI application that you want and dont have, and implement it in C/GTK, it wont be easy, but the bet way to learn.

Offline

#24 2008-09-19 22:14:36

pauldonnelly
Member
Registered: 2006-06-19
Posts: 776

Re: New to programming, don't know what to program...

daf666 wrote:

I suggest C...   I dont like the idea of an interperter running my code.

Why not some other compiled language, then?

Offline

#25 2008-09-20 12:57:56

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: New to programming, don't know what to program...

pauldonnelly wrote:
daf666 wrote:

I suggest C...   I dont like the idea of an interperter running my code.

Why not some other compiled language, then?

When the Linux kernel will be rewritten in C++ I will recommend it wink

Offline

Board footer

Powered by FluxBB