Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Thursday, May 2, 2013

Top web Sites implementations


Here are the web technologies used to build the most famous and largest web sites in the world, you can click on the links if you want to see references or more details.


Facbook.com
written in PHP, C++ and Java

data is output in PHP format (compiled with HipHop for PHP). The backend is written in Java and Thrift is used as the messaging format so PHP programs can query Java services.here

HipHop converts PHP into heavily optimized C++ code, which can then be compiled into an efficient native binary. the company's engineers reported that it reduced average CPU consumption on Facebook by roughly 50 percent. here

eBay.com
from Perl .. to .. XSL(front end) & C++ (back end) .. to .. XSL (front end) & Java (back end)

Youtube.com
written in Python

Twitter.com
from Ruby on Rails .. to .. Scala .. to .. Java

James Gosling explaining why twitter moved from ruby to java


Amazon.com
written in C++ and Java with Oracle database engines on Linux-based Hewlett Packard servers

LinkedIn.com
written in Java

PayPal.com
written in C++

Wednesday, October 5, 2011

If a programming language was a boat

I saw this article in a programming forum and I found it nice and accurate in describing programming languages and shows us the difference between them in a simple way, so I copied it here for you.

Java
Java is a cargo ship. It’s very bulky. It’s very enterprisey. Though it can also carry a lot of weight. Will carry a project, but not very fun to drive.



Perl
Perl is a tugboat. Powerful enough to tug Java around, in 80 characters or less.



Ruby
Ruby is difficult to describe. It’s sleek, sexy, and very fun to drive. Here’s a picture. Very trendy.



PHP
PHP is a bamboo raft. A series of hacks held together by string. Still keeps afloat though.



C
C is a nuclear submarine. The instructions are probably in a foreign language, but all of the hardware itself is optimized for performance.



C-sharp
Like a luxury cruiser. Sleek, good looking and quite comfy. However, not very fast , expensive and somewhat limiting.



Visual Basic

As time went on you realized it was completely bloody useless.



HTML

HTML isn’t really a programming language boat.



Python
Undeniably beautiful and elegant in the water, tends to be solid and reliable. Will work with little intervention, but also provides sails to help you go that little bit faster.



Javascript

Like James Bond Q Boat. It’s small but powerful and it’s really easy to get yourself killed trying to use it.



FORTRAN77

A concrete boat that still lurkes under the surface. You wouldn’t want to set sail with it though. Try navigating around it.



Monday, June 27, 2011

When to use static nested classes?

It may be confusing at first that, which one to use when using nested classes? static nested classes or inner classes? and in this article I will answer this question for you.

first:
the use of terms:
A nested class is a class which is contained in another class at the source code level.
If you declare it with the static modifier, then its name is static nested class.
A non-static nested class is called inner class.

second:
the key differences between static nested classes and inner classes
static nested classes:
1. They do not have access to the fields and methods of the enclosing class.
2. they can be instantiated without a corresponding instance of the outer class.
inner classes:
1. inner class has an implicit reference to the enclosing class, so they have access to the fields and methods of the enclosing class even if they are declared private.
2. they cannot be instantiated without a corresponding instance of the outer class.

third:
when to use nested classes in general?
if you just want to keep your classes together if they belong typically together or if you need a class that do some functionality that is exclusively related to the outer class, The nesting creates a type of namespace. To denote a nested class from outside its enclosing class, the nested class is prefixed with the name of the enclosing class.

when to use static vs non static?
from an OO design point of view you decide which one to use depending on whether you want your nested class to have access to enclosing class members or no, so ask yourself, does your nested class need that access?
it is a better idea if you are using a nested class is to start off with it being static, and then decide if it really needs to be non-static based on your usage.

to fully understand the decision rule we can see a practical and real example that is in LinkedList class
note my comments beside the code.


public class LinkedList
{
transient int size = 0;

transient Node first; /*LinkedList consists of Nodes so we made it as nested class*/
transient Node last;
...

private class ListItr implements ListIterator { /* ListItr needs access to outer class members to iterate through them, it needs access to size, first and last members, so we made it inner class*/
private Node lastReturned = null;
private Node next;
private int nextIndex;
private int expectedModCount = modCount;
...
}

private static class Node { /*Node do not need access to the outer class members so it is declared as static, Node is the basic unit that consist the LinkedList*/
E item;
Node next;
Node prev;
...
}

} //outer class end

references:
Sybex SCJP for Java platform SE6, Richard F. Raposa
http://stackoverflow.com/questions/70324/java-inner-class-and-static-nested-class
http://stackoverflow.com/questions/253492/static-nested-class-in-java-why
http://www.javaworld.com/javaworld/javaqa/1999-08/01-qa-static2.html
http://www.javaworld.com/javaworld/javaqa/1999-08/01-qa-static2.html