Computer science - Personal Data Manipulation

Authors Avatar

Csd2210                        Data structures and algorithms


Ftp acCount editor

Abstract

The program ftp account editor is used to keep in an external file the domain name of the ftp account, the user name and the password. Three strings of characters that do not contain spaces since the structure of all these is “spaceless” by default.  The program uses a single linked list which’s nodes is having as attribute a class. Various methods are implemented giving the basic functionality to the user. The main aspects in which the software is produced and designed are modularity and reusability. The target goal is achieved not in the desirable level but in a satisfactory one if we consider the low level programming skills of the programmer.



Three classes consist the whole program. With an inside-out approach this report explains the functionality and the use of their methods and attributes. The main target goal was to achieve the productions of software as modular and reusable as possible. But due to the low level programming skills of the programmer the above requirements are met not in the desirable but in a quite satisfactory level.  The inside-out approach begins with a graphical representation of the classes which is not a UML diagram although it also represents the connections between the classes.

Class ftp

We start as well with the description of the class ftp. By the name we can understand that the objects of this class are responsible to keep the data of each ftp account. Each one object of them is “included” as an attribute to the corresponding Node. Of course we could have the same attributes in each Node as well with the methods but then we lose the true meaning of modularity. Static character arrays are used for all attributes since the domain names as long with the usernames and the passwords do not have spaces by default. The sizes cannot be changed dynamically because some method is not implemented although it’s feasible. The constructor of this class does not do anything because of when a new object is instantiated the new values for its attributes are received as parameters in the responsible method of the liked list through a temporary object created in the main function which’s values are assigned using the setData methods (setDomain, setUserName, setPassword). The assignment operator is overloaded thus to copy the attributes of an object to another one like using integers (a=b;).  The equality and the inequality operators are overloaded so as to compare two objects of class ftp again like using integers (if (a= =b)) and is used by the list’s methods whenever the list is traversing the nodes until it finds an ftp instance that its attribute’s values match the requirements.

The printData method uses the standard output (cout) to print the attributes. Of course we could overload the output operator but this is further discussed in the extra methods section. Also all the setData methods receive as parameter a pointer to an array of characters and then copy the string in the corresponding attribute (strcpy(attribute_,_tmp_attribute)). Finally the getData methods do not receive any parameters and do not carry any operations than to return the corresponding attribute. (getDomain returns domain).  

 Class Node

The Class Node is the smallest of the three in lines of code although it’s the key idea of the link list data structure. Though it’s important to be as simple as possible to achieve modularity. With the way it’s implemented it is the same as long as the most methods of the linked list. No matter what kind of data we use (integers, characters, structs, objects etc). Simply we have to overload the operators of the data class with another implementation.  The specific class has as attributes the data instance and a pointer to an object of data type Node. The public part Node has it’s constructor who initializes it’s next pointer to NULL and a the friend class UrlList so as enforce the list to alter it’s next pointer values easily just like if it was public.

Class UrlList

The last class used for the implementation of this software is responsible for the usability of the afore mentioned classes. Although the Node is the key idea of the linked list this one is actually the implementation of the linked list. It’s only attributes are the head of the tail pointing to the first Node and the tail which point to the last Node of the list. The length can be used either to access a specific Node by indexing (i.e. Node [3]) my simply overloading the[ ] operator or to check if the list is empty (if(length=0)). Though in this software it is not used to anything but it’s there and it’s increased/decreased every time a Node is inserted or deleted. If somebody wants to use it thus in a new method the length already exists.

Join now!

        The public part of the UrlList class contains only methods as usual. Starting with the constructor we see it initializing the head and the tail of the list to NULL since when the list is instantiated it’s empty.  This is used to the isEmpty method which checks if the head points where the tail does to NULL and returns true. After in the implementation we meet the print and the checkIfExists methods. Actually the are quite similar since the first traverses the list and in each loop it calls the print method of the corresponding data object while the ...

This is a preview of the whole essay