Software Development Tools


- A wide variety of tools are available to assist programmers in the various stages of software development

- Understanding and using such tools can often help make the development process more efficient

- Such tools are offered either as stand-alone tools or integrated development environments



Integrated Development Environment (IDE)
- A single, comprehensive development system integrating all development phases
- Environments integrate a variety of different tools under one common environment
- Examples include Microsoft's Visual C++, Bloodshed Dev-C++
- Provides a consistent user interface
- Different tools communicate information between each other (debugger highlights errors in editor)

- IDEs are closed environments making it difficult to extend, adjust, or replace tools


Stand alone tools
- Developer utilizes a number of different tools for various phases of software development
- Typically exist as command-line tools

-        Editor for creating source code (i.e. emacs, vi, ... )

-        Compilation tools for compiling code (i.e. g++, CC, make, ... )

-        Debugger for analyzing errors (i.e. gdb, xxgdb )

- New tools can easily be added/replaced at any step
- No communication, however, between different tools


- Large projects often contain a large number of different source files

- Compiling, updating, and maintaining such files can often become unwieldy

- A command line tool, make, aids in the management of such projects
- Useful for the creation, maintenance, compilation, and management of large projects

- Interface to make utility is through the use of a text file named a Makefile
- Makefiles describe how different files of a project depend upon one another

- These dependencies determine the order of a project build (.C to .o to executable)
- Makefiles define rules needed to build (compile, link, archive) the dependent files
make uses information in a Makefile and system file modification times to build system

- Makefiles describe dependency rules between files as follows

target :    dependency list
            command list

Target name of file for make to operate on (compile, link, some other utility)


dependency list
List of elements (files) needed to create the target
Must be a single line (more than 1 line connected by a \ character)


command list
Commands to be performed to create the target
Must be a single line (more than 1 line connected by a \ character)
Command list must be indented by a single, required tab



- Consider compiling an executable from a variety of various source files

- The single executable is created by linking several object files

- The executable (target) is dependent upon the object files (dependencies)

- In addition, each object file is created by compiling its source file

- Each object file (target) is dependent upon its source file (dependency)

- We can express these relationships in a Makefile as follows

# Makefile

proj2: proj2.o Assignment.o Category.o Student.o Course.o \
        Score.o GradeBook.o
        g++ -o proj2 proj2.o Assignment.o Category.o \
        Student.o Course.o Score.o GradeBook.o

proj2.o: proj2.C
        g++ -c proj2.C

Assignment.o: Assignment.C Assignment.h
        g++ -c Assignment.C

Category.o: Category.C Category.h
        g++ -c Category.C

Student.o: Student.C Student.h
        g++ -c Student.C

Course.o: Course.C Course.h
        g++ -c Course.C

Score.o: Score.C Score.h
        g++ -c Score.C

GradeBook.o: GradeBook.C GradeBook.h
        g++ -c GradeBook.C

        rm -rf proj2.o Assignment.o Category.o Student.o Course.o \
        Score.o GradeBook.o
        rm -rf proj2

- Each target lists its corresponding dependencies

- The command list denotes the operation to perform to create the named target

- Note, in addition, that we can use any target name to accomplish any type of operation

- In the example below the clean target is used to remove files

- Instructions are placed in a text file named Makefile and make is used to carry out the operations

- make reads the instructions to create the target named on the command line

- For example, to create the target clean above, we simply type the following


 user@machine %> make clean


- Without a named target, make processes the first target listed in the Makefile

- In this example, the following command processes the target named proj2


user@machine %> make


- Variables and special symbols can be used to simplify instructions in Makefiles

- The following Makefile performs the same operations as the Makefile above

- Variables are used to describe repetitive instructions from the Makefile above

# Makefile

APP             =       proj2
INC             =
CC++            =       g++
C++FLAGS        =       $(INC)
HFILES          =       Assignment.h \
                        Category.h Student.h \
                        Course.h GradeBook.h Score.h
OBJECTS         =       $(APP).o Assignment.o \
                        Category.o Student.o \
                        Course.o GradeBook.o Score.o

        $(CC++) $(C++FLAGS) -o $@ $(OBJECTS) $(LIBS)

.C.o: $(HFILES)
        $(CC++) $(C++FLAGS) -c $<

        rm -rf $(OBJECTS)
        rm -rf $(APP)



Library Archives

- Object code can be stored in archived library files

- Object files from related classes are often stored in such libraries

- Code can be used by others by providing the class header files and an object library

- In this way, users can share code without giving away the class source files
- Consider an example where programmer A wishes to share C++ classes with programmer B

- Programmer A does not, however, wish to share the actual source code files

- Programmer A creates an object class library using the make utility as follows

- The command line utility, ar combines the object files in a single library (libCSC125.a)



# Makefile



LIBNAME         =       libCSC125.a

INC             =

CC++            =       g++

C++FLAGS        =       $(INC)


HFILES          =       Customer.h Account.h \

                        AccountList.h Fraction.h


OBJECTS         =       Customer.o Account.o \

                        AccountList.o Fraction.o



        ar r $(LIBNAME) $(OBJECTS)


.C.o: $(HFILES)

        $(CC++) $(C++FLAGS) -c $<


- Programmer B includes the header files and uses the classes within an application (app.C)


#include "Fraction.h"

#include "Account.h"




  Fraction f;

  Account a;



- This application is compiled by linking to the supplied object library (libCSC125.a) as follows

- The –L option is followed by directories to search for the libraries listed

- In this example, the library (libCSC125.a) is in the current directory (.)


user@machine %> g++ -o app -L. app.o -lCSC125


- In this way, applications can be created using class files without having access to the class source files

- This is how many software packages are distributed (and sold) to be used by other software developers