Sundarrajk's Weblog

Archive for the ‘GIDS’ Category

Synchronized makes one cross the memory barrier. Synchronizes local memory with remote memory.
Java Concurrency by …
Use of Lock object for synchronization.
Software Transactional Memory makes everything immutable. Identity and state is separated. Identity is conditionally mutable ; enforces transaction before allowing mutation. Clojure supports STM.
Use of Clojure for simple Concurrency in Java.
Use LockingTransaction.runInTransaction.

Use Multiverse .

JNew Features
1. Project Jigsaw: Version numbers in jar files.
2. Project Lambda
3. JVM convergence JRockit and Hotspot
4. JavaFX 3.0
5. Javascript / Java interoperability Nashorn using invoke dynamic
6. Device Support
7. Annotations on types
8. API updates

What is Lambda expression?
Reusable functions. A function that can be passed around. A first class citizen like variables.

External and internal iterators.

Internal iterator forEach takes a lambda expression.

Have used defender methods which are optional methods defined in interfaces.

SAM Single Abstract Method.

In Collection.map map maps a collection to another collection but mapping through something in between.

Can use Lambda where runnable is expected.

The first major change was 5 with generics.
7 is bringing some changes but not all features have been released
1. Support for multiple languages.
2. Support for concurrence mainly fork and join
3. Garbage collection improvements. G1 new garbage collection mechanism. Pointer compression. -XX:-UseCompressedOops
4. Support for annotations.
5. Support for invokeDynamic. Improves the performance of dynamic Jvm languages. Not supported in Java 7 but would be supported in Java 8.
6. Automatic resource management AutoCloseable.
7. Simpler generics.
8. Formatting long numbers.
9. Catch multiple exceptions.
10. Switch on strings
11. Watcher service.

Some new features in Java 7

1. Makes writing javascript easier
2. Lot like ruby
3. Single and double quote like ruby<
4. Keyword “is” is === and so is ==
5. Indentation is important like python.
6. Provides “if” and “unless”
7. Supports Lambda expressions.
8. Splat helps managing arguments more elegantly
9. Can assign results to named list of variables using splat.
10. Can use range working with arrays. Helps with list comprehension.
11. JSON objects can be created without curly braces
12. Using @ for attributes like ruby
13. Provides extends keyword to hide prototype
14. Provides ability to loop through the attributes using key value syntax. Possible to get only own properties.

html 5 by mark pilgrim free book
Cookies is persistence? Limited to 4k
Local storage is key value database
Session  storage is limited to session
Local storage is persisted across sessions. Limited to 5mb
Web sql available in webkit browsers.

Mozilla promoting index db. Will have transactions and will have more space like websql.

Application  cache allows you to write disconnected applications on mobiles.

This uses a manifest file in the root giving details of what to cache. Does not work in internet explorer.

Need to check how this works with sub domains.

Read Html5rocks.com

Multicore CPUs is making people look at functional.
1. What is functional? No assignment. Controlled assignments.
2. What is wrong with mutability? Problem when shared.
3. If it is immutable no locks are required. Immutable variables in F#. F# is Hybrid functional because it allows you to declare variables as mutable. Pure function is one that does not have side effects. They are predictable.  they can be run in parallel. (referential independence)
4. Higher order functions. You can create functions and return functions.
Demo of how functional style reduces code using F# list.filter and list.map

How to use mock to simplify unit testing?

Not easy to test code dependent on other pieces like database.

Unit test only the smallest piece of code that does something useful should be unit tested.

Types of unit tests
1. Positive test
2. Negative test
3. Exception test
4. Performance test

Create multiple mocks instead of complex mock objects for different test cases.

1. By default MVVM applications are single threaded making UI unresponsive.
2. Use threads at model or viewmodel layer
3. Use keyword “await” to make the applications responsive. “await” allows easy thead management.
4. Use batch update i.e. Delay UI update and do only on time out.

Ok.

1. C# started moderately better than Java.
2. It has grown well and the points  from 4 on are good features which have evolved in C#.
3. It has not removed inelegant features making it difficult to use.
4. Delegates are great.
5. Using anonymous delegate to wrap around boiler code like transaction management.
6. Usage of var and type inference makes coding easy.
7. Dynamic vs var. Dynamic allows change of type at run time.
8. Use of anonymous types. This is like JSON. Use tuple object.
9. Linq. Simplifies programming.
10. Using extension methods to inject methods using keyword “this”.
11. Lambda expressions.

Nice.

So far has it has been a good set of sessions at the GIDS – Day 2. The first session was by Mary Hall in which he illustrated how one should select the options available for building Web Applications using AJAX. The summary was that for applications that are already existing and for which one wishes to use AJAX one should use one of the traditionally AJAX libraries like JQuery etc. For applications that are being developed one should consider using a standard framework like JSf, Struts2, Spring MVC etc. One should consider GWT if one wishes to build a desktop like Application on the Web.
The second presentation was by Ramesh Srinivasaragahavan and he focussed on how the web has changed and how it has further changed with the introduction of ubiquitous devices which are used to browse the Web.
The next speaker was Prakash Sayini who was speaking on behalf of his boss who could not make it because of volcanoes in Iceland. He spoke about the facilities provided by Nokia for the developers to develop mobile applications.
Scott Davis came and deconstructed a Web2.0 site. A summary of his presentation was that
Web 2.0 is not static it is dynamic
Web 20. is not passive it is interactive
Web 2.0 is not solitary it is collaborative
Web 2.0 is not monolithic it is componentized

Marty Hall came back to compare the JavaScript libraries and made it very clear that there is no one library that is going to solve one’s problem. The selection should be based on the problem to be addressed.
More in the next post.


Categories