Skip to content

Latest commit

 

History

History
152 lines (127 loc) · 5.81 KB

README.md

File metadata and controls

152 lines (127 loc) · 5.81 KB

Summarize the project and what problem it was solving.

I was interviewing for a position at a company as a Senior .Net/C# Programmer; during the process, they had tasked me with some homework. The task was to consume a remote RESTful .Net Core Web.API, and grab a list of magazines, categories, and clients associated with both. The remote resource was set up on a few different end-points. As an included bonus, they would randomly slow down calls to the server to simulate real-world CPU spikes. Whoever could capture and aggregate the data fastest moved on to the final round of interviews.

What did you do particularly well?

The two main things that I did exceptionally well were reading the included instructions and “multi” tasking. After moving on to the final round and given an offer letter, I had a chance to discuss the other developers' results with the teams. Most of the developers interviewing did not comprehend how they should handle calls being slowed down randomly. They also did each instruction one-by-one, instead of following Microsoft’s TAP framework, which consists of asynchronous tasks (aka, threads,) and calling multiple end-points, and running the data through an algorithm in a parallel process. Out of all the submitted code, mine ran the fastest.

Where could you enhance your code? How would these improvements make your code more efficient, secure, and so on?

I feel like the code on the “client” side is about as fast as it will get in a language like C#. But, the Web.API did not require any header-checking or authentication. Public-facing or not, it is always a good idea to require some JSON token, at least to prevent a robot crawler or malicious user.

Did you find writing any piece of this code challenging, and how did you overcome this? What tools and/or resources are you adding to your support network?

The hardest part of the challenge was trying to compensate for the calls that would be slowed down. My first thought was to use some sort of timer and track the calls. But I switched over to a task-based system, which would call the required end-points, and wait for them in a single task, allowing me to create multiple jobs. Each task will complete and push the data into a final list, allowing me to loop through the end-results to output the console data.

What skills from this project will be particularly transferable to other projects and/or course work?

Many projects will require a developer to write code that runs asynchronously in threads to prevent blocking a GUI or minimize time spent on tasks.

How did you make this program maintainable, readable, and adaptable?

I had used an N-Tier development style. I created a service-tier to communicate with the remote servers, a data-tier that contained all of my facets, business models, and interfaces, and finally, a logic/presentation-teir to output all of the results. The above code could be modified and ingested for multiple projects, including web and UI. The interfaces could be used with external projects, mitigating the need for rewriting the code numerous times. I also added comments on tasks and functions to follow my code and reuse it in another project or make changes quickly.

Instructions

The source code respository of a proposed programming challenge.

After downloading and compiling the code, begin by executing the application. The command line will prompt you with the following:

Enter in a number for times to execute the request[1-20] or [E] to exit:

Enter a number between 1 and 20 to begin.

After a short period, you will be presented with similar data(depending on your CPU and network speed, your results might vary):

 

Fastest Time To Complete: 00:00:04.1147600 

Slowest Time To Complete: 00:00:08.1492368

Average Time To Complete: 00:00:05.8520850

Number of attempts successful: 10 

Number of attempts unsuccessful: 0

 

If you are presented with this:

There was a system failure; please review the logs in the Logs folder.

Navigate to the folder that contains the executable file; it will now have a folder labeled "Logs" and include the contents of the exception.