Share your debugging tips

C, C++, Visual C++, C++.Net Topics
Post Reply
User avatar
SemiconductorCat
Major
Major
Posts: 455
Joined: Mon Aug 22, 2011 8:42 pm
Location: currently in hyperspace

Share your debugging tips

Post by SemiconductorCat » Sat Aug 27, 2011 12:04 am

Hi all,

what is thread up to:
* Each and every member in the forum at least have done some level of debugging, so I know everybody
have something to share here about their own personal debugging experience on debugging C++/C
applications.Since everybody's experience is different from another experience there's really that we have
to take from them.

* The machine and the debugger can't think and be creative. :( so debugger itself is not the solution. Debugger
+ Human is the solution. So if you experience a debugging problem and spend hours of days without a solution
and finally you'd be able to slove it. Share your experience here. We really open to learn from you.

* Since there are many developers here from different platforms , we need to hear from different platforms ,
developer tools, and architectures.

* To learn from experienced developers.


what we are not up to:
* genius are not welcome here, since there's not genius in programming/software engineering , which means everybody
welcomed.
* Using the debugger as a developer tool is not welcomed too ! ,use the debugger when you find your design is a fail.
* Destructive comments are not welcome here, "can do thinking" is needed. Such like "developing with C++ is harder than
on java" so we should go for a java position, you may be welcome on their java forum.But not here.

--sandun--
Last edited by Neo on Sat Aug 27, 2011 4:51 am, edited 1 time in total.
Reason: [Offtopic] postfix removed
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Share your debugging tips

Post by Neo » Sat Aug 27, 2011 6:09 am

I have gone through the whole discussion you guys had in C++ And Other Problems. Sorry I was out for last few days and I couldn't participate tot his earlier.

Anyway this is clearly a war between Java and C++ :mrgreen:
I don't like to intervene since I use both for different purposes. I do see advantageous and disadvantages in both and on the design phase, we evaluate what would be the best for each and every project. So my idea is, we must learn the concepts in programming and must be capable of handling any task given to us with best tools. Most of the companies nowadays are not stick with one language. For example, if you take Virtusa, they use Java, C++ and many other languages on different projects. Sometimes a mixture is used to make things faster.

Android is a nice example of using a mixture of Java and C++/ASM. Advantageous of both languages are used quite wisely to make a better product. If they thought to make the GUI in C++ as well, it is non other than an effort to invent the wheel.

C# is another nice descendant of C++ just as Java. C# is not yet platform independent but it is a very powerful language for Windows development.

I don't see any point in the argument "C++ codes are difficult to debug'. I'm using Turbo C to C++.Net and in my about 15 years of expereince with C, I have never experiences such laps in debugging :roll:

Java in the other hand is a very good programming language. Though I don't agree with some of the harsh comments made by Saman (may be he was angry when you disrespect C++ :lol: ), I do agree that Java is very inefficient in time precision programming (This is where it is not used to make the core of Android OS even though a special JVM mode is possible with ARM processor called Jazelle). As Saman stated, if you read about Android, it is true the core is made with C++/ASM where Front End (GUI) is made with Java. Java is very powerful in making user interfaces due to its in-build functionality. However Android JVM was programmed with C++ to support Java on it.

I fully agree with the comment that Java can't exist without C++ since most of the popular JVMs (including the orginal Sun JVM) are created with C++/ASM (If my memory is right, only IBM JVM is made in Small Talk. But then again Small Talk VM is made using C++ ;) ). Java is a pure descendant of C++. If I'm Java, my dad in C. I might be powerful at some points but I don't exist without him :)

It is again correct to state that debugger is a IDE functionality integrated to compiler in PC programming. I have used Visual C++ and C++.Net quite recently and never found any difficulty in debugging my code. In embedded world where C++ dominates, debugging is so powerful with supportive devices such as JTAGs, etc...

It is not correct to say that debugging is used when your design is a failure. Design failures can't be addressed & rectified with debugging. It requires a restart to the software development life cycle to find out the fault and rectify from that level. It is not possible to address design failures directly with coding which is not practical in most of the cases. Debugging is used to understand unexpected behaviours in the logic. It is not used while writing codes to help the programmer to write good codes.

Again, I agree on the comment C++ is far more close to ASM where as a direct conversion from C++ to ASM is possible Vice-Versa. This is where C++ is used for almost every core level embedded programming.

In simple terms, C++ debugging is very powerful. There is no argument with it. Whoever says it is not, has no programming expereince in C++. Java is also very powerful in debugging. In terms of debugging, I have never experienced anything new in Java which doesn't exist in C++. JNI is a direct interaction between Java and C++. It's non other than 'son calling mom' functionality.

I think Sandun missed a part that C++ has the same exception handling mechanism (try/catch blocks) which was derived to Java from C++.

In conclusion... learn almost all popular languages and be language independent (Obviously master one or two). This is taught in university under 'Programming Languages & Compiler Theory'. I'm not sure this subject is available for BIT students. Just don't get stuck in technologies (it is a waste of time). Just learn the advantageous over the other and use them wisely. C++ has a long way history and proven to be the best language in the world so far. Java has a more recent history but it is the best language I know to learn OOP concepts. GUI with Java is fantastic. In terms of GUI, C++ has to use 3rd part libraries/frameworks where Java has in-built functionality. Java libraries/API/Documentation are well organised over C++. (However C# fixed the gaps in Java and C++ in terms of above mentioned issues. But since it is also running on a Virtual Machine just as Java, it can't be used for OS or embedded programming yet).

See Programming Language Popularity. Notice one fact in this. Under 'Powell's Books' see the highest available books are for Java. This must be due to use Java as the main language in most of the poplar academias around the world. I agree, Java is the best language for teaching OOP concepts.
C/C++/Objective C/C# Vs. Java -> Game Over (Just kidding) :laughing:

UCSC BIT is a superb degree. We have some of the senior members who follows BIT such as Nipuna and Engima. After completion, I'm sure you guys will be able to jump in to the field without any hassle. Do you have 'System Programming' (Covers C programming in Unix/Linux platform) and 'Computer Architecture' (ASM programming under CISC and RISC architectures) ? Dr. Nalin (one of the best I know) was the in-charge of these about 10 years back. These were extremely useful for me to build up my career.

Out of topic: You said your dad in an ex-engineer. People of this generation aren't obviously talented as they do. Their knowledge in mathematics, physics and engineering can't even compared to ours. We have become a set of robots who depend on computers. But they made everything by their hand. Please tell him that I'm willing to warmly welcome him to ROBOT.LK forum. Please ask him to share his knowledge with us.
Post Reply

Return to “C/C++ Programming”