Friday 3 January 2014

WHAT IS THE ADVANTAGES OF PROGRAMMING FOR COMPUTER SCIENCE STUDENTS

We use computers today in almost everything we do. You are using a computer when you are texting your friends, listening to your iPod, googling for information, taking a quiz on Facebook, using a debit or credit card to buy a movie ticket, or driving your car. Whether it’s your car’s engine monitoring system, your camera cell phone, the traffic signals on your morning commute, the music you’re listening to or the movie you watched last night, chances are a computer scientist was involved in making it work.
Yet, it was only thirty years ago that the trend to use computers in the home started. Thirty years ago, people started buying desktop computers. Thirty years ago, people started to buy gaming consoles. In only thirty years, computers have become so much a part of our lives that we are often not even aware that we are using computers anymore.
What will the future of computers bring us? Will computers be the tool that helps us find a cure for cancer? Will computers clean our homes for us? Will we have found a way, using computers, to prevent identity theft? Will we be able to interact with a computer as if it was a human being and have computers act as personal assistants? Will we be able to share the advantages that computers offer with remote areas of the world?
In just thirty years, computers have changed the way we think about entertainment, communication, security, technology, and society in general. Will you be one of the driving forces behind the way computers change our society in the next thirty years?
Computer Science is more than just programming and word processing: This diverse field includes graphics, artificial intelligence and robotics, human computer interaction, quantum computing, gaming, security, bioinformatics, legal and social issues, and much, much more. The list keeps changing…


I WANT TO TELL YOU THAT THE COMPUTER IS INCOMPLETE WITHOUT SOFTWARES AND SOFTWARES ARE ONLY MADE BY USING SOME PROGRAMMING LANGUAGES.....SO THE PROGRAMMING IS VERY MUCH ESSENTIAL FOR ALL STUDENTS...THE COMPUTER SCIENCE STUDENTS MAKE THE SOFTWARE AND GAMES  USING PROGRAMMING....ENTERTAINMENT IN COMPUTER IS ALSO WRITTEN IN PROGRAMMING LANGUAGES.,...ALL NOWADAYS IS BECAUSE OF PROGRAMMING FOR EXAMPLE:- ANDROID MOBILES, TAB,LAPTOP,PC E.T.C.......ALL THE WEBSITES ON INTERNET IS ALSO WRITTEN IN PROGRAMMMING LANGUAGES....


FOLLOKWING ARE SOME LANGUAGES:-
C
C++
JAVA
C#
HTML
HTML5
PHP
PYTHON
DOLPHIN
SQL
ORACLE
CSS
XML AND UML E.T.C.

