Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

2 programming questions

  1. Jul 14, 2012 #1
    So I'm a Mathematics major who has been trying to become a good programmer for over a year now. The most recent languages I've tried to tackle are C++ and JavaScript. I went through C++ Primer, Fourth Edition during Christmas break and then went through it again several times, along the way taking notes and creating some pointless programs (For example, one that scans a long text and keeps a statistical tally on certain aspects of grammar and word choice by the writer. I'm trying to build the case that Bill Ayers ghostwrote "Obama's" book Dreams from My Father. Anyways ...). I feel like everything is clicking now. Rather than wondering Why is this the way it is???, I understand everything in terms of memory management and such. I'm also going to be taking some more classes that use languages I'm unfamiliar with, such as R or Python. I'd also like to learn C.

    Now to my questions.

    Question 1: It's called "C++ Primer", implying, by definition, that it's a "book of elementary principles" (http://dictionary.reference.com/browse/primer). Is that really so? I've looked through all the required computer science courses at my school and none of them dealt with any programming concepts that aren't in this book.

    Question 2: My buddy who recently began programming microprocessors has on his resume "Programming Languages: C/C++, Forth, Java, AVR/6502 Assembly, Verilog, Visual Basic". When I asked him whether he really is fluent in all those languages (which seems impossible from how I interpret the word "fluent"), he said no, that he's used them all at some point, even if just for a single class at the university, and that all he's done with C++ is go through a book that introduces C++ by showing how to make simple console games. The only one he knows well is C, which he uses at work; he'd have to pull out a book and recall all the syntax before using the others. Is he being disingenuous on his resume, or is common practice to claim knowledge of a programming language because you have some grasp of it and could easily master it if prompted?
  2. jcsd
  3. Jul 14, 2012 #2


    User Avatar
    Science Advisor

    Hey Jamin2112.

    For your first question, I can't say whether or not the language is misleading or not, but I will comment later about some stuff I recommend that you do to become a better programmer (I used to be one).

    For the second question, if he really has experience in the above he is not being disingenuous at all. It's common to forget syntax and things like that, but if he has the real experience, he'll pick it up pretty quick (I'd imagine almost instantaneously). The way people remember things is often not in absolute form, but in a contextual form and this is true of all kinds of memory.

    Typically what people will do if they want to clarify this experience is that they will ask specific questions about the project and the issues involved in that project whether they were technical or not so technical: an experienced programmer will pick up whether they are talking rubbish or the truth pretty quickly.

    Now in terms of programming, you have domain knowledge and general knowledge just like a doctor has, or an engineer, or any other similar professional.

    You want to have good domain and general knowledge and be in the process of building these two up as you go along whether its when you are studying or working (or both).

    Programming in the general context is about two things: state and flow-control. It doesn't matter what language, what environment or platform, or any other factor: these two things are the most important.

    In procedural languages the flow-control is simple: top-down execution of instructions while taking into account the nature of loops, branching statements, and function calls in the context of a single-threaded, single process application.

    From there on you look at the simple multi-threaded model, and from there if you want to go deeper you look at the interrupt model which is what you deal with when you are programming embedded devices (non-PC micro-controllers for example) as well dealing with device drivers and general operating systems code at the lowest level. This is the kind of stuff that assembler programmers come across, but in terms of modern operating systems, you don't actually get to go to this level: things like Windows allows you to create threads, processes and stuff like that, but not mess around with hardware and software interrupts at the machine level. You also deal with flow-control for custom architectures like super-computers or other architectures.

    State, being the next one is also important. What happens is that you start out with a couple of variables in a single routine and you grow your scope to include many modules, libraries each with many dozens of structures and many thousands of lines of code: before you know it, you'll be dealing with repositories with half a million to a million lines of code which you will be organizing and keeping track of in your head. With practice, you will know what is important and what needs to be kept track off. Most of this learning comes through debugging code, and after a while of doing this, the above comment will make more sense to you.

    Now all the stuff you are taught like algorithms, data structures, and so on is also part of the general stuff but its at a different level. The most important thing though that you will learn as a good programmer is the ability to deal with arbitrary interfaces. This is really critical.

    What happens is that typically programmers get a software library, or a code library whether it's compiled as a library or a DLL, or uncompiled as source code and they have to integrate this into existing code in some way.

    The usual thing that happens is that you are given an interface, data structures, and documentation and you pretty much have to go from there.

    Typically you won't understand the nuts and bolts of the new library (and you don't have to) but you have to understand how to adapt this library to your code and know how to deal with problems in the general instance. Whether this is some kind of data structure implementation, or an entire library for some kind of functionality, it doesn't matter: the above still applies equally.

    Once you are able to work with libraries and understand these issues, then the natural elements of design and working with complex systems will come a lot more naturally as it will become clearer how to create software that 'connects' to each other in an optimal way, which will help you understand so many things in Java, .NET, and other modern platforms.

    There is a lot more stuff, but I think the above will do you a great service if you want to become a really good programmer.
  4. Jul 14, 2012 #3


    User Avatar
    Homework Helper

    If you know C++, then you already know C, since it's just a sub-set of C++. If you took a class in C, the main difference would be the programs you did for the class, not the difference between C++ and C.

    This just means it's an instructional book, as opposed to a language reference. The primer you chose just happens to have some more advanced programming examples to study.

    Most companies are more interested in the projects that a programmer worked on and what that programmers involvement was for that project (design versus maintainance), and they will be looking for experience that relates to the type of work done at that company.

    Chiro has already mentioned some types of programming jobs, some of which are fairly common like web design, while others involve some small niche aspect of programming, like encryption.

    The low level stuff is common with embedded software (firmware) that goes into computer peripherals or some consumer devices. Although there is some assembly code to handle cpu specific issues, like interrupts or task switching, most of the low level code in these devices is writing in C. For other devices, like cell phones or tablets, they use an existing operating system, like Android, and the programmers are mostly writing code in some high level language to be used for the apps on those devices.

    There's still a lot of scientific programming done in Fortran, mostly because of the large amount of existing code.

    The banking industry still uses Cobol with some assembly code (BAL, ALC, HLASM). In this case, the assembly code is higher level than typical assembly (even IBM's mainframe low level assembly code includes instructions very similar to the type of operations done in Cobol).

    The issue for a student is to get a fairly broad experience, then choose if that student wants to get into some niche aspect of programming or stay with the mainstream stuff.
    Last edited: Jul 14, 2012
  5. Jul 14, 2012 #4


    User Avatar
    Science Advisor
    Homework Helper

    Working in industry (my job title has never been "computer programmer") but I spend a lot of time doing that!) I reckon I have learned a new prgramming language about every 18 months. Not from choice - just because the technology keeps moving on. Of course I've forgotten most of the details of the languages I haven't used for 10 or 15 years, but not the "big ideas" (which are usually common to many different languages anyway).

    The real question is whether people know how to program, not how many languages they claim to know about. If your buddy gets an interview for a "serious" C++ progamming position, he will probably get some technical questions to test out his real knowledge level of both programming in general and C++ in particalar.
  6. Jul 14, 2012 #5
    Great answers from everyone! Hope I can ask another question.

    What would be a good job for a Mathematics major who has a decent or good (but not great) knowledge of programming and 1 year of doing data analysis for a neuroscience research project? Or a better question: What is the best way to make myself marketable during my 1 remaining year at college, so that I can find a decent entry-level job?
  7. Jul 15, 2012 #6


    Staff: Mentor

    I've been looking at scala. A relative newcomer that is trying to be a better java than java. It blends object oriented programming with functional programming.

    So far I've done a simple swing app to show that scala can Interoperates with java libraries of our project. And I've got a student working on a scala android project using maven as the build tool and netbeans with scala plugin as the IDE.

    In general though programmers choose the language based on the needs of the project.
  8. Jul 15, 2012 #7


    User Avatar
    Science Advisor

    My advice in line also with the other suggestions is to build up your portfolio with project work and try to complete whole projects even if they are small ones. Larger ones are better, but finishing a project is the most important thing.
  9. Jul 15, 2012 #8


    User Avatar
    Gold Member

    What will look far more impressive on a beginner's resume than the number of languages you claim to know is a concrete, and truthful/supportable statement that you have taken a program (the more complex the better) from cradle to grave. You designed it, developed it, helped test it (NEVER do all you own testing), installed it, and provided customer support for it. The more you can say you have done all of these things the better.
  10. Jul 15, 2012 #9


    Staff: Mentor

    And internationalized it and made it for accessibility aware for truly global program.
  11. Jul 15, 2012 #10


    Staff: Mentor

    When our company interviewed statements we would look at their resume noting the languages and projects and then zero in on the projects with questions like:

    Tell us about your project?

    What was its goal?

    Who helped develop it?

    What did you do?

    What techniques and algorithms did you use?

    What problems or issues did you uncover?

    How did you resolve them?

    Then we'd get into skills like graphics, GUI design and tools used?

    One student I interviewed couldn't explain his project other it was a search application based on googles algorithm. He wasnt prepared to describe the algorithm to anyone beyond its name and that google used it. While I knew he had the skills to do the job, others in my group went for the more eloquent student who could answer all the questions quickly and succinctly.

    Another student who came for an interview was asked to write a sort algorithm on the board and she wrote a quick sort algorithm amazingly fast. It impressed the heck out of the interviewers. Later it turns out that she had just done this assignment the week before. So sometimes you luck out in interviews where you just know the answer or the interviewer likes what they see or the interviewer is desperate to hire someone who can do the job ( not the best reason to hire but sometimes small businesses do this after their only programmer leaves for more pay)

    As an aside there's a website with some great viewer contributed programming disasters that's real interesting to read at:

  12. Jul 23, 2012 #11
    Only true at basic level. You will not understand production C code for a large system.

    C++ has object oriented design, RAII and exceptions. C will be a monolitic design, it will handle errors locally instead of throwing an exception (unless they used goto which is NOT uncommon in systems programming in C), it will use pointers instead of RAII (quite common nowadays to never use a pointer in C++ becuase of RAII).

    Imagine if we were carpenters. C used rocks instead of hammers and C++ invented the hammer. Then you tell a C++ guy he has to do a large and complex build, without using his hammer. He didn't train for that and he won't be initially effective.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook