4

Next semester (starts in just under 5 weeks), I'm taking System Programming and OOD concurrently. Apparently SP centers on working in C on Linux, and I only have Java and Python experience, so I am a little nervous about this.

For those of you who've taken these at an university, what should I look out for?

I've already taken Computer Organization which included an overview of Assembly. With the exception of implementing loops in assembly, I ranged from B+ to A- in the assembly projects. Building circuitry was another story, however.

2
  • Sounds like SP needs a C prerequisite course? Don't be nervous, get a book on C or ask the professor how much you need to know.
    – JeffO
    May 11, 2012 at 15:27
  • @Jeff O: re: "a C prerequisite course" If your school has a course that counts for credit on a specific language then it isn't much of curriculumn. While in college you should expect to learn at least 7 or 8 different languages all of which you need to learn as a side item to the main topic of the class. I would find it hard to believe that a there's a credible college who thinks having a class dedicated to learning a programming language is worthy of college credit.
    – Dunk
    May 11, 2012 at 18:45

5 Answers 5

4

Well, exactly what you're going to need wil depend on the class, though some generalities will likely hold. I'd suggest getting a C book intended for Java programmers. It's likely to point out the major pitfalls and help you transition.

The biggest items that you're going to worry in C that you don't really worry about in Java are pointers and memory management. Java references are technically pointers, but they're seriously dumbed-down pointers, and from what I've seen, Java programmers don't really see them as the pointers that they are and often have some trouble dealing with pointers initially. Going hand in hand with that is the fact that you won't have a garbage collector, so anything that gets allocated on the heap will not only have to be manually allocated, but you'll have to manually de-allocate it when you're done with it. So, you're going to have to become familiar with malloc and free. You also aren't going to have classes, and structs in C can't have functions in them, so you don't generally program in C in an object-oriented manner. That may or may not be a big deal for you. It does mean, however, that what you'll be learning in your systems programming course and your object-oriented design course are likely to be very different.

OOD should be more of an extension of what you know, teaching you how to better program in an object-oriented manner. Systems programming, on the other hand is much more about getting down and dirty and will be much more low-level in what it deals with. Both are really important to being a good programmer though.

Without knowing your exact skill set and experiences and without knowing the exact courses, giving more detailed advice would be difficult, but primarily, the issue is likely to be in dealing with how C doesn't doesn't manage things for you and doesn't try and keep you safe from yourself. You will have to be more careful programming in C than you would be in Java or Python. There's plenty of stuff that's perfectly legal C which would be illegal many other languages and could surprise you. The main things to be concerned about though are pointers and manual memory management.

2
  • The dept library has a C beginner book that I'm gonna take for break. I did come across a pre-ANSI K&R book, would that still be worth checking out?
    – Jason
    Dec 2, 2010 at 3:02
  • It's pretty much the original book on C, and it's definitely classic, so it would be a good one, but I do think that it's outdated in some respects, so while it's good, that's something to be aware of. The advantages of a book targetting Java programmers in particular (if you can find one) is that it'll be able to point out the places where you're likely to run into trouble. But that's not a requirement by any means. It would just be useful. Dec 2, 2010 at 18:07
2

Have no fear - it's only code

Java and C have very similar syntax coming from the same family of languages. As others have said, your biggest hurdles will be learning pointers (hint: they're just indirection), and memory management. Suddenly all those arrays you've been declaring in your Java have to be disposed of. Like any subject, once you've twigged what it's all about then it suddenly becomes straightforward.

Overall, it's more about learning the environment you'll be working in rather than some language syntax and constructs. Linux programming is very different to general Java programming. One relies closely on the operating system APIs, all C pointers and structs, and the other is generally much simpler because it's at a higher level of abstraction, there's just a lot more of it.

Developing the mindset

Perhaps the way for you to approach this is to maintain two working environments as virtual machines (Parallels or VMWare come to mind). One is purely for developing C code, the other for Java and no mixing them up. You could use different themes for the desktop to reinforce the different mindset (black for C, blue for Java or whatever). Each time you come to work in one or other environments you have many visual cues to promote the appropriate mindset you need to get the work done.

3
  • I already run a Ubuntu VM on my desktop at home, but my laptop is not VT-capable. I could set up my workspace on the school system to do that for me, tho. Thanks!
    – Jason
    Dec 2, 2010 at 3:06
  • Rather than a VM (which is probably too sophisticated for this on reflection) perhaps just have 2 user accounts. The key is to maintain the visual cues to trigger your mindset to make context switching less arduous.
    – Gary
    Dec 2, 2010 at 9:12
  • Have no fear - it's only code: I love that. It seems like people get so scared over things they haven't dealt with but when you get into it--in general it's just code. I guess the only exceptions I've seen is stuff that has a lot of "Magic stuff" to make it work, patterns you have to follow or code you have to copy without understanding--you won't see much of that in school.
    – Bill K
    Dec 20, 2011 at 21:02
0

I always found it difficult to take classes with opposing points in the same semester.

If your systems class is very low level you will likely need to do some very non-OO things.

If you can keep the two straight though it might be a good time to learn the advantages of each approach.

My personal experience with OOD classes were that you needed to go to a nearly theoretical level of abstraction to get full credit and that the systems classes were usually more theory than code because it was not reasonable to build much of an OS feature in a single semester.

2
  • Interesting point, but I'd think that if he's diligent, the juxtaposition between the two may help him actually observe the differences early and go forward without a bias for thinking one way or the other.
    – Nicole
    Dec 1, 2010 at 23:49
  • Good point here.. but I did take Comp Org with Intro to Algorithms in the same semester, and didn't have a problem switching my train of thought between Java and assembly. The thing that will give me fits is I'm booked for Calc A along with these two classes... on the same day. Interesting, this semester is shaping up to be.
    – Jason
    Dec 2, 2010 at 3:01
0

If you haven't ever done any C or assembler, be prepared to understand Java and Python at a whole new level. Even though you already have some comp sci survey class that told you how memory and references work you almost certainly do not fully grok it.

Go into to it with an open mind, and an open heart. C is a beautiful thing, but not at all in the same way that Python is beautiful. It is beautiful more in the same way that a trench knife is beautiful.

1
  • With the exception of loops, I pretty much aced the assembly portion of Computer Organization and I understand that C is basically a more readable version of assembly.
    – Jason
    Dec 2, 2010 at 3:07
0

For Systems you have to go low. You have to understand how fundamental stuff pointers, memory management, registers, system calls, even assembly and system architecture etc work. OOPS is at higher level of abstraction. So you will have to continuously switch your perspective or rather frame of abstraction. As long as you keep this in mind, I don't think it should be that difficult.

Not the answer you're looking for? Browse other questions tagged or ask your own question.