Philosophical Differences Between the Languages

  • There are no unsigned primitive numeric types in Java. While it is universally agreed that mixing signed and unsigned variables in code is bad, Java's lack of support for unsigned numeric types makes it somewhat unsuited for low-level programming.
  • C# does not include checked exceptions. Some would argue that checked exceptions are very helpful for good programming practice. Others, including Anders Hejlsberg, chief C# language architect, argue that they were to some extent an experiment in Java and that they haven't been shown to be worthwhile [1] [2].
  • C#'s namespaces are more similar to those in C++. Unlike Java, the namespace does not specify the location of the source file. (Actually, it's not strictly necessary for a Java source file location to mirror its package directory structure.)
  • C# includes delegates, whereas Java does not. Some argue that delegates complicate the method invocation model, because they are handled through reflection, which is generally slow. On the other hand, they can simplify the code by removing the need to declare new (possibly anonymous) classes to hook to events.
  • Java requires that a source file name must match the only public class inside it, while C# allows multiple public classes in the same file.
  • C# allows the use of pointers, which some language designers consider to be unsafe, but certain language features try to ensure this functionality is not misused accidentally. Pointers also greatly complicate technologies such as Java's RMI (Remote Method Invocation), where program objects resident on one computer can be referenced within a program running on an entirely separate computer. Some have speculated that the lack of memory pointers in Java (substituted by the more abstract notion of object references) was a nod towards the coming of grid computing, where a single application may be distributed across many physical pieces of hardware.
  • C# supports the goto keyword. This can occasionally be useful, but the use of a more structured method of control flow is usually recommended.
  • C# has true multi-dimensional arrays, as well as the array-of-arrays that is available to Java (which C# calls jagged arrays). Multi-dimensional arrays are always rectangular (in the 2D case, or analogous for more dimensions), whereas an array-of-arrays may store rows (again in the 2D case) of various lengths. Rectangular arrays may speed access if memory is a bottleneck (there is only one memory reference instead of two; this benefit is very dependent on cache behavior) while jagged arrays save memory if it's not full but cost (at the penalty of one pointer per row) if it is. Rectangular arrays also obviate the need to allocate memory for each row explicitly.
  • Java does not include operator overloading, because abuse of operator overloading can lead to code that is harder to understand and debug. C# allows operator overloading, which, when used carefully, can make code terser and more readable. Java's lack of overloading makes it somewhat unsuited for certain mathematical programs. Conversely, .NET's numeric types do not share a common interface or superclass with add/subtract/etc. methods, restricting the flexibility of numerical libraries.
  • Methods in C# are non-virtual by default. In Java however, methods are virtual by default. Virtual methods guarantee that the most overridden method of an object will be called which is determined by the runtime. You always have to keep that in mind when calling or writing any virtual method! If the method is declared as non-virtual, the method to invoke will be determined by the compiler. This is a major difference of philosophy between the designers of the Java and .NET platforms.
  • Java 1.5's generics use type-erasure. Information about the generic types is lost when Java source is compiled to bytecode. .NET 2.0's generics are preserved after compilation due to generics support starting in version 2.0 of the .NET Common Language Runtime, or CLR for short. Java's approach allows Java 1.5 binaries to be run in the 1.4 JRE, at the cost of additional runtime typechecks.
  • C# is defined by ECMA and ISO standards, whereas Java is proprietary, though largely controlled through an open community process.
  • The C# API is completely controlled by Microsoft, whereas the Java API is managed through an open community process.
  • The .NET run-time allows both managed and unmanaged code, enabling certain classes of bugs that do not exist in Java's pure managed code environment but also allows interfacing with existing code.

