Skip to content

A programming challenge to implement a data serializer/deserializer

Notifications You must be signed in to change notification settings

janholo/ProgrammingChallenge2

Repository files navigation

ProgrammingChallenge2

Welcome to the 2. Programming Challenge.

The task in this challenge is to implement a data serializer/deserializer which minimizes the amount of data send between an edge device and the cloud.

Background

Lets imagine your company has 10000 Iot devices deployed in the field. They are connected via mobile data to your cloud infrastructure. Each of these devices sends 1 status update per second to your cloud. By using the default JsonCodec.cs provided as an example implementation this would yield approximately:

800MB per Month * 10000 devices = 8TB data per Month

If each GB of data costs around 2€ this would yield a monthly cost of:

8TB * 2€ / 1GB = 16.000€

Somehow your boss thinks this is a lot and gives you the task of reducing data usage while keeping the update interval of 1 second.

How to contribute

  1. In the folder Codecs create a folder with your name.
  2. In this folder create a class which implement the ICodecFactory.cs interface. This class is used to create serializer and deserializer instances and gives your implementation a name.
  3. Write a class which implements IDecoder.cs and a class which implements IEncoder.cs and use these implementations in your ICodecFactory.cs
    1. The encoder transforms a instance of IotDevice into a byte array.
    2. This byte array is transmitted to the cloud
    3. The decoder transform the byte array back to an IotDevice
  4. A starting point for the implementation can be seen in the folder Codecs/Jan.Reinhardt/
  5. To test your implementation adjust the Program.cs file as seen bellow. Change the initialisation of the codecFactory variable.
  6. Run dotnet run to see how many bytes your solution needs for the given amount of messages.
  7. To submit your solution just send a PR to the Github repo.

All participants work with the same repository, so please only commit changes in your own folder. Keep your changes to the Program.cs only locally. Expect for bugfixes or other improvements :-)

var codecFactory = new Codecs.<YourName>.<YourFactory>();

Notes

  • The TransmissionSequence.Run method has a debug parameter. Set this to true in Program.cs to get insight into your solution.
  • Because this is only a test app it is easily possible to cheat. Please find a solution which would also work in the real world (Encoder and Decoder are on different computers)
  • The solution only needs to work for the DataSource.cs provided in this repo and not for any data source possible (Except for the random seed which is only fixed so results are comparable).
  • Other networking problems such as message integrity, message order, missing messages, etc can be ignored for this task.

End of the competition

The competition ends at 27. August 2020.

After the competition ends the solution which manages to get the data across with the minimum amount of bytes wins!

Happy coding!

Results

Name Result
Result for Codec 'SoFarTheBestCodec by Sebastian Roether' Total bytes transmitted: 19161845
Result for Codec 'JsonCodec by Jan Reinhardt': Total bytes transmitted: 28658748

About

A programming challenge to implement a data serializer/deserializer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages