Archive

Posts Tagged ‘memory’

Introduction To Software Testing

July 19th, 2009 bodom_lx No comments

Elements and Concepts – A brief overview


Download PDF version of the whole document. You can browse the article online but I encourage the download of the PDF since it is written with accuracy.


Introduction

This document contains some basic concepts and definitions about software testing. It has been written for studying a part of the Software Engineering Project course at my University. It is composed by a summary of the intersection of more than 10 different sources, all of which are cited. If you feel that some contents of this publication belong to your intellectual property and it is not cited, please contact the author who is willing to correct any mistake.

The first part of the paper focuses on the definition of the most important key aspects of software testing. Then some information about input partitioning are given. What follows is a research about code coverage and two useful and famous tools, Control-flow coverage and Data-flow analysis. A complete example on using those tools is then given. The second half of the document also contains the definition of the most important software testing practices.

The goal of this tiny document is to clarify key terms and therefore become a base start for the reader to go in deep with the interested topics. Another goal is to give a simple but clear example about data flow analysis, as I realized that not all the people understand the examples around the Net.

Software Testing

Software Testing is an empirical investigation conducted to provide stakeholders with information about the quality of the product or service under test, with respect to the context in which it is intended to operate. Software Testing also provides an objective, independent view of the software to allow the business to appreciate and understand the risks at implementation of the software. Test techniques include, but are not limited to, the process of executing a program or application with the intent of finding software bugs. It can also be stated as the process of validating and verifying that a software program/application/product meets the business and technical requirements that guided its design and development, so that it works as expected and can be implemented with the same characteristics. 1

Read more…

Related posts

A major revision for my publication about Object-Oriented Memory Management

April 10th, 2009 bodom_lx No comments

It took about a year for a major revision of my document about memory management in object oriented programming languages.

This major revision adds C++ in addition to Java.

The paper is about a model for memory management during the execution of programs written in Java and C++.

The number of pages grew from 17 to 28.

You can see more information and download the pdf on this page.

I hope you will find it useful to model your programs and know how memory is handled.

Related posts

Heap vs. Stack in C++

March 20th, 2009 bodom_lx 4 comments

After the study of pointers versus references, the second natural question that comes in head of a ex Java developer turning to C++ is:

“What are the difference between static and dynamic memory allocation in C++?”

which can be translated as:

“When should I use the stack and when do I have to use the heap in C++?”

that can be further simplified to:

“When should I use the new operator in C++?”

I could simply summarize the answer to: “Use stack when possible”, but I think that this time there is the need of more explanations. Let’s have the following model for a process in the system:

A simplified model for a process

A simplified model for a process

I’m not really interested in an real representation of a process (see Modern Operating Systems by A. S. Tanenbaum for a very good explanation on processes), but focus on the stack and on the heap.
In reality the heap is a software abstraction but you can also imagine it like the stack.
In C++ programs there are also several other memory areas in which objects and non-object values may be stored (see this article on GotW for further details).

Why then choose between stack or heap? Quoting my publication on object-oriented memory management in Java:

Stack-based variables have their extent determined by their scope, so the former is constrained by the structure of the code at compile-time .

Sometimes there is a need for the variables with unconstrained extent in order to cope with
problems where lifetime of a variable can only be known at run-time.
In this case heap-based variables, whose extent is strictly under control of the programmer, are used. [..]

I promise that I will update my 17 pages about OO-memory management to cover also C++ by the end of June. By the way, following some forums, wikipedia, my publication and GotW, I also summarized pros and cons of stack and heap use in C++:

Stack Heap
Its size is determined at compile-time Size determined at run-time
Therefore, it is less expensive and quick Therefore, it is more expensive and slower than stack
The preferred way to store objects and variables if their size is limited. To be used only if needed: the amount of memory needed is variable and unknown, and may increase rapidly.
There is an AUTOMATIC CLEANUP of objects when they go out of their scope Objects STAY IN MEMORY even when you don’t use them anymore.
Programmers don’t have to bother to free resources Therefore, programmers HAVE TO CLEAN memory manually. However, all modern OS free the resources when the program exits.