Features of C# Absent in Java

  • C# includes more primitive types and the functionality to catch arithmetic exceptions.
  • Includes a large number of notational conveniences over Java, many of which, such as operator overloading and user-defined casts, are already familiar to the large community of C++ programmers.
  • Event handling is a "first class citizen"—it is part of the language itself.
  • Allows the definition of "structs", which are similar to classes but may be allocated on the stack (unlike instances of classes in C# and Java).
  • C# implements properties as part of the language syntax.
  • C# allows switch statements to operate on strings.
  • C# allows anonymous methods providing closure functionality.
  • C# allows iterator that employs co-routines via a functional-style yield keyword.
  • C# has support for output parameters, aiding in the return of multiple values, a feature shared by C++ and SQL.
  • C# has the ability to alias namespaces.
  • C# has "Explicit Member Implementation" which allows a class to specifically implement methods of an interface, separate from its own class methods. This allows it also to implement two different interfaces which happen to have a method of the same name. The methods of an interface do not need to be public; they can be made to be accessible only via that interface.
  • C# provides integration with COM.
  • Following the example of C and C++, C# allows call by reference for primitive and reference types.

Features of Java Absent in C#

  • Java's strictfp keyword guarantees that the result of floating point operations remain the same across platforms.
  • Java supports checked exceptions for better enforcement of error trapping and handling.

ThingCJava
type of languagefunction orientedobject oriented
basic programming unitfunctionclass = ADT
portability of source codepossible with disciplineyes
portability of compiled codeno, recompile for each architectureyes, bytecode is "write once, run anywhere"
securitylimitedbuilt-in to language
compilationgcc hello.c creates machine language codejavac Hello.java creates Java virtual machine language bytecode
linking in the Math librarygcc -lm calculate.cno special flags needed
joint compilationgcc main.c helper1.c helper2.cjavac Main.java - any dependent files are automatically re-compiled if needed
executiona.out loads and executes programjava Hello interprets byte code
hello, world#include<stdio.h>
int main(void) {
   printf("Hello\n");
   return 0;
}
public class HelloWorld {
   public static void main(String[] args) {
       System.out.println("Hello");
   }
}
integer typesint usually 32 bit 2's complement;
long usually 32 bit 2's complement
int is 32 bit 2's complement;
long is 64 bit 2's complement
floating point typesfloat usually 32 bit;
double usually 64 bit
float is 32 bit IEEE 754 binary floating point;
double is 64 bit IEEE 754
boolean typeuse int: 0 for false, nonzero for trueboolean is its own type - stores value true or false
character typechar is usually 8 bit ASCIIchar is 16 bit UNICODE
for loopsfor (i = 0; i < N; i++)for (int i = 0; i < N; i++)
array declarationsint *a = malloc(N * sizeof(*a));int[] a = new int[N];
array sizearrays don't know their own sizea.length
strings'\0'-terminated character arraybuilt-in immutable String data type
accessing a library#include <stdio.h>import java.io.File;
accessing a library function#include "math.h"
x = sqrt(2.2);

all function and variables names are global
x = Math.sqrt(2.2);
functions have different namespaces
printing to standard outputprintf("sum = %d", x);System.out.println("sum = " + x);
formatted printingprintf("avg = %3.2f", avg);System.out.printf("avg = %3.2f", avg)
reading from stdinscanf("%d", &x);Java library support, but easier to use our library
int x = StdIn.readInt();
memory addresspointerreference
manipulating pointers*, &, +no direct manipulation permitted
functionsint max(int a, int b)public static int max(int a, int b)
pass-by-valueprimitive data types, structs, and pointers are passed by value; array decays to pointerall primitive data types and references (which includes arrays), are passed by value
defining a data structurestructclass - key difference is language support for defining methods to manipulate data
accessing a data structurea.numerator for elementsa.numerator for instance variables,
c = a.plus(b) for methods
pointer chasingx->left->rightx.left.right
allocating memorymallocnew
de-allocating memoryfreeautomatic garbage collection
memory allocation of data structures and arraysheap, stack, data, or bssheap
buffer overflowsegmentation fault, core dump, unpredicatable programchecked run-time error exception
declaring constantsconst and #definefinal
variable auto-initializationnot guaranteedinstance variables (and array elements) initialized to 0null, or false, compile-time error to access uninitialized variables
data hidingopaque pointers and staticprivate
interface methodnon-static functionpublic method
data type for generic itemvoid *Object
castinganything goeschecked exception at run-time or compile-time
demotionsautomatic, but might lose precisionmust explicitly cast, e.g., to convert from long to int
polymorphismunioninheritence
overloadingnoyes for methods, no for operators
graphicsuse external librariesJava library support, use our standard drawing library
nullNULLnull
enumerationenumtypesafe enum
preprocessoryesno
variable declarationat beginning of a blockbefore you use it
variable naming conventionssum_of_squaressumOfSquares
commenting/* *//* */ or //
file naming conventionsstack.cstack.hStack.java - file name matches name of class
callbackspointers to global functionsuse interfaces for commmand dispatching
variable number of argumentsvarargsString ...
assertionsassertassert
exit and return value to OSexit(1)System.exit(1)

Differences between Java and C++ are:
Java
C++
Java is a true and complete object oriented language.
C++ is an extension of C with object oriented behavior. C++ is not a complete object oriented language as that of Java.
Java does not provide template classes.
C++ offers Template classes.
Java supports multiple inheritance using interface.
C++ achieves multiple inheritance by permitting classes to inherit from multiple classes.
Java does not provide global variables.
Global variables can be declared in C++.
Java does not support pointers.
C++ supports pointers.
In Java, destruction of objects is performed in finalize method.
In C++, destruction of objects is performed by destructor function.
Java doesn’t provide header files.
C++ has header files.

How many ways are there to initialize an int with a constant?
Two.
There are two formats for initializers in C++ as shown in the example that follows. The first format uses the traditional C notation. The second format uses constructor notation.
int foo = 123;
int bar (123);