I have two questions regarding the content of your book.
a) Does the book also cover the cryptographical details of the blockchain? Or is the reader expected to know these?
b) I see that there is a chapter on Unit testing the application. Is integration testing also covered?
You should consider making your code more readable, so it's easier to understand for people to review your code. Here are some points to consider:
- You have one long method with nested for/if. Consider using methods. You could, for example, create a method which takes a Strings and a number n as input and prints the string n times.
- Try to find an alternative for the first_time / second_time.
You could use a switch with an enum. This could be an option if you want to reuse the conditions and keep the switch short.
Here is a simplified example. Please note that I do not advocate this pattern, but it might be appropriate in some cases.
Do you also cover the following two topics in your book?
1. Analytics: I believe that a big success factor for such an app is the ability to analyse user behaviour and try to predict what users want. I understand that the book is not about Data Science or Analytics, however, I think it would be interesting to know how to build an app in such a way to make analytics or things like AB testing easy to apply.
I would like to execute Java code which users can enter into a form on a website. The output should be written to the console on my server.
I came up with the following setup:
1) Create a Docker container with a JVM where the code is executed.
2) Use the Java Security Manager to allow only the use of certain (Java core) classes, restrict network access, file access etc.
Here are some examples of website where you can upload code to be executed.
What are your thoughts about this approach? What are the security issues with the above set up?
First of all good luck with your exam. I hope you did some some decent preparation in the past few days.
I passed the OCJP exam about a year ago and would like to give one hint regarding writing code for practice.
Many people point out the importance of coding in Java. This is certainly true, however, I think it is crucial not only
to program "useful" application but play around as much as possible. If you program something real (or some toy project),
you only use certain aspects of the language (usually only a really tiny subset).
So what you might want to do is the following: For every mock-exam question which you do not fully understand, you should
write a few small test programs. Try to code, compile and run every given answer to that particaular question. Make sure you
understand exactly WHY the wrong answers are wrong and why the correct answer is correct. Especially understanding why
wrong answers are wrong will help you a lot during the exam. Also, try to find out what would be the implication if the
wrong answer was right. Would it make sense? Would it cause a conflict?
At some point during your study you should go even a step further and write your own exam questions. Try to make them in
the same style as the actual exam questions. Then do not look at your questions for a while and try to answer them yourself
or even post them for others (to receive feedback). I found that doing so really helps to get a better understanding of things
which are not totally clear to you yet.