"Are you Paying Attention: Edition 2": Java and more: If computer programming is an art – what is Monalisa? #covid19 lockdown special
6 blocks for Young Java Professionals, College/school students/teachers for your campus interview, lesson prep for teachers or interview prep for those in challenging situation of a job search during covid19 lockdown and young professionals for your first few years of professional coding
Co-written by Debashis Banerjee / Nitesh Kumar
If computer programming is an art – what is Monalisa? While this may have many answers we hope this blog may help you be empowered with a few more brushes and brushstrokes to turn your Core Java programs and in general your software skills into a more refined art. A couple of months after the first edition of "Are you paying attention?" which was on data science this time it's a joint effort by Nitesh Kumar and myself as we turn to Java in this edition.
As a Niti Aayog ATL Govt of India innovation mentor of change I’ve seen teachers, parents and mentors rightly take initiative to introduce programming languages like java going earlier into student’s curriculum and self-reading via online learning. The initial focus rightly so is on syntax. As students, young professionals we start with the basic brushes, the base colours of programming. The next steps are how do we turn this knowledge into a rainbow continuously. This could be to crack the campus interview, overcome any prep required during the tough covid-19 job loss situations or equip our young programmers in schools and colleges to think broader. The intent is also to show a little bit of a peek into the minds of professional interviewers or product needs which go beyond the syntax. There are multiple websites you can go to for practice problems which are excellent, and this is intended as a add on to the “thinking behind the problems” when you see them or are asked one of them.
Suggested method to read this blog – read a section, have your IDE nearby, and possibly a pen and paper nearby – attempt to reach each element and aim to remember or use it as a pointer to dive deeper to test and build your knowledge.
- Block 1: “A use case and related Questions that lead to solving “Hard Problems” Uses a shopping example on any website (which most students or young professionals will be aware) and asks some “hard” questions to provoke thought as to why “programming” is beyond syntax. The recommended way to read this is to read each question – try to think of challenges and then see how you may solve them as a software professional.
- Block 2: “The language concepts, syntax and usage”: A small listing of terms of core java language – the recommended way to read this would be to read a term, visualize an example and a use and if needed open eclipse and write an example.
- Block 3: “The arsenal of tools and artefacts”: This is a set of some example tools and artefacts you may use as a software professional associated with java – as a student or young professional you may not have been exposed to most however knowing and an ability to comprehend why they are needed will give you an edge in an interview
- Block 4: “The difference between a good program and a great program”: This section gives you a set of concepts that when applied in conjunction with block 1 questions and using block 2 elements and block 3 tools allow you to answer and expand your program from being a “good” one to a “great one”
- Block 5: “Food for Thought to Spark your imagination”: This gives 3 forward thinking elements about programming and how you can think about keeping in mind of what programming could be 10,20,30 years from now.
- Block 6: “Keep learning and keep innovating”: This section will help you in knowing key areas where individuals should focus to keep update themselves as a software professional.
Block 1: A use case and related questions that lead to uncovering and solving “hard problems”
- Imagine any e-commerce site you use – imagine “Shopping for an item you want from a list of 5 items”
- Map the actors e.g. you (buyer), supplier, platform, payment, approver, documents involved, states - Map the systems, o Try to model into java elements What data structures would you choose? o How would you search for the item you want? Now try to imagine “you and your friend trying to buy the same on the day of a sale”
- Is the contention of resources? Will you need to do things in parallel?
- What if you and your friend are on opposite ends of the world?
- Imagine this is used by 100,000 users, then 1 million, then 100 million to buy 1 million items – how do things change?
- Imagine now needing to search for an item within the 10 million items – would you change how you store the data?
- Imagine needing to debug and solve a priority customer issue in the 10s of thousands of lines of code – how would you add logs to your code?
- Imagine trying to ensure you write the most secure code? What elements would you put?
- Imagine being told what you build should be reusable across multiple other products? How would you modularise?
- Imagine people in various countries who don’t understand just one language need to access? Would you change how you code?
- Imagine people who are based in different continents need to use your product?
- How would you enable people who are differently abled (e.g. deaf, blind) to use your product?
- What if the buying happens on a mobile, or a tab instead of desktop – does how you write the programs change?
- What if the network speed when they buy are slow or fast – will you change things in your program?
- You find an error? How fast can you get a fix into production?
- How will someone who needs to know what is a valid error or how it works know where to find the documentation or limits? How will you prevent someone from calling your program more than the limit?
- What would you do if you want another website which buys/sells products and wants its own user interface to use your data and some logic – what kind of APIs would you build in?
- How would you ensure if you make a change you can run Unit and functional tests?
- Has someone built similar things like you have – are there design patterns existing?
- How will you know when someone is breaching a threshold? Are you monitoring something?
- How would you selectively enable only one part of your program to work for one set of users and another part for another set? (e.g. A/B testing)
- Do you know how to measure if your program/page works well as each programs call each other? Time to load? What are they in different layers? How do you measure?
- How will you know if your program/API is being used by other programs?
- How you can design a system which can handle 100,000 requests per second. What should be your focus area?
- How you can prevent bot spamming in your system?
Block 2: “The language concepts, syntax and usage” – some topics
Here are some Concepts in core java you may want to review:
- Variables, constants, static variable
- Byte, short, int, long, float, double, string, array, enum
- Type casting – implicit, explicit, impacts on precision, Autoboxing/unboxing
- Operators – arithmetic, assignment, Boolean, String operators – equals, concat, replace, indexOf
- Traversing via – switch case, while, do-while, for/for each loops, difference between break/continue, reading in data (scanner)
- Packages, Classes, Objects, Methods, Constructors, Destructors, Getters, Setters, toString, pass by value/pass by reference, Composition vs Aggregation, Inner classes, anonymous inner classes
- Scope , Access modifiers - default, private, public, protected
- Inheritance , Encapsulation, Polymorphism, Interfaces vs Abstract class, has-A vs is-A, Extends vs implements, Multiple inheritance , final method/variable
- Exceptions – try/catch/finally, catching multiple exceptions in order, checked and unchecked exceptions, throw vs throws
- Collections, ArrayList, LinkedList, Stack
- Queue, DeQueue, Array backed queue, LinkedList backed queue, priority queue, blocking queue, ArrayBlockingQueue, LinkedBlockingQueue, LinkedBlockingDequeue,
- Set, HashSet, LinkedHashSet, TreeSet, Map, HashMap, TreeMap
- Iterators, CompareTo vs Comparable interface
- File – File, BufferedReader/Writers, Scanner, deleting file, try with resources
- Serialization of objects – why, Serializable implementation, e.g. File Input/Output streams
- Thread, thread states – new, runnable, running, blocked, terminated, start, run, sleep, Runnable interface, Synchronized – method, block, static synchronization, volatile, Wait, notify, notifyAll, Interrupt, join, Thread Pool, ExecutorService, Count down latch, Reentrant lock, Thread Deadlock and how to avoid.
Block 3: “The arsenal of tools and artifacts”
Most of the tools mentioned below are open source or free to use for individual person so check the licensing where you need to download and try them out.
- Eclipse IDE or any other IDE of choice – remember there are auto generated code, shortcuts, plugins which are useful e.g. checkstyle
- Junit: Unit and Automation testing
- Memory analyzer: Eclipse Memory Analyzer tool
- API client testing: Postman
- Logging: tools such as Splunk
- Javadoc: Write doc comments for Java Doc tool
- A requirements and design document - high level, low level
- Traceability matrix from requirement, design, task tracking (like jira), to code
- Sites such as Stackoverflow for checking historical issues and publicly available answers.
- GIT repository – push, pull, branch, merge, conflict, local repo, master, staging, working tree,
- Fortify, sonar: security vulnerability tests, static analysis
- Code Review Tools – do code review in git (practice reviewing other’s code)
- OS Level Virtualization Tools – Docker & Kubernetes
- Load Testing – Blazemeter – a load testing platform.
- Penetration testing Tools – OWASP, one of the open source tool.
- Cloud Platform – SCP, Heroku, AWS, Azure, GCP and many more.
- Hosting Services – Deploying your personal websites or any other work – Netlify
Block 4: “The difference between a good program and a great program”
The difference between a good and a great program could be considering some of the elements below during the design, coding, deployment, reuse and maintenance of your software programs.
- Be aware and always consider Time and Space Complexity
- Choose the right data structures for the problem
- Tune Performance parameters
- Concurrency and threads
- Throughput – speed at which your program runs
- How long do your database queries take to run?
- Monitoring – how is the monitoring of your app and how do you know thresholds, (such as performance/error) are being breached. Observability of the system.
- Caching
- Memory Consumption
- Runtime for a program
- Scalability
- Latency – SLAs, response times
- What kind of requests in your program can cause a large load or memory issue – loading large doc, API responses and how to handle. E.g. pagination in APIs
- Reliability – anticipate, handle, contain failures, have health checks, have rca mechanisms
- Track usage of your program – it it’s an API – calls, if a webpage hits, if it’s a service consider monetizing usage. Tracking things like time to execute / page load times / page load times for parts
- Deployability – how easy/difficult/fast can you deploy your package into production environments – potentially globally
- Performance tests – replay traffic, simulate traffic, chaos monkey simulate chaos
- Check Authentication and Authorization to program, resources, data
- Localization – check if you are coding such that your program can be used by users of different regions with different languages.
- Accessibility – can your program be used by accessible users
- Is your code usable across form factors – mobile, tablet, desktop
- Is your code usable across varying connection speeds – high speed, low speed networks, high quality devices, lower end devices e.g. feature phones
- Think Money! Think about hardware you will need to store the data – as you scale you have to store data somewhere (like a database which could cost money)
- Is your data going to be global? Will you need hardware in lots of global locations? Will it mean more money?
- Open source/Free vs costed tools?
- Is the resource you are using on a cloud or hosted – think money in terms of pay for usage. (Software as a service model)
Block 5: Food for thought & Spark your imagination
- Consider having a public git repo to showcase your work as student if you are personally building something or join and contribute to open source projects. Of course if you are part of a organization take necessary permissions and follow any appropriate policies.
- AI based coding – we have auto generated code; will AI generate code given an intent?
- If you could invent the next data structure? What could it be?
- How would your program for Augmented Reality/Virtual Reality
Block 6: Keep learning & innovating
- If you are a student or a young software professional, you should participate in competitions such as Google Code Jam (international programming competition hosted and administered by Google) to solve set of algorithmic problems in a fixed amount of time.
- Consider attending annual conference events like Google I/O, Apple WWDC and others to know about products roadmap & innovation
- Participate in multiple online/offline hackathons to solve some real life hard problems.
- Lastly, one of the deepest questions in computer science is called P VS NP, and answering the question would earn you a million dollar prize.
In summary, use each of the 6 blocks be it as a student, a young professional preparing for an interview or a teacher preparing your class. Because a complete software professional is one of many things as each of the blocks define – the syntax of the language is just one of them. If you as a reader would like additional things to be added that you can say to help others - pls write it in the comments so others can learn from it or let us know so we may update and make this more complete.
As always keep learning and keep asking yourself - “Are you Paying attention?”
Debashis Banerjee / Nitesh Kumar
Edition 1 of "Are you paying attention?" is available at https://www.dhirubhai.net/pulse/you-paying-attention-edition-1-4-blocks-when-learning-banerjee/ on "4 blocks when learning or teaching Data Science - Tools, Curiosity, Terms and Future learning muscle"
Disclaimer: All views expressed in this blog are those of the authors in an individual capacity and do not represent views of any current/past organizations they are associated with. The authors also do no endorse any products mentioned here via this blog
If you have a suggestion on what future editions of "Are you Paying Attention?" should be on please do message me.