Ramblings on C language

*****************other users advice on learning  C***********************

******A lot of people try to tackle C programming without first understanding what a processor is or how it operates (at a detailed level), and they’ve certainly never written any machine code or assembly language. Once you’ve done that a couple of times, pointers instantly make sense. But its just not necessary in a lot of new languages, so its just not taught.

******It seems to me that before learning any programming language you should learn the basics of CPU design. Things like registers, memory, stack, I/O etc. Having a grasp of those would certainly help in understanding all language concepts.

*****The thing with pointers is that they are literally the metal of the computer; you can’t get much lower, without getting into assembly and dealing with registers, etc. It might be confusing for people who learn pointers just dealing with simple objects, e.g.:

int x1 = 10;

int *x2 = (int *)malloc(sizeof(int));
*x2 = 10; free(x2);

Why go through the trouble of dealing with pointers, de/allocation, casting, and dereferencing here, especially if you learned some higher level language first? If your first language is C or assembly, then yes, your mental model of how memory works is probably much clearer than that of most freshmen in their intro C.S. class, whether they did any programming in HS or not.

With respect to python, it really is touted as a batteries included language; the smtp libraries are obviously not part of the language spec or something, but you would have to really go out of your way to get a python version without the required libraries. In the worst case, you then would use easy_install to get them.

Regardless, I think it would be difficult to make the case that C has a lower barrier of entry or easier learning curve than Python (or most newer languages). Yes, if you are CS student you need to understand memory, etc, at some point. For whatever reason, pointers ARE hard for most people when they are first encountered. The first exposure to programming is almost always “hello world” and you don’t really need a deep understanding of C to start expanding this concept. Even allocating strings can be done without too much thinking. It is when you start writing functions that alter the arguments, or using arrays, that you can’t really fake it any longer. After working with pointers daily for years, I think we take for granted what they are and how they are used; it just takes time to “click” for most people, I guess.

************Can someone please tell me, what exactly is so “difficult” about C?

Let me see… String manipulation? Manual memory management? The cryptic compiler messages?

Note that these things are not difficult for YOU, they are difficult for the novice programmer. After doing something for 20 years, of course it will be easy!

**********C programming is not significantly “harder” than other programming languages. It’s just more tedious. That is, there are a lot more manual steps you have to perform. I suppose if you have trouble keeping all those details straight without getting stuff wrong, then that tedium does translate into added difficulty.

And FWIW, I’m not trying to defend C as being just as useful/powerful/etc as other languages. I myself have grown really tired of writing everything in C, and have actively sought out other languages that free me from writing all that repetitive code. This is especially true when it comes to writing user interfaces. I spent the first 8 years of my career creating Windows GUI apps, almost entirely in straight C, writing directly to the Win32 API. Pure Petzold style. And not surprisingly, I grew really tired of doing all that repetitive code, even when all I needed was a simple GUI with maybe a main window and a couple dialog boxes. I’m actually a strong proponent of languages like Python that free programmers from having to spend so much time on such mundane things as allocating memory, handling scrollbar event messages, etc.

But, I still believe that any professional programmer worth his/her salt ought to not shy away from learning things like pointers, etc. For people in other fields that only use programming as a tool, and need to be able to focus on their core work, I think choosing a language that lets them avoid stuff like that entirely is a good decision. I don’t have any problem, for example, with a scientist not wanting to have to learn about pointers just to be able to do some matrix multiplication, as is the case with another commenter who replied to me.

***Video game development requires the highest level of math ability. You will need to take Calc 1, Calc 2, & Calc 3. Physics with Calculus, & Differential Equations. I’m sure there are other scary courses that I’m overlooking.

*******C Language and GUI Development**************

*hello everyone. Can somebody tell me the GUI development library that people would usually use to develop ubuntu applications?

*There are quite a few GUI frameworks available for Linux. There is WXwidgets, GTK, QT, fltk, and a few others. Google “GUI frameworks for linux” to start.

*Which of them is most popular ? Which of them do companies expect us to know ?

*Companies will expect you to know the framework they are using, even if they are the only ones using it.

As for which is most popular? I would suggest familiarize yourself with several of the frameworks. This way you increase your prospects.

***Define “popular”
– used by the most programmers
– used in the most applications
– ported to the most operating systems
– used by the most users.

A single programmer, using their own toolkit, who writes one killer app that everyone simply has to use it might score option 3. But does that make it the most popular?

> Which of them do companies expect us to know ?
The first thing companies want to know is if you can program.

Then have some basic understanding of the concepts behind GUI toolkits. Many of them share common themes.

The rest is bookwork.

Hell, I can barely recite about 10% of the ANSI-C API. But what I do know is what is there, and where to find out the detail (aka, the manual).

So memorising vast swathes of some GUI toolkit API will just make you a “manual on legs”, not necessarily a competent programmer.

**Also, the more frameworks you familiarise yourself with through actually developing with them, the easier it is to get to grips with a new one.

******************************************************************************************************************************
****How can I do GUI programming in C(Windows)?

A C compiler itself won’t provide you with GUI functionality, but there are plenty of libraries for that sort of thing. The most popular is probably GTK+, but it may be a little too complicated if you are just starting out and want to quickly get a GUI up and running. or try win32.

**************************************************How does a GUI Framework work?

**********I have been all over the web looking for an answer to this, and my question is this: How does a GUI framework work? for instance how does Qt work, is there any books or wibsites on the topic of writing a GUI framework from scratch? and also does the framework have to call methods from the operating systems GUI framework?

*********A GUI framework like Qt generally works by taking the existing OS’s primitive objects (windows, fonts, bitmaps, etc), wrapping them in more platform-neutral and less clunky classes/structures/handles, and giving you the functionality you’ll need to manipulate them. Yes, that almost always involves using the OS’s own functions, but it doesn’t HAVE to — if you’re designing an API to draw an OpenGL UI, for example, most of the underlying OS’s GUI stuff won’t even work, and you’ll be doing just about everything on your own.

Either way, it’s not for the faint of heart. If you have to ask how a GUI framework works, you’re not even close to ready to design one. You’re better off sticking with an existing framework and extending it to do the spiffy stuff it doesn’t do already.

****Building a GUI framework isn’t a 1,2,3 process.

All I can say is, take a look of some of those open source IDEs, like Netbeans source code for example.

Look inside the code, and then build the whole IDE.

***********I haven’t used NetBeans but I looked at a few screenshots and it appears to just use Swing – I don’t think this would give a good example of developing a UI framework since it simply uses an existing one, not implements its own. GTK+ (gtk.org) would be a good example.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: