{"id":296,"date":"2008-01-28T02:59:41","date_gmt":"2008-01-28T06:59:41","guid":{"rendered":"http:\/\/www.rakkar.org\/blog\/?p=296"},"modified":"2008-01-28T02:59:41","modified_gmt":"2008-01-28T06:59:41","slug":"3000-lines-of-code-in-2-days","status":"publish","type":"post","link":"https:\/\/rakkar.org\/blog\/index.php\/2008\/01\/28\/3000-lines-of-code-in-2-days\/","title":{"rendered":"3000 lines of code in 2 days"},"content":{"rendered":"<p>\t\t\t\tThis lobby server is turning out to be much more involved than I originally thought.  I have to write every query between 6 to 11 times.<\/p>\n<p>For example, to add a friend to the friends list for a user I have to:<\/p>\n<p>1. Query the user for the friend<br \/>\n2. Validate the inputs on the client (we are connected, etc)<br \/>\n3. Serialize the inputs and send them to the server<br \/>\n4. Deserialize the inputs on the server<br \/>\n5. Check the inputs for sanity (don&#8217;t add yourself as a friend, you are connected, &#8230;). If bad, reply back.<br \/>\n6. Serialize the inputs again in database format, and send to the DB thread.<br \/>\n7. Deserialize the output from the db thread<br \/>\n8. Parse the output from the db thread (doing the actual work of maintaining the internal friends list).<br \/>\n9. Serialize the reply back to the client.<br \/>\n10. Deserialize the reply from the server on the client.<br \/>\n11. Parse the reply (modifying our friends list), and call the output callback for the user.<\/p>\n<p>That&#8217;s not even counting that this relies on another previous query to ask\/authorize a friend invitation.<\/p>\n<p>This would be even harder and more involved if I had not yet already wrote and tested the DB queries in 3 other projects!<\/p>\n<p>So I did 9 client commands in 2 days for about 3000 lines of code.  I have like 50-60 more commands \ud83d\ude41<\/p>\n<p>The good part is the only painful commands left are the ignore list (which is easier than friends) and sending emails. Friends was probably the hardest to do.<\/p>\n<p>I&#8217;ve sort of skipped per-user permissions for now, and moderator commands.  Those will also be very involved and painful.\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This lobby server is turning out to be much more involved than I originally thought. I have to write every query between 6 to 11 times. For example, to add a friend to the friends list for a user I have to: 1. Query the user for the friend 2. Validate the inputs on the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/posts\/296"}],"collection":[{"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=296"}],"version-history":[{"count":0,"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/posts\/296\/revisions"}],"wp:attachment":[{"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rakkar.org\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}