Social Networking Interaction System

This is a program that uses Microsoft Azure's storage tables to create a Facebook-based interaction system between different clients. This was a semester-long project I developed in a 4-member team for my Introduction to Software Engineering class. I led and administered the team, wrote functions and code snippets to add features to the server, and wrote unit tests to strengthen the functionalities of the client.

  • Teammates Involved: Andrew Song, Angelina Singh, and Lawrence Yu
  • Languages Used: C++
  • Software and Frameworks Used: Microsoft Azure, JSON, UnitTest++, Git
  • Skills Acquired: Server-Client Understanding and Interaction, Team Collaboration, Pair Programming, Authentication, Agile Development, Testing, Quality Assurance
  • Course Learned: Introduction to Software Engineering

Iteration 1: The Basics

The first iteration exposed my team members and me with the framework of Azure's tables. I learned how to create, update, and delete a JSON entity in a key-value storage table.

I also learned the uses and importance of the GET, PUT, POST, and DELETE functions.

Lastly, I was exposed to creating low-level unit tests through the UnitTest++ framework to search for bugs or abnormalities with our server code. It was my first time experiencing software quality assurance.

string property_name {"Food"};
string property_value {"*"};

pair<status_code,value> result {
 do_request (methods::GET,
  string(GetFixture::addr) + read_entity_admin + "/" + string(GetFixture::table),
  value::object( vector<pair<string,value>> {make_pair(property_name,
  value::string (property_value) )}))
};
As a tester for this iteration, this is how I can "GET" all entries with the property "Food" in an empty table. The GET request is split into two sections: the HTTP web address where the table is stored, and the object we are trying to look for in the form of a JSON web object. Both properties are separated by a comma.
CHECK_EQUAL( status_codes::OK, result.first );
CHECK( result.second.is_array() );
CHECK_EQUAL(0, result.second.as_array().size());
cout << "Result of first check: " << result.second.serialize() << endl;
This is how I also checked to see if the actual object we got is equal to what was expected. This is necessary when creating tests using UnitTest++.

Iteration 2: The Authentication

The second iteration introduced my team members and me to the processes and implementation of authorization and authentication. I was in-charge of acquiring and checking the validity of a 185-bit string security token.

During this iteration, I was also overwhelmed by the confusions and complications of using Git on the terminal.

pair<status_code,value> add_auth {
 do_request (methods::PUT,
 addr + update_entity_admin + "/" + auth_table + "/" + auth_table_partition + "/" + userid,
 value::object (vector<pair<string,value>> {make_pair("Password", value::string(user_pwd)),
 make_pair("DataPartition", value::string(partition)),
 make_pair("DataRow", value::string(row))}))
};
As a tester for this iteration, this is how I added a new user with a username and password to the authorization table. Again, the PUT request is split into two sections: the HTTP web address where the table is stored, and the object we are adding in the form of a JSON web object. Both properties are separated by a comma.
cerr << "user auth table insertion result " << add_auth.first << endl;
if (add_auth.first != status_codes::OK) {
 throw std::exception();
}
This is how I checked to see if we have successfully added the user to the authorization table.

Iteration 3: The Social Networking Features

This last iteration allowed my team members and me the opportunity to create features for a social networking user session. During this iteration, I've written both server and client code for signing on, signing off, reading the contents of a user's friend list, and pushing the user's updated status to his or her friends.

It was also during this iteration where I had to delegate tasks to my members because the semester was closing and we were busy with finishing other assignments.

std::unordered_map <string,tuple <string, string, string>> ::iterator active_user = active_users.find(username);

if(active_user == active_users.end())
{
 cout << "The user never had an active session.\n";
 message.reply( status_codes::Forbidden );
 return;
}
As the lead programmer for the social networking features, this is how I checked to see if we have an active user in the system. If the user does not exist, it prints an error on the terminal. Notice that finding the suggested user needs a search "::iterator" through the unordered map of all registered active users.

Reflection

The project turned out well, although our tests did not cover all cases for functionality and correctness. This meant that some of our server code was either wrong or incomplete. If there was one thing I wanted to improve for this project, it was in being clear with how to use Git.