Update 2009-07-03
After 4 months of heavy GUI and Database C++ programming, here are my thoughts: if you are planning to write a program with something more than a couple of objects interacting, using associations and therefore, objects as attributes, use the heap. Every serious program, even if not really big, uses heap for object allocation. Just take care to delete the objects when you don’t need them anymore. Objects on the heap are dynamically allocated and it is more comfortable to pass them through other objects using pointers. The use of the heap assures the live of objects even if the method that generated them runs out of scope ( =dies ). If you also plan to write GUIs, solid toolkits like QT recommend the use of heap to create graphical objects.

In some Operating Systems, stack is also very limited while heap is usually not.

Here are listed the sources I used for writing this article:

  • http://www.velocityreviews.com/forums/t278261-stack-vs-heap.html
  • http://www.computing.net/answers/programming/stackheap-c/2293.html
  • http://www.codeguru.com/forum/showthread.php?p=1186307#post1186307
  • http://www.codeguru.com/forum/showthread.php?t=350945
  • http://www.gotw.ca/gotw/009.htm
  • http://en.wikipedia.org/wiki/Process_(computing)#Representation
  • http://task3.cc/object-oriented-memory-management/

Hope that this article helped you to clearly understand the differences between stack and heap allocation in C++, write me if there are other issues or you need more explanations!

Related posts

Reference vs. Pointer

March 18th, 2009 bodom_lx No comments

In Software Engineering Project course we need to learn some C++ to develop the project. A question that some programmers have when passing from Java to C++ (like me) is “Which are the differences between pointers and references?“. You can find a lot of answers around developers forum, but I summarized them in the following table. Glad if you found it useful!

Reference Pointer
is an object which IS AN ALIAS for another object is an object that CONTAINS THE ADRRESS IN MEMORY of another object
the preferred way of undirectly access objects you should use it just if you really need it, as it lets you to work in a lower level than a reference does
keeps your code clear the code is less clear but still understandable
it must be initialized when created you don’t have to initialize it when declared
it references to the one object and only that one, therefore you can not modify the address referenced because it contains an address, it can point to many different objects during lifetime. The address can be manipulated
when used, the address is dereferenced without using any particular operator the address must be dereferenced using the * operator

Related posts

Opensource contribution always pays..even if a couple of years after

December 3rd, 2008 bodom_lx No comments

Someday two years ago I submitted a translation for an opensource project, gmail-notifier. It is a very nice notifier for Gmail accounts written in Python. I never received a response from the authors , neither I saw my translation appear in the project source, which seemed to be dead.
It was my first attempt to actively help a free software project, and I also felt demoralized because of the absent feedback.
Today I surprisingly noticed that the project is active again, and the authors cited my work and also included my translation in the source code. They “forced” me to forgive them because they released this version just for including the translations! They even published the list of the translators on their home page, telling:

In the last two years many people have contributed with the project by sending to me translations that I have never posted. The development of Gmail Notifier 1.7 is now starting, so I’m releasing this version just to include those translations and to say thank you to all the people that have supported the project.
The new translations are:
- Svenska
- Italiano (Daniel Graziotin)
- Nederlands (Dennis van der Staal)
- Deutsch (Marc Philipp, Eric Franco)
-Portuguese (Brazil) (Yguaratã C. Cavalcanti)
- Français (Thibault Martin-Lagardette)
- Czech (Václav Cermák)
- Russian (Aleksandr Chekanov)
- Polish
- Latvian (Kaspars Krampis)
- Esperanto (Abel Johannes)
- Arabic (Youssef Chahibi)
- Japanese (Satoshi Tanabe)

I took a screenshot as memory

They also included some thanks in the sourcecode.

A contribute to opensource projects is really rewarding, even if your work consists in modifying a handful of XML lines.

If you’ve got the time to do it, then make it!

I wish good luck to gmail-notifier team for the development of the 1.7 release, which will be written from scratch. I wish I had the time to contribute to the sourcecode, too, now that I’m able to handle some Python, but I believe I will help them to translate the program in Italian again :-)

Related posts

OO-Memory Management Model summary updated..again!

April 15th, 2008 bodom_lx No comments

I’ve just published a new version of my OOMM model. The new version covers two more small topics (static methods and static attributes), and features now a new clear layout. Give it a try!

http://task3.cc/object-oriented-memory-management/

Related posts