Programmer's Wiki

Hi all.

This page is intended to be global for the whole [[1]] channel. So be bold and edit.

The Questions[]

How do I talk on the channel?[]

In order to talk on ##programming, connect your IRC client to the irc.freenode.net server, type /join ##programming and press enter. It is a good idea to register your nickname with the Freenode network (see /msg NickServ HELP). This URL may work for you: irc://irc.freenode.net/##programming .

Freenode also provides a web interface here: http://webchat.freenode.net/ . For more information about viable IRC clients see:

What is considered on-topic on ##programming? What is considered off-topic?[]

Well, we try to concentrate on programming and related Computer Science-related discussions, but sometimes discussions diverge into something different and we're OK with it. Some things that are on-topic:

  1. Getting help with specific programming languages technologies, including those that have dedicated channels on Freenode and/or elsewhere, including but not limited to Java, C#/.NET, PHP, Visual Basic (Classic, .NET, Visual Basic for Applications, or whatever), C++, C, Python, Perl, Ruby, JavaScript or whatever. We do not intend to imply that we endorse using any of these technologies (and different members of the channels may have different opinions of them) but we still support them.
  2. Help with someone's programming or CS homework is also on-topic on ##programming. Although it is considered unethical to write your homework for you, you can still get help.

The reason we agree to discuss such things as discussing such things help the channel grow, make the content of the channel more lively and interesting, and because the traffic generated by them is still not overwhelming enough for us to consider a different policy. (Also see what “Joel on Software” said about Internet forums becoming too fragmented.).

Some discussions that are explicitly off-topic:

  1. Discussions about global/national politics — these tend to deteriorate very quickly, and many people find them annoying. If you still wish to discuss them, head over to #politics.
  2. Personal insults, Ad hominem attacks, sexual/racial/political harassment, etc.
  3. Illegal activity (as forbidden by Freenode policy).

None of these things will get you banned immediately, but you will be warned and told to stop, and devoiced only if you persist.

Which Integrated Development Environment (IDE) or Text Editor Would You Recommend?[]

