Can learning C++ also make me proficient in C?

  • Thread starter Jamin2112
  • Start date
  • Tags
    Programming
In summary: It's a huge mess, and it's all state too. You can't change any of the data in any of the other routines without affecting the state of this one.The tricky bit is that you want to be able to change the state without affecting the outside world, and you want to be able to do this in a way that is transparent to the user of the code. You have to think about things like data hiding, encapsulation, data mobility, and all that kind of stuff.In summary, Jamin2112, if your buddy has experience in programming languages, he is not being disingenuous. He is just stating that he has used all of these languages and knows how to use them
  • #1
Jamin2112
986
12
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?
 
Technology news on Phys.org
  • #2
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.
 
  • #3
Jamin2112 said:
I'd also like to learn C.
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.

Jamin2112 said:
Primer
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.

Jamin2112 said:
resume ... programming languages ...
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:
  • #4
Jamin2112 said:
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.

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 particlear.
 
  • #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?
 
  • #6
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.
 
  • #7
Jamin2112 said:
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?

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.
 
  • #8
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.
 
  • #9
And internationalized it and made it for accessibility aware for truly global program.
 
  • #10
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:

http://thedailywtf.com/
 
  • #11
rcgldr said:
If you know C++, then you already know C, since it's just a sub-set of C++.

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.
 

What are the 2 programming questions?

The 2 programming questions refer to a set of two specific inquiries or problems related to programming. These questions can vary in complexity and subject matter, but they are typically used to assess a person's coding skills or understanding of a particular programming language.

Why are "2 programming questions" often asked in interviews?

Asking 2 programming questions in interviews allows employers to evaluate a candidate's technical abilities and problem-solving skills. It also gives them an insight into the candidate's thought process and approach to coding, which can be valuable in determining their fit for the role.

What are some common topics covered in "2 programming questions"?

The topics covered in "2 programming questions" can vary, but some common ones include data structures, algorithms, object-oriented programming, and web development. Employers may also tailor the questions to the specific job role and the programming languages or tools used in their company.

How can one prepare for "2 programming questions" in an interview?

To prepare for "2 programming questions" in an interview, one should review their coding skills and knowledge of programming concepts and languages. It can also be helpful to practice solving coding problems and familiarize oneself with common data structures and algorithms.

Are "2 programming questions" only asked in technical interviews?

No, "2 programming questions" can be asked in both technical and non-technical interviews. In technical interviews, they are used to evaluate a candidate's technical skills. In non-technical interviews, they may be used to assess a candidate's problem-solving abilities or to gauge their interest in programming.

Similar threads

  • Programming and Computer Science
Replies
8
Views
880
  • Programming and Computer Science
2
Replies
69
Views
4K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
10
Views
2K
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
22
Views
2K
  • Programming and Computer Science
Replies
5
Views
5K
  • Programming and Computer Science
3
Replies
86
Views
10K
  • Programming and Computer Science
Replies
8
Views
1K
Replies
6
Views
1K
Back
Top