Reading the java programming lanugage specification - java

I am preparing for SCJP 6 exam and I needed advice on the usefulness of reading the Java language specification. As the exam has to do with ones expertise in java code analysis. I am already reading SCJP A comprehensive by Khalid Mughal.

Also look at this also,
Don't miss this book for SCJP.

Perhaps useful, but not to prepare for the SCJP.
The SCJP tests your knowledge of the java.lang, java.util, java.io, and other core packages.
The language spec goes into the kind of detail that someone writing a JVM would need. It's not necessary for the SCJP.
But if you're game to dive in, I would not discourage you. Just understand what you'll get out of it and weigh that against your time constraints and opportunity costs.

My advice is this: Go to TopCoder, go to the algorithm section, look at solutions there. This serves three purposes, 1) You get to see how people obfuscate code, which is how it looks on the SCJP 2) You can see solutions and mistakes of people that have submitted and 3) It will give you a look at new problems and ways to test your Java knowledge, as well as your overall programming knowledge.

The book mentioned by org.life.java gives specific example of people who pass with very high correct answers rate. They simply write programs. A lot of programs. So if you want to pass this exam without an issue, all you have to do is just code. A lot.
Good luck!

Related

C++ coming from Java and Objective-C

So, I know both Java and Objective-C quite well, but (perhaps strangely) never really learned C++. Obviously, the languages are all related, but there are syntactical differences that I don't fully understand. Is there a nice document that describes the basics of C++, but still assumes the learner knows a programming language? Perhaps even a tutorial that aims to describe the differences between the languages. This is what I'm looking for.
Also, is there a good tutorial on how to use C++ code inside a Mac or iOS app? The reason I feel the need to learn C++ is I'm trying to port a C++ program, and I heard you can use C++ code and just wrap it in an Obj-C GUI. Could someone point me to some documentation/tutorials on how to do this?
Thanks!
Even though the languages of this family are all related, that does not mean that you can casually move from one to the other and expect to write beautiful code. You have to learn the language's idioms and idiosyncrasies, and experience its strengths and way of thinking.
I would recommend reading Stroustrup's original book (a modern edition, of course). It's the most definitive reference (short of the actual standard) and it is very clearly written. The benefit of this approach is that you will be taught to think "how would I do this in C++", rather than "how do I transliterate this piece of Java code to make it compile". (Also this approach does away with any risk you might have of thinking you should "learn C first". Don't.)
On MacOSX, either download and build the free GCC, or get XCode (which comes with GCC). For iOS I don't know, I have a suspicion that you cannot deploy native code on it.
I would go for a pure C++ route, the quality of the material being the guide rather than finding ObjC+Java->C++ material.
At the university I am working for we have tried both ways for teaching C++ to students with a lot of programming experience, in particular Java experience, for obvious reasons.
The conclusion was that the specialized course did no better in teaching C++ than the generic one with some extra exercise materials. It's the quality of the teaching materials that matters.
Edit: You will probably receive a lot of good answers on the actual differences, also Voo's comment on your question is relevant.
I know what you feel - to have already worked on a couple of languages and learning C++. I was in the same boat too. While I was thinking for a while that it should be easy for me to learn it right away, it wasn't all that easy. So then I went back to the basics and started as a fresher to learn C++. 'C++ Primer' is an extremely good book to start with. Since you know most of the basics of programming, some of the first few chapters can be skimmed through. Once you are through with this, I'd recommend 'Effective C++' book and the C++ FAQs maintained here [http://www.parashift.com/c++-faq-lite/].
In fact, you could go through this FAQ first and see how much of it makes sense, and use that as a guide for figuring out where to do a deep dive.
HTH, K

Clojure presentation for beginners?

I need to make a presentation for beginners about the Clojure language. What are your suggestions on selecting topics on it? What are the points I need to include?
Note: By beginners, I mean that they are experienced in other programming paradigms, but not in the functional programming model.
I personally think this presentation is a great introduction to Clojure:
Clojure:Functional Concurrency for the JVM - Howard M. Lewis Ship
And obviously any presentation by Rich Hickey himself, for example
Clojure: A dynamic programming language for the JVM
You've got to think about your target audience. I'm going to make an assumption that they probably know Java.
The best authority on Clojure is the source himself, Rich Hickey. He's written an introduction to Clojure for Java Programmers.
Slides are here.
Him giving the presentation with audio is here and part2 is here.
If need, you can take my presentation about Clojure - PDF is freely available...
I found this blog entry yesterday -- impressive how easy is to make Clojure programs parallel (pmap in place of map :D ). Sadly, on my PC it didn't run on multiple cores but I haven't investigated it yet.
Use examples from books like Joy of Clojure -- they are very idiomatic and well designed. In this book there are also reasons on design of language and -- what is most important to you -- why functions+immutability is better for multithreaded programming than procedures+OO mutability.
Yes, I think parallelism is important to tell. But also -- in my opinion -- it is always crucial to convince non-lisp-listeners that The Parentheses Hell is not a hell but blessing ;) Tell about Beating the Averages and why Lisps are the most powerful languages in the world.
Try not to teach them a language but show why to learn it.
Oh, and prepare that someone in the audience will ask "why no for loop" or "why no constants" or "how come immutability doesn't lead to performance problems".
I would demonstrate the basics of the language by firing up a REPL and running through a bunch of basic language features, slowly building up to something more interesting.
This Clojure quick tutorial gist may give you some ideas.

Where to start if I want to understand how compilers and programming languages are made [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Learning to write a compiler
I know this is a broad question to ask, but where could I start learning how compilers actually work, how programming languages are made, I mean not how you use Java or Ruby but how people actually are making them. I will not try to replicate these languages in any ways but I want to understand the concepts and theory behind it. So what I need is either some directions on what I should search for, or even better and more appriciated are book recommendations.
Regards,
Jonathan Nash.
You might find Lets Build a Compiler by by Jack Crenshaw an interesting introduction.
Kept very simple and focussed on building actual functionality.
Compiler Constrution by Niklaus Wirth is pretty good and available for free from the link I provided (yes, legally). It's a bit old and uses Oberon for the examples but is easy to follow.
Create Your Own Programming Language by Marc-André Cournoyer is available online for USD 40 and consists of an eBook (including exercises and solutions), source code for two example languages (one in Ruby and one in Java) and a screencast on extending the JVM based language. This is probably the most newbie-friendly introduction you can find on the topic and afterwards you should have a pretty good idea about the steps involved (tokenizing, parsing, lexing etc.) and can continue your research with the provided links. It's a bit expensive, but IMHO it's worth it.
While not primarily a learning resource, the CoffeeScript web site has a section called "Annotated Source", which is really helpful in seeing how a programming language works. CoffeeScript's author started working on it after he read the book I mentioned in the previous bullet point btw.
You could take a look at the Dragon Book:
Compilers: Principles, Techniques and Tools by Aho, Lam, Sethi and Ullman
I've greatly enjoyed Language Implementation Patterns and learned a bunch. I wish I had read it before trying to implement a DSL some years ago.

Java - How to refresh knowledge? (2 years ago)

I have my first ever interview for a Java developer role, specifically RMI, Serverlets and JDBC.
However, it has been a while (2 years) since I have done any Java coding. I am sure I still have it up there somewhere and I do remember the Java syntax
I wanted to ask how can I re-fresh everything in 2-3 days specially the OOP concepts (polymorphism, inheritance) specifically to Java?
Any links, references and tutorials appreciated.
I am new to this site and I see there is a preference for programming related questions, hope I can get away with this!
Would also appreciate those that know any Java interview questions so I can go through them and test myself.
Thanks all
I'd suggest you you test yourself, e.g. on Java Black Belt, which has a good question base grouped by categories and detailled explanations for your mistakes.
I'd also recommend (re-)reading Sun's Java Tutorial and (longer) Thinking in Java by Bruce Eckel (3rd edition is free to download).
Tutorials on RMI
Java Servlet Technology
JDBC Tutorials
OOP concepts (polymorphism, inheritance): Head First Design Patterns
Java Interview Questions
How about this. Take a certification guide. It will save you a lot of time, and give you an exercise after every chapter (might give you some interview questions). You don't need to bore you down to death by teaching yourself in a wordy way, what you might already know. The best would he Khalid's Java Certification Guide. Believe me it would be faster and more effective. Plus give you the skills for appearing in the test for real, if you like to. :)

Knowing C++, how long does it take to learn Java? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am a competent C++ developer. I understand and use polymorphism, templates, the STL, and I have a solid grasp of how streams work. For all practical purposes, I've done no Java development. I'm sure some of you were in a similar situation at one point when you had to learn Java. How long did it take you to become a competent Java programmer?
I think that learning the language is not difficult. In fact, I used to be a full time C++ developer, and at some point I started writing Java code. But the thing is that I don't remember ever learning Java, so I guess I just figured it as I went. I've been doing full time Java for a long time now.
If you are well familiar with C++, you may want to read a list of the major differences (e.g., everything is dynamically-bound) and then start practicing on an environment (just download Eclipse). The small differences are the main thing you would have to get adjusted to.
Now that Java supports generics, one of the major switching pains is gone. Multiple inheritance, while not supported, is not a big deal if you get used to interfaces, and in fact having interfaces rather than abstract classes with pure virtual functions (PVFs) improves readability.
To me Java is a nice and friendly and relaxing sandboxed version of C++. I don't have to worry about general protection faults (GPFs), I don't have to worry about memory leaks, I don't have to worry about messing with pointers. However, don't let that confuse you, there are still plenty of opportunities to screw up royally, and they're sometimes even nastier to detect.
Just take the leap. If you have the instinct, it shouldn't be a problem.
I went the opposite way. Started with Java, then moved to C and C++. For my own personal experience, it was much easier to learn Java than C/C++ (C++ especially).
Java in many ways is meant to be C++ with many of the undefined and unnecessarily complicated portions removed or simplified. IMHO, it had great success with that goal. As a result it's a very easy language to learn and use. Especially for someone who is familiar with C++.
The actual time it will take is very dependent upon the person learning the language. However, I think it's safe to say it will take less time to become competent in Java than it did in C++.
Shouldn't be too bad. The syntax and classes should be very easy for you to grasp. There are some differences but none of it is too challenging.
The hardest part is more about learning the packages, since those will be different. The built in Java classes and functions, and then to use Java in a practical manner, you'll need to learn J2EE or whatever you might be actually using it for. The latter part will probably take more of your time than the language itself.
If you're already a competent programmer (especially in C++) then Java doesn't take long to learn at all. The books I would recommend (in order) for anyone who wants to learn Java are:
Head First Java
Thinking in Java
Effective Java
You may find that you zip through Head First Java rather quickly, given your experience. For that reason I suggest you check it out of the library and skim it before moving on to Thinking in Java.
Also check out Sun's Java Tutorials.
C++ to Java: 1 week.
Java to C++: 1 month.
As Tom Hawtin wrote, the key issue is how you define competent.
You'll be able to pick-up the language fairly easily, but it's the idioms and the libraries that you will have to learn. And there are quite a few differences between niches you work in (e.g. embedded or enterprise), and between libraries that supposedly solve the same problems. Here are a few examples:
In business/enterprise apps, you generally work with databases. There you can have:
plain JDBC
SQL mapper (iBatis), wrapper around verbose and repetitive JDBC
ORM solution (Hibernate), with a philosophy of it's own
With desktop UIs, you have two competing platforms:
Swing, a part of JRE
SWT/JFace, from Eclispe foundation, originated by IBM, with native UI support
Web frameworks are too many to mention, with different ideas of representing the UI, configuration, folder/package structure etc.
DI (dependency injection) is common in business apps, either by 3rd party frameworks like Spring, or as a part of EJB3 standard. But, I don't think it is ever used in embedded set-up.
It would be fair to say this is just a tip of the iceberg.
Back in 1995 when I did it, it took me about half a day to get comfortable with the tools and basic ideas, a day or two to get the language, a week to get the more obscure parts of the language (there were less of them at the time) and a month to get the libraries (there were WAY less of them at that time).
Now I would guess that the tools and basic language will take as much time, a couple of weeks to a month for the obscure parts of the language (depends on what parts you hit, and when). The basic libraries will be a month to two months (java.lang, java.util, and a few others). The remaining class libraries 6 months to forever depending on what you need to learn and how often the keep updating them :-)
I know C++, and had to work with Java once and picked it up in 2 weeks. Of course there were quite a few surprises but it's easy.
I have C++ background. Picking up Java took me few days - the language seems really simple - at least its basis. I still consult my Java guru - google quite a bit, but it's usually a matter of exploring API and standard libraries. Java has some annoyances, but you should spot most of them them easily and quickly.
I was recommended Thinking in Java (there's an ebook for free), but was never persistent enough to read through it. I don't write rocket-science code in Java and to do it, my skills are sufficient.
Having said that, it would be good to have better formal knowledge of the language. At the moment I'm thinking about studying for SCJP, which seems a sensible way of learning, plus you will get well-recoginized programming certificate once you pass it (I've heard it's not worth much, but still it may be a motivation...).
You can also try Java Black Belt - the answers frequenty surprises me. After taking few tests I wonder how my programs even compile, which suggests I'm probably not the most competent Java programmer around :)
How would you define competent? For my money, most professional (as in they do it for money) Java programmers never manage to reach competent.
These days, a programming language derives much of its power from its libraries and accepted idioms.
While it takes relatively short time to learn the Java language, learning to use the available libraries (collections, io, etc.) effectively will probably take significantly more time.
I think there are two approaches to meaning of term "competent Java programmer".
If it is about lexems, syntax and terms of OOP I began to completly understand Java before 2 (two) days of learning.
But firstly you will be charmed by impossibility to shoot your own leg ;)
But if it is case of embeded class system (i.e. packages), APIs references, tips-and-tricks and etc., it takes about half-year to feel yourself friendly with Java. I think.
I too learnt C++ first and then Java. It took very less time as I was already familiar with OOPS concepts. In the initial phase of learning I was really happy with new concepts in Jave like garbage collector. I referred The Complete Reference by Herbert Schildt and it did help me to get the syntax quickly.
I started from C++ and learned C#/.NET. That didn't take long.
As C#/.NET is developed very near to Java (they used many of Java's base techniques such as GC, reference classes, JIT, ...) I think it is not that hard to learn Java.
I would go with six to eight weeks.
Shouldn't take you more than a day or two to learn the language, but you might have to spend a few weeks on the class library: how to use collections, the concurreny package, reflection, logging, swing/awt, dynamic proxies, MBeans etc.
i learned c++ at a small age of 15 and became a professional software programmer. But when i searched for job there was only job available for java developers.I thought it was hard to change my language.So just for trial i Downloaded java compiler and just for fun typed some code and i found it is not much different than c++. and only after 6 hours of research and learning i became a java developer .so it is very easy to switch between c++ to java.

Categories

Resources