C语言

Part 1: Why learn and use C? (25 points)

To start off this assignment, please look into the history of C, the influence it has had on other languages, and some examples of what the language is used for today and then answer the question “Why learn and use C?”. Your answer should be at least 1 paragraph.

There is no “correct” answer to this question. I think that it is an important question to reflect on though when learning any new programming language so that is why I have included it as part of this assignment.

Part 2: Defining the Problem and your Approach Towards Finding a Solution (75 points)

The following is very much a real-world example (though scaled down so that it will be possible for you to complete the assignment in the time that is left in this semester) of a problem that you could solve using C.

The Problem

Given a small database of person accounts (a sqllite3 database – which is written in C itself – that will be provided to you shortly), determine which set of accounts in that database are authorized to access a resource and should therefore be sent to the appropriate destination “system” based on the roles associated with those accounts.

The database will contain person records, roles, resources (i.e. and by resource I mean something that requires a person to have a specific role in order to access it), a mapping of the roles to people, and a mapping of the roles to resources. This should be all of the information that you need in order to programmatically make the determination about which accounts are authorized. I will post an ERD detailing this prior to lab on 11/16.

Each destination “system” that I mentioned will just be a location in local memory (again, for the sake of keeping the scale manageable). When writing to these locations (and I will post more details about the what and how of this piece soon), you will need to allocate memory, write to it, and have a way to maintain it. You should not need these specific implementation details to to come up with a preliminary solution design though.

Designing a Solution

For this part of the assignment, you should not be programming anything. Instead, you should make sure that you understand the functional details of this assignment.

It should also be an opportunity for you to examine your approach to problem solving. The number one reason that I’ve seen students (and even professionals) fail to complete an assignment or task is because they did not understand what the problem was asking and the steps they needed to take in order to solve the problem. If you take the time to document and think about your design and approach, I do not think that you will find yourself in a place where you are unable to complete this assignment.

For this part of the assignment, how you present your design is up to you. A couple of options are to create a process flow diagram or to create a specification document of some kind, such as a scaled down version of a software requirements specification (SRS) document (some things that normally go into an SRS document, just aren’t applicable or aren’t worth spending too much time on because of the limited scale of this assignment. I will post some examples of some documentation that I’ve done to solve problems similar to this one.

Part 3: Writing Pseudo-code (75 points)

Once you have your preliminary design, you should then start to think about specifics of your implementation. Rather than jumping right in and writing C code though, you should first take the intermediate step of writing pseudo-code. I will expect you to turn this in.

When you move on from part 3 to part 4, do not worry about going back and updating your pseudo-code if you find that you’ve deviated from it in your actual code. The pseudo-code is just a stepping stone to help you write the actual code, so I don’t think it is necessary or useful to update it once it is done unless you find that you need to do a massive overhaul of your code and once again use the pseudo-code as your stepping stone.

Part 4: Implementing the Solution (100 points)

I am purposefully holding off on writing anything here. I will post more details here over the weekend. I really strongly recommend that you do these parts in order (at least parts 2-5), so you should not need these details until you’ve completed parts 2 and 3.

Part 5: Testing your Solution (25 points)

Leave a Reply

Your email address will not be published. Required fields are marked *