Beginning programmer, needs advice.
February 3, 2010 10:53 AM Subscribe
How hard would it be for me to write a simple chat room program, that could be used at work for people in my dept to talk to each other? I realize I could probably just download something (like Google Talk, for example), but I'd like to learn to program and this seems like it would be a simple enough project to start with.
I have little to no experience. I took an Intro to Programming and Unix shell scripting classes in school (I went to a tech school for networking), and they both came easily to me, but I've never applied what I learned in those classes in any practical way. I've played around a little bit with Python, but then a friend told me that I'd be better off learning Java. What would be the best language for me to try to learn, in regards to the fact that I'm a beginner and what would be best for my project. I've started reading this Java tutorial, but any other suggestions/links/advice would be much appreciated!
I have little to no experience. I took an Intro to Programming and Unix shell scripting classes in school (I went to a tech school for networking), and they both came easily to me, but I've never applied what I learned in those classes in any practical way. I've played around a little bit with Python, but then a friend told me that I'd be better off learning Java. What would be the best language for me to try to learn, in regards to the fact that I'm a beginner and what would be best for my project. I've started reading this Java tutorial, but any other suggestions/links/advice would be much appreciated!
It depends on how simple you want to go really. Many many years ago I wrote a simple VB application which displayed the contents of a text file located in a world readable and writeable location on a server.
Terribly inefficient and hughely insecure but it could be run by anyone, didn't need a server and didn't need any authentication. In a locked down corporate world, it worked really well.
If you want to do it properly then you need to consider writing a server to handle passing messages around and then a client to display your friends, their status and the messages to and from them.
In short, the first option is very easy, simple to write and introduces basics such as file locking.
The latter is a lot more complicated and will take many hours of development as you'll need to learn sockets, handling multiple simultaneous connections, authentication and message passing.
Finally I forgot to mention that you'll have to have somewhere to run the chat server which has a static ip address (so clients always know where to connect) and can run 24/7.
posted by mr_silver at 11:13 AM on February 3, 2010
Terribly inefficient and hughely insecure but it could be run by anyone, didn't need a server and didn't need any authentication. In a locked down corporate world, it worked really well.
If you want to do it properly then you need to consider writing a server to handle passing messages around and then a client to display your friends, their status and the messages to and from them.
In short, the first option is very easy, simple to write and introduces basics such as file locking.
The latter is a lot more complicated and will take many hours of development as you'll need to learn sockets, handling multiple simultaneous connections, authentication and message passing.
Finally I forgot to mention that you'll have to have somewhere to run the chat server which has a static ip address (so clients always know where to connect) and can run 24/7.
posted by mr_silver at 11:13 AM on February 3, 2010
Best answer: Instead of rolling your own, I recommend you take a look at Openfire Server by Ignite. It's extremely robust, stupidly easy to setup and administer, runs on the Jabber protocol (same as Google Talk), it's free, and best of all the (Java) code that makes it run is entirely open.
Going this route would allow you to get a solution in place for work quickly and you'd have the source available so you could learn how it all works at your own pace while you get up to speed on Java.
posted by word_virus at 11:16 AM on February 3, 2010
Going this route would allow you to get a solution in place for work quickly and you'd have the source available so you could learn how it all works at your own pace while you get up to speed on Java.
posted by word_virus at 11:16 AM on February 3, 2010
Your friend is wrong. I make most of my money on Java, but every time I have a choice, I choose Python. And it's definitely better to learn on. Besides, if you're just learning to program, you should absolutely choose the highest-level language available. Once you know how to program, learning a new language only takes about a week of work.
Anyway, to answer your real question: a chat program is second to third year compsci homework. Second year if it runs on the console, third year if it requires a GUI. Network programming is pretty tricky, to the point that lots of supposedly competent programmers can't even kinda do it.
I'm not saying that to discourage you. By the time you finish it, you'll know a lot about programming. But it's not a trivial program.
posted by Netzapper at 11:16 AM on February 3, 2010
Anyway, to answer your real question: a chat program is second to third year compsci homework. Second year if it runs on the console, third year if it requires a GUI. Network programming is pretty tricky, to the point that lots of supposedly competent programmers can't even kinda do it.
I'm not saying that to discourage you. By the time you finish it, you'll know a lot about programming. But it's not a trivial program.
posted by Netzapper at 11:16 AM on February 3, 2010
Echoing netzapper. How much of this you implement yourself, versus employ a library to do for you, will determine the difficulty of the project. In python I'm sure there are libraries that can do most of the trickier bits of network code for you, but then you aren't writing much but the GUI.
posted by phrontist at 11:24 AM on February 3, 2010
posted by phrontist at 11:24 AM on February 3, 2010
What would be the best language for me to try to learn, in regards to the fact that I'm a beginner and what would be best for my project.
Python and Java are both full-featured modern languages with good networking libraries and tons of learning resources online, so they are both good choices. I would suggest for learning your first language to just pick one that you feel comfortable with and go with it. The general programming skills that you learn as a beginner are directly applicable to pretty much any language, so if you want to switch to learn another language later once you get some more experience it's relatively easy to do. In fact, I think being a novice in several languages is more useful than having a moderate level of experience in one language because it gives you more options and exposes you to more programming concepts.
I realize I could probably just download something (like Google Talk, for example), but I'd like to learn to program and this seems like it would be a simple enough project to start with.
I agree with Netzapper, this is probably too ambitious for your first app, especially if you don't already know the details of how network communications work. A better first project might be to automate some task that you have to deal with all the time (like renaming files in a specific way) or writing something less complex but useless like an app that pings another machine's IP address.
posted by burnmp3s at 11:26 AM on February 3, 2010
Python and Java are both full-featured modern languages with good networking libraries and tons of learning resources online, so they are both good choices. I would suggest for learning your first language to just pick one that you feel comfortable with and go with it. The general programming skills that you learn as a beginner are directly applicable to pretty much any language, so if you want to switch to learn another language later once you get some more experience it's relatively easy to do. In fact, I think being a novice in several languages is more useful than having a moderate level of experience in one language because it gives you more options and exposes you to more programming concepts.
I realize I could probably just download something (like Google Talk, for example), but I'd like to learn to program and this seems like it would be a simple enough project to start with.
I agree with Netzapper, this is probably too ambitious for your first app, especially if you don't already know the details of how network communications work. A better first project might be to automate some task that you have to deal with all the time (like renaming files in a specific way) or writing something less complex but useless like an app that pings another machine's IP address.
posted by burnmp3s at 11:26 AM on February 3, 2010
If you have any interest in learning a web scripting language like PHP, there's a nice tutorial here on using PHP and Javascript to build a chat server. It uses a MySQL database and needs a web server, but it neatly avoids all the compex networking stuff.
It's not what I'd choose as an intro to PHP and MySQL, but it's reasonably simple to follow once you've done a little preliminary learning.
posted by le morte de bea arthur at 11:30 AM on February 3, 2010
It's not what I'd choose as an intro to PHP and MySQL, but it's reasonably simple to follow once you've done a little preliminary learning.
posted by le morte de bea arthur at 11:30 AM on February 3, 2010
There's a wide range of difficulty here:
posted by demiurge at 11:30 AM on February 3, 2010
- Writing a simple IRC client just to show that you can: Easy
- Writing a fully featured, secure, as good as what's available, XMPP client from scratch: Very Difficult
- Writing a usable XMPP client using existing XMPP libraries: Medium
posted by demiurge at 11:30 AM on February 3, 2010
Write it in C# (mono or .net). You'll find a lot of sample code, and as long as you understand a little bit about networks and/or TCP/IP, you won't have too much trouble.
posted by blue_beetle at 11:49 AM on February 3, 2010
posted by blue_beetle at 11:49 AM on February 3, 2010
I did this when I was teaching myself to program! The first version was probably only my 3rd or 4th program ever -- it was a Python CGI-based web page that showed the contents of a file, let you type a message to add to the file, and refreshed itself every few seconds. The second version was after I had been coding for a year or so, and used network sockets and a command-line interface (also written in Python).
Don't worry too much about which language to use, just pick one you're comfortable with. I'd avoid using any complicated libraries though -- you could spend a week learning a messaging library, while learning how TCP sockets work is less effort with greater benefits in the long run.
It's not an easy project, but it's a great way to learn. Just get started and try for yourself!
posted by miyabo at 12:36 PM on February 3, 2010 [1 favorite]
Don't worry too much about which language to use, just pick one you're comfortable with. I'd avoid using any complicated libraries though -- you could spend a week learning a messaging library, while learning how TCP sockets work is less effort with greater benefits in the long run.
It's not an easy project, but it's a great way to learn. Just get started and try for yourself!
posted by miyabo at 12:36 PM on February 3, 2010 [1 favorite]
As has been pointed out already, there are several libraries that make it easier to connect to a Jabber server from a Python program, if you want to use them.
Rather than writing a chat client, you could write a chat bot. If you leave it running, you can let friends play with it. And perhaps you could implement some features that are useful to your group (such as stating the date of upcoming meetings).
posted by James Scott-Brown at 1:34 PM on February 3, 2010
Rather than writing a chat client, you could write a chat bot. If you leave it running, you can let friends play with it. And perhaps you could implement some features that are useful to your group (such as stating the date of upcoming meetings).
posted by James Scott-Brown at 1:34 PM on February 3, 2010
Response by poster: Thanks for all the helpful responses. I had a feeling this would be over my head (although FWIW I know networking but not really from the application side), but I get bored easily with "number guessing-game" type projects so I thought maybe I could do something a little more interesting and solve a real problem at the same time....oh well.
Something like what word_virus mentioned is probably my best bet. We use Google Talk, but I don't like how in order to set up a chat room, as opposed to IM's, you have to create the room, then send a link to everyone to invite them. I'd like something that you can have in your taskbar, and join and leave as you wish.
posted by cottonswab at 1:48 PM on February 3, 2010
Something like what word_virus mentioned is probably my best bet. We use Google Talk, but I don't like how in order to set up a chat room, as opposed to IM's, you have to create the room, then send a link to everyone to invite them. I'd like something that you can have in your taskbar, and join and leave as you wish.
posted by cottonswab at 1:48 PM on February 3, 2010
Everyone here has given great and sensible advice. But I will just say that any computer-related skillz I possess all hail directly from posing myself questions/challenges like the one you just have.
Yes, it's over your head. Yes, it's a bit silly. Yes, you should absolutely take a crack at it!
And I will furthermore tack on a quote from a knitting book which applies here (and many other places in life),
Yes, it's over your head. Yes, it's a bit silly. Yes, you should absolutely take a crack at it!
And I will furthermore tack on a quote from a knitting book which applies here (and many other places in life),
"No project is too ambitious if you crave the result badly enough."posted by ErikaB at 3:11 PM on February 3, 2010 [2 favorites]
Looking back at the responses, I think a bot project like what James Scott-Brown suggests is a great idea. You'll get something up and running quickly, but you can add stuff to it to do whatever you want.
posted by demiurge at 5:07 PM on February 3, 2010
posted by demiurge at 5:07 PM on February 3, 2010
« Older Common freshman course on the history and culture... | I have questions about getting an IUD placed. Newer »
This thread is closed to new comments.
posted by shothotbot at 11:08 AM on February 3, 2010