Coding Challenge #37 - Redis CLI Tool
John Crickett
Helping you become a better software engineer by building real-world applications.
This challenge is to build your own version of the Redis CLI Tool.
When I recently released the course Become a Better Software Developer by Building Your Own Redis Server (Python Edition) I included building a simple version of the Redis CLI tool as one of the lessons and I’ve had some feedback that it would make an interesting challenge on it’s own, so here we are.
BTW, I’m currently porting the course to Go, signup here for the waitlist if you’re interested, everyone on the waitlist will be offered it first at a discount price.
The Challenge - Building A Redis CLI Tool
In this Coding Challenge we’re going to build a CLI tool to send commands to a Redis server, it’s a nice challenge to compliment the build your own Redis challenge. If you’re not familiar with Redis you can learn all about it in that challenge.
Step Zero
In this introductory step your task is to set up your environment up ready to begin developing and testing your solution.
Choose your target platform, set up your editor and programming language of choice. I’d encourage you to pick a tech stack that you’re comfortable doing both network programming (we’re building a tool that is a network client) and test driven development (TDD) with.
Once you’ve done that you might like to?install Redis?itself so you can use it to test your CLI tool implementation against.
Step 1
In this step your goal is to build the functionality to serialise and de-serialise Redis Serialisation Protocol (RESP) messages. This is the protocol used to communicate with a Redis Server. Throughout this step you may wish to refer to the?RESP protocol specification.
Redis uses RESP as a request-response protocol in the following way:
In RESP, the first byte determines the data type:
领英推荐
RESP can represent a Null value using a special variation of Bulk Strings:?"$-1\r\n"?or Array:?"*-1\r\n".
Now that we have the basics of the protocol, your challenge is to write the code required to serialise and de-serialise messages. My personal approach to this would be to use?test-driven development?(TDD) to build tests.
Continued...
You can find Step 2 and beyond on the?Coding Challenges?website as write your own Redis CLI Tool.
Or if you'd rather get the whole challenge delivered to you inbox every week, you can subscribe on the?Coding Challenges Substack.
When you’re ready, there are 4 ways I can help you:
I help you master Test-Driven Development (TDD)
10 个月A new banger challenge just dropped! ?? For CLI tools, I usually use Rust, highly recommend to everyone!
Chief Architect @ AppOmni
10 个月I wish I had someone curating challenges like this for me earlier! Thanks, John.
Software Engineer | JavaScript | Docker | FullStack Developer
10 个月These challenges are amazing actually. I once built my own Redis and it was an amazing learning journey. Might try building a grep sometime. ??
Writes System Design Newsletter ? I Teach You System Design
10 个月loving these challenges, John Crickett. Thanks