Java and JavaScript

I have been doing a lot with JavaScript lately at my work and wanted to explore the differences between Java and JavaScript here.  I have gotten the question about what the difference is between the two a couple of times and decided I needed to really know the answer, instead of blundering around the answer.

I found this website, HTML Goodies, which had a very helpful article about the similarities and differences between the two.  And after poking around the whole website, I decided to bookmark it for future reference.  They’ve got lots of great information about all things HTML, CSS, JavaScript, and more.  I also found some good information in this book, Beginning JavaScript 4th Edition, by Paul Wilton and Jeremy McPeak.  Another great article is Java vs. JavaScript:  What’s the Difference? from Segue Technologies.

Let’s dig in.

Java JavaScript
  • Object-Oriented Programming language (OOP)
  • Created by James Gosling of Sun Microsystems
  • Creates great web page events
  • Can provide interaction between user and Web page
  • Object-Oriented Programming language (OOP)
  • Created at Netscape, originally known as LiveScript
  • Structures are similar to Java
  • Creates great web page events
  • Can provide interaction between user and Web page
  • Java can stand on its own
  • Larger and more complex, can be used to create ‘standalone’ applications
  • Strict
  • Need all items spelled out clearly
  • Must be compiled into ‘machine language’
  • Once compiled, it is set and can be run multiple times
  • Can change original code, but will need to re-compile before running
  • Java applets (small applications) run independent of the HTML document that is calling for them
  • Delivery of Java applet is done through a download to the user’s cache
  • Compiled usually just one time and then can be referred to multiple times.
  • Spanish to English translation example:
    • Restaurant menu written on paper – it doesn’t need to be re-translated each time you look at the menu
  • Much simpler, fewer commands
  • Must be placed inside HTML
  • Text-based, interpreted by the browser, not compiled (computer does not understand JavaScript until it is converted/translated into machine code, binary 1’s and 0’s)
  • Must be re-interpreted each time the code is run
  • You can alter it after it runs and run it again and again.
  • JavaScript relies on the browser to understand it and make it come to life
  • Some commands are known as Event Handlers
  • Spanish to English translation example:
    • Live conversation = What did he say?
      • “Buenas Dias.”
    • What did he say now?
      • “Buenas Dias.”

There are lots of JavaScript scripts (one example)  and Java Applets too (one example) available on the internet.

* A note about OOP – it’s short for Object Oriented Programming.  The program contains objects.  A very good example that I have run across multiple times is the car.  A car contains an engine, which is an object.  The engine can be an engine all by itself, so it is it’s own object.  The seats are objects too.  The transmission is an object.  The steering wheel is an object, and so on.  All of these objects exist on their own, but it is not a total and complete car until all of the ‘objects’ are put together to make up the car.  Another key point is that the different objects are made up of certain classes of parts.  Engine parts don’t belong in the interior and leather trim and lug nuts don’t belong in the engine.  The object called Engine is made up of the class of parts called EngineParts.  The object called Interior is made up of the class of parts called InteriorParts.

Debugging

These days, I’m doing a lot of debugging and testing.  It doesn’t feel very glamorous, but I know that it is extremely important, not only to the end user’s experience, but also to the integrity of your product.  I found this quote recently: “Debugging is the process of testing, finding, and reducing bugs (errors) in computer programs.  The first known computer bug was a real bug (an insect), stuck in the electronics.”
Cute – I always wondered where that phrase/word came from.

Just recently, I found a misspelled word on the footer of our program.  It’s a pet peeve for me and I have submitted the updated file with the correct spelling.  Your company website, your software product, and everything else projects an image about your company to the world.  If you have an outdated website, but claim to have a really cool/great software product, I’m probably going to be a bit skeptical.  There’s a saying that ‘image is everything.’  The substance of the product is important, but if I can’t get past the outdated website, it doesn’t matter how great the product is.

I’m also learning a lot about JavaScript and have been spending time here reading up on it.  They say that the best way to learn a language is to immerse yourself in it, and I have found that to be true for coding as well.  Taking a class on JavaScript is one thing, but working with JavaScript (and HTML, CSS, SQL, XBasic, etc) everyday takes it to a whole other level.

SQL Authority

I have read many posts on Pinal’s blog, http://blog.sqlauthority.com/, over the last 2 years and just wanted to write a quick post giving him a shout-out. I really like the step-by-step way that he describes some SQL-related process. And just recently, the comparison of developers to Iron Man and Chhota Bheem are fun articles that I particularly enjoyed. Thanks Pinal – keep posting awesome-ness!

On a side note, I have not posted anything since the beginning of May (or maybe the end of April!).  I do plan on writing more and writing regularly – it was kind of a crazy month in May and then June has been more like ‘finding my sea-legs’ at my new work.  I’ve transitioned careers and am now working as a database developer and programmer for a small software company.

Peace out!

Co-op Highlights 15

This is my last post for this semester, but not my last post ever.  I will be continuing to post regularly on topics and research as I run into things.  I also plan to use this website as a portfolio to highlight different projects I have been involved in and code that I have written.

I found this great website in the course of research about Google Charts API.  This is going to be key in the next week as I work to enhance the Google Charts running on my capstone project, also known as VARI.  As of last week, I was able to add a rough chart based on a basic array.  This article from Dot Net Fox talks about binding data from a SQL database, which is exactly what I’d like to do.  My goal with VARI is to show several different charts, but I am still exploring what those will be.  I’d love to show a stacked bar chart or a pie chart showing the different portions that make up the total (the number of children, students, sites, and main auditorium numbers totaling the overall weekend number), for example.  I’d also like to show some sort of year at-a-glance bar chart by location.  I believe there is a way to add a dynamic data control with Google Charts, so that a user could choose a date range and choose a location, and then see a chart based on that input.  I have not found a good resource out on the internet for this yet though.

In my research over the last couple of weeks, I also found this article that talks about the advantages and disadvantages of using SQL DataSource, LINQ to SQL, and EntityDataFramework.  This was helpful and it seems that there is no clear ‘right’ answer to the question.  The last sentence of the article sums it up well:

“But remember, you can also mix the use of different DataSources in your WebForms, using the most appropriate choice for the task in-hand.”

Use the most appropriate tool for the job.

Another great web article that I found talks about using MVC and WebForms in the same project.  And, that’s what I’m attempting to do with VARI, my capstone project.  I created everything in MVC with Razor view, and then have added a couple of WebForms pages to show the reporting elements.  I’m not sure if it’s the very best way to do it, but it does seem to be working fine.  From what I can tell, there are good things about both MVC and WebForms.  I anticipate the next generation of MVC to incorporate a little more WebForms-like pieces OR WebForms incorporating a little more of the MVC-like pieces – it reminds me of the Reeses Peanut Butter Cup commercial – “who put their chocolate in my peanut butter?” vs. “who put their peanut butter in my chocolate?”  Once both people taste the final product, they both love it!  I could be totally wrong (since there’s a lot I don’t know!), but it feels like this is the direction things are moving.