We get asked this question a lot. The answer is a bit long. First of all, it is likely that following editing mechanisms will not be adequate for editing code:

  • Rich-text editors includings, but not limited to, Microsoft Windows WordPad (formerly known as Windows Write, we were informed that it has a text editing mode, but see below), word processors such as Microsoft Word, OpenOffice.org/LibreOffice Writer, WordPerfect, AbiWord, etc. and WYSIWYG (= "What you see is what you get") HTML editors. These are not suitable for editing code.
  • Limited text editors such as Microsoft Windows Notepad (see http://www.notepad.org/ for a very fun link about it ), or Pico which are aimed for casual editing of text documents. More capable text editors such as Notepad++, Notepad2 and GNU Nano, should be OK.

These editors may still be useful if that's all you can use, but if you can afford to install and/or use a more capable text editor, it is by all means a good idea.

Otherwise, asking the channel about the most recommend text editor will end up in people giving you their own preferences (which may have involved many years of trying different solutions, and some time of studying their existing preference and getting accustomed to it). Some links to get you started:

Note that many decent text editors and IDEs are open-source, free-of-charge and cross-platform (Windows, Mac OS X and Linux/UNIX), so you don't have an excuse to download one, install it and use it.

I want to learn programming? Which language should I start with?[]

Different people will give different answers when asked that. Most people on ##programming believe that something like the Python programming language would be a good start. Python is a popular, useful, open source, and cross-platform (runs fine on Windows, Linux and Mac OS X and on many other less common platforms), that is not too hard to learn and get your feet wet with. Some resources to learn Python are:

Here are some resources for learning other programming languages, whether as a first language or after knowing some other languages:

How should I do binary Input/Output properly?[]

Some people would naïvely assume that writing a C struct directly to a file would be a good solution for outputting it to disk. That is far from the case, however. The representation of a struct in memory is subject to many system-dependent factors, such as:

  • Endianness - also referred to as byte sex, this determines whether bytes are stored in memory with the lowest byte first, or the highest one.
  • Padding - for effiecency reasons, compilers tend to place empty spaces between the fields of structs. The amount of such space is not standardised, and varies between systems, compilers (and even compilation options can affect it).
  • Integral data types and pointers can vary in their nominal size. I.e: an "int" can be 16-bit, 32-bit, 64-bit, a long can be 32-bit or 64-bit, etc., which is system-dependent.

The O’Reilly book Porting UNIX Software (available for purchase or download under a Creative Commons licence on the link), goes to further depth about these and many other UNIX portability issues.

In any case, the best way to mitigate this problem portably and safely, is to write (and later read) every field (and sometimes every byte within) to the disk or network. You should be able to find some mechanisms inside portable libraries to do that.

What are some best practices in programming that I should adopt?[]

First of all, we should note that many best practices may still be controversial to a small or large extent, despite being very common in the industry. We also don't expect a beginning programmer who writes some sample programs to immediately employ all the best practices that go into developing mission-critical software on which lives are dependent.

But here goes with a grain of salt:

  1. Use a good version control system. For more about version control systems and the motivation behind them see the “Better SCM” Site and a related section from “Perl for Perl Newbies” (which is not exclusively limited to Perl) and Sawyer X’s talk about source code management systems.
    • Please don't give the usual cliches that you don't need a version control system if you’re only one person or that the project is not large enough to warrant it. You probably do.
  2. Write Automated Tests. See Test-driven development and other resources.

For more information consult the essay “What Makes Software High Quality?” and the Perl Beginners’s Site “Perl Elements to avoid” (which while focusing on Perl has a lot of good advice related to other programming languages).

What is the best programming language?[]

We sometimes get asked this question, and the answer is simple: there is none. Different languages have different strengths, weaknesses and often trade offs. You may wish to read the blog post “(Why) Your Programming Language Must Suck” for a short coverage of some of the important trade-offs a language design will have, and why no one will be happy with it all the time.

Even if we settle on a certain amount of preferences, then you may run into other factors that influence which language you may prefer:

  1. Should the program run as quickly as possible? Or do you want to optimise for developer's time?
  2. Is low memory consumption critical?
  3. Should the language be portable to various operating systems and/or CPUs? Or is it OK if it only runs somewhere specific?
  4. Should the language have an open-source implementation?
  5. Should the language have a large user base, and provide quick and useful support?
  6. Should bugs be addressed and fixed quickly in the implementations?
  7. Should the language have any particular built-in features that you desire?
  8. Should the language have an extensive library of extensions and APIs that can be reused?

Etc. If you tell us what your needs are, we can help you with recommendation.

Note that some of the channel members happen to like a certain programming language in particular and tend to constantly recommend it to other people. Furthermore, you may run into language wars where one or more languages are bashed as awful languages by participants in the channel. That does not mean these languages are necessarily good or bad or suitable for what you wish to do.

What are good resources (including books) to learn about algorithms?[]

Here are some resources for learning about algorithms:

There's also a channel called "#algorithms" on Freenode and, naturally, you can discuss algorithms on ##programming, as long as you perform due diligence.

I have an awesome idea for a great project (probably a game) and I want people to help me…[]

First of all, we appreciate your enthusiasm, but you should realise that most of us have better things to do than help you (even if they are unemployed), and so you should offer money (and we don't mean a share of the profits.). If not, you are quite unlikely to recruit anyone.

If you cannot offer money, please consider learning the necessary skills yourself (see the above questions) and starting work on your own. If you make your project open-source, and publicise it, then other people may eventually join you, and help you if they find it interesting.

What is the difference between "scripting" languages such as Perl, PHP, Python or Ruby and "Industrial-strength" Languages such as C, C++, Java and C#?[]

Many people have issues with calling dynamic languages, with dynamic typing and those that are of somewhat more open-source nature such as Perl, PHP, Python and Ruby as scripting languages. See:

The problem with calling them that is that it is that while they allow for getting small and simple things done quickly and easily, large scale projects (100,000s to millions lines of code) have been written in them and are still maintained without any show-stopping difficulties. That is not to say that these languages do not have their downsides, but they still do not preclude general-purpose, and/or large-scale programming.

Furthermore, if we consider Perl/PHP/Python/Ruby/Tcl/Lua/etc. as “scripting languages” and C, C++, Java and C# as “industrial strength” where does Common Lisp fit in? Where does Scheme? Where do Haskell and OCaml? What about the various dialects of Basic? Fortran? COBOL? It seems that the classification of languages as "scripting" vs "industrial strength" is more of that of public perception and marketing as opposed to actual qualities.

On the other hand, we do not wish to claim here that C, C++, Java and/or C# are necessarily bad languages, or that you should not study them or refuse job offers that involve coding in them.