Skip to main content

Posts

Showing posts from September, 2019

Hackerank Q&A

HACKERANK SQL PROBLEMS. Question: Generate the following two result sets: Query an  alphabetically ordered  list of all names in  OCCUPATIONS , immediately followed by the first letter of each profession as a parenthetical (i.e.: enclosed in parentheses). For example:  AnActorName(A) ,  ADoctorName(D) ,  AProfessorName(P) , and  ASingerName(S) . Query the number of ocurrences of each occupation in  OCCUPATIONS . Sort the occurrences in  ascending order , and output them in the following format: There are a total of [occupation_count] [occupation]s. where  [occupation_count]  is the number of occurrences of an occupation in  OCCUPATIONS  and  [occupation]  is the  lowercase  occupation name. If more than one  Occupation  has the same  [occupation_count] , they should be ordered alphabetically Answer:   select ( case when occupation= "Doctor" then concat( name ...

Reading on Clean Code by Robert

CLEAN CODING Cost of owing a mess is high. When starting to program your project the speed and efficiency will be high. But by the time you get to the end of it , if the coding is bad you will run in to troubles more often. And lots of time will be wasted on it. The code should be comprehensive.simple and tidy.  Because the debugging process mostly consists of reading time. You will need time to read the code again to understand what happened. The debugging employee will run in to trouble else. Starting from the beginning keep it clean and tidy.  No need to go fast . Keep it simple and take time to write the code cleanly. Clean code consists of : Runs all the tests contains no duplication Expresses all the design ideas in the system. minimizes the number of methods functions and classes.  Boy scout rule " Leave the campground cleaner than you found it " Meaningful Names Use intention-revealing Names int days; int daySinceCreation; int fileA...