This document summarizes Jonathan Fine's presentation on JavaScript Miller Columns. The presentation covers what Miller Columns are, a demonstration of them, how to specify the user interface and author content, using delegation in frameworks, running tests, sample test data, defining classes in JavaScript, and ways to make JavaScript more Pythonic. The goal is to develop a production version of Miller Columns that relies on library modules and is supported by documentation.
This presentation is ideal for a beginner of Java or someone who wants to brush up their Java Knowledge. It's simple to understand and well organized in a way most of the area in core Java has been covered.
Exception handling - Fundamentals of exception handling, Exception types, Termination or resumptive models, Uncaught exceptions, using try and catch, multiple catch clauses, nested try statements, throw, throws and finally, built- in exceptions, creating own exception sub classes.
Multithreading- Differences between thread-based multitasking and process-based multitasking, Java thread model, creating threads, thread priorities, synchronizing threads, inter thread communication
Mahika Tutorials sharing PPT slide for core java programming language. Go threw this slide and visit our YouTube page too
https://www.youtube.com/c/mahikatutorials
This presentation is ideal for a beginner of Java or someone who wants to brush up their Java Knowledge. It's simple to understand and well organized in a way most of the area in core Java has been covered.
Exception handling - Fundamentals of exception handling, Exception types, Termination or resumptive models, Uncaught exceptions, using try and catch, multiple catch clauses, nested try statements, throw, throws and finally, built- in exceptions, creating own exception sub classes.
Multithreading- Differences between thread-based multitasking and process-based multitasking, Java thread model, creating threads, thread priorities, synchronizing threads, inter thread communication
Mahika Tutorials sharing PPT slide for core java programming language. Go threw this slide and visit our YouTube page too
https://www.youtube.com/c/mahikatutorials
Introduction to Java programming - Java tutorial for beginners to teach Java ...Duckademy IT courses
Check out the course: https://www.duckademy.com/course/java-programming Learn Java from scratch in an easy and entertaining way. The Easy-to-follow Java programming course on Duckademy was made for beginners. In this course we start at the very basics (from zero) and go through lots of interesting exercises and analogies that will take you to an advanced level. By the end of the course you will have all the knowledge needed to move on and specialize in Java. The course is easy to follow and things are well explained. Furthermore, to make your learning easier and more enjoyable throughout the course we will develop a nostalgic, text-based fantasy game.
The course is recommended to anyone who wants to learn Java. Ideal for those who are new to programming, but it can be useful and enjoyable for people who want to switch to Java from a different programming language.
By the end of the course you will be able to build simple, but fully functional programs. You will also gain all the knowledge needed to specialize in Java and become a well-payed Java expert later on.
Check out the course: https://www.duckademy.com/course/java-programming
Variables declared in a Java interface is by default final. An abstract class may contain non-final variables.
Members of a Java interface are public by default. A member of an abstract class can either be private, protected or public.
An interface is absolutely abstract and cannot be instantiated. An abstract class also cannot be instantiated, but can be invoked if it contains a main method.
Introduction to Java programming - Java tutorial for beginners to teach Java ...Duckademy IT courses
Check out the course: https://www.duckademy.com/course/java-programming Learn Java from scratch in an easy and entertaining way. The Easy-to-follow Java programming course on Duckademy was made for beginners. In this course we start at the very basics (from zero) and go through lots of interesting exercises and analogies that will take you to an advanced level. By the end of the course you will have all the knowledge needed to move on and specialize in Java. The course is easy to follow and things are well explained. Furthermore, to make your learning easier and more enjoyable throughout the course we will develop a nostalgic, text-based fantasy game.
The course is recommended to anyone who wants to learn Java. Ideal for those who are new to programming, but it can be useful and enjoyable for people who want to switch to Java from a different programming language.
By the end of the course you will be able to build simple, but fully functional programs. You will also gain all the knowledge needed to specialize in Java and become a well-payed Java expert later on.
Check out the course: https://www.duckademy.com/course/java-programming
Variables declared in a Java interface is by default final. An abstract class may contain non-final variables.
Members of a Java interface are public by default. A member of an abstract class can either be private, protected or public.
An interface is absolutely abstract and cannot be instantiated. An abstract class also cannot be instantiated, but can be invoked if it contains a main method.
1 Project 2 Introduction - the SeaPort Project seri.docxhoney725342
1
Project 2
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports.
Here are the classes and their instance variables we wish to define:
SeaPortProgram extends JFrame
o variables used by the GUI interface
o world: World
Thing implement Comparable <Thing>
o index: int
o name: String
o parent: int
World extends Thing
o ports: ArrayList <SeaPort>
o time: PortTime
SeaPort extends Thing
o docks: ArrayList <Dock>
o que: ArrayList <Ship> // the list of ships waiting to dock
o ships: ArrayList <Ship> // a list of all the ships at this port
o persons: ArrayList <Person> // people with skills at this port
Dock extends Thing
o ship: Ship
Ship extends Thing
o arrivalTime, dockTime: PortTime
o draft, length, weight, width: double
o jobs: ArrayList <Job>
PassengerShip extends Ship
o numberOfOccupiedRooms: int
o numberOfPassengers: int
o numberOfRooms: int
CargoShip extends Ship
o cargoValue: double
o cargoVolume: double
o cargoWeight: double
Person extends Thing
o skill: String
Job extends Thing - optional till Projects 3 and 4
o duration: double
o requirements: ArrayList <String>
// should be some of the skills of the persons
PortTime
o time: int
Eventually, in Projects 3 and 4, you will be asked to show the progress of the jobs using JProgressBar's.
2
Here's a very quick overview of all projects:
1. Read a data file, create the internal data structure, create a GUI to display the structure, and let
the user search the structure.
2. Sort the structure, use hash maps to create the structure more efficiently.
3. Create a thread for each job, cannot run until a ship has a dock, create a GUI to show the
progress of each job.
4. Simulate competing for resources (persons with particular skills) for each job.
Project 2 General Objectives
Project 2 - Map class, Comparator, sorting
Use the JDK Map class to write more efficient code when constructing the internal data
structures from the data file.
Implement SORTING using the Comparator interface together with the JDK support for sorting
data structures, thus sorting on different fields of the classes from Project 1.
Extend the GUI from Project 1 to let the user sort the data at run-time.
Documentation Requirements:
You should start working on a documentation file before you do anything else with these projects, and
fill in items as you go along. Leaving the documentation until the project is finished is not a good idea for
any number of reasons.
The documentation should include the following (graded) elements:
Cover page (including name, date, project, your class information)
Design
o including a UML class diagram
o classes, variables and methods: what they mean and why they are there
o tied to the requirements of the project
User's Guide
o how would a user start and run your pro ...
Adding a modern twist to legacy web applicationsJeff Durta
Avoid misery of working with legacy code
We will see how you can add independent and isolated components to existing pages; pages that may be difficult to change
React and Flux allow you to make self-contained additions that handle their own data access/persistence
JavaScript basics
JavaScript event loop
Ajax and promises
DOM interaction
JavaScript object orientation
Web Workers
Useful Microframeworks
This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2015.
http://www.ivanomalavolta.com
Writing NodeJS applications is an easy task for JavaScript developers. However, getting what is happening under the hood in NodeJS may be intimidating, but understanding it is vital for web developers.
Indeed, when you try to learn NodeJS, most tutorials are about the NodeJS ecosystem like Express, Socket.IO, PassportJS. It is really rare to see some tutorials about the NodeJS runtime itself.
By this meetup, I want to spot the light on some advanced NodeJS topics so as to help developers answering questions an experienced NodeJS developer is expected to answer. Understanding these topics is essential to make you a much more desirable developer. I want to explore several topics including the famous event-loop along with NodeJS Module Patterns and how dependencies actually work in NodeJS.
I hope that this meetup would help you to be more comfortable understanding advanced code written in NodeJS.
Portable TeX Documents (PTD): PackagingCon 2021Jonathan Fine
Both software and documents have dependencies. This talk focuses on managing document dependencies, to reduce both network and computation latency, and to ensure reproducible build (or typesetting) behaviour. Web development has a strong focus on reducing user experienced latency, as does serverless cloud computing.
Browse and print: Problems and SolutionsJonathan Fine
With the growth of the web, how we publish is changing. Paper alone is not enough, web pages are also required. And for many web pages it is not enough to rely on the browser’s print capabilities. Sphinx, used since 2008 for Python’s documentation, is a creative response to this tension.
This talk will take a broader view of the problem. For example, many browsers support web fonts for display but not for printing. Mathematics on web pages is still difficult, but SVG holds out much promise not only for mathematics but for tables and other complex typeset material. Achieving accessibility remains difficult.
Based on over 15 year’s experience in print and electronic publishing, this talk will survey problems and emerging solutions. Software and sites covered include LaTeX, PDF, SVG, MathJax, web-fonts, PediaPress, Sphinx and arXiv.
1. JavaScript Miller Columns
Jonathan Fine, Open University, UK
EuroPython, 22 July 2010
Source for slides available at
http://bitbucket.org/jfine/javascript-miller-columns
/src/tip/docs/tex/js-miller-columns.tex
2. Overview of talk
What are Miller Columns
Demonstration
Specification
Delegation and frameworks
Testing
Sample code
Python and JavaScript compared
Documenting JavaScript
JavaScript modules (JSMOD)
JavaScript standard library
Pythonic JavaScript
4. What are Miller Columns
Named after Mark Miller of Google. Used in the iPhone and Apple
Finder interface. Click item in one column and next column shows
its children.
We rotate so that columns become rows.
Represents a tree as a sequence of choices:
Start at the root R.
List the children of the root.
Choose one of these children. Call it A.
List the children of A.
Choose one of the children of A. Call it B.
Stop when you get to a node without children.
6. User interface specification
In part it resembles a spreadsheet.
The display consists of a number of rows.
Each row has in it a preferred item.
There is a preferred row.
Up/down arrow keys moves the row preference up/down.
Horizontal movement is different
Left/right arrow keys moves item preference left/right.
Each non-leaf item has a child row.
Beneath each row is the preferred item’s child row.
(and so) Changing item preference changes display beneath
item’s row.
For each node in the tree we remember its preferred child.
7. Authoring and deployment specification
1. Author creates contents (cards) on repository site.
2. Author creates query that returns interesting set of cards.
3. Query returns data as JSON or JSONP.
4. Repository site creates HTML snippet that will display query
on page.
5. Author (or third-party) places HTML snippet on pages they
control.
6. A visitor to the pages now sees the repository content.
8. Delegation and frameworks
On all modern browsers, events bubble up. This allows events to
be handled by a parent or ancestor DOM element. Doing this is
called delegation.
In our setting, delegation is good. It makes code simpler, smaller,
more reliable and faster.
Becoming mainstream. Several JavaScript frameworks/libraries
now support delegation.
Delegation is a good candidate for being part of a JavaScript
standard library.
To simplify deployment, the HTML snippet should have few and
easily satisfied dependencies.
9. Running tests
I’ve written the app so that majority of the code can be tested
using a command line JavaScript interpreter. I can run all these
tests in less than one second. Probably could be reduced to 0.1
seconds.
My test runner is some inelegant bash scripts, such as:
function doit
{
js -f lib/boot.js -f lib/math.js -f lib/__builtin__.js
-f lib/methods.js -f lib/extras.js -f lib/js.js $*
}
doit -f hw/work.js
doit -f hw/_test/test_jsmod.js
doit -f hw/_test/test_js.js
doit -f hw/_test/test_class.js
# etc
10. Some test data
Much of the test involves ‘change of states and output’ testing.
Such tests can be specified with data and are Jasonic.
testit(
[’A’, [’B’, ’C’]],
[
[’down’, ’0’],
[’right’, ’1’],
[’down’, ’1,0’],
[’up’, ’1’],
[’down’, ’1,0’]
]
);
I’d like to create and manage these tests in Python. This would be
an example of Pythonic (and Jasonic) JavaScript.
11. Class definition: constructor and initialisation
We’re using modules (jsmod). In this extract m is the module
object to which we are attaching attributes, and mc is the parent
object for all instances of the MillerColumns class.
var mc = Class(m, ’MillerColumns’);
mc.__init__ = function(object){
this.object = object;
this.currs = [object];
this.path = [];
this.path_keys_map = {};
};
This code is similar to Python, and is good practice in JavaScript.
Class can assign mc.__name__ = ’MillerColumns’.
12. Class definition: down() method
This is what I wrote then. I’d do it a bit different now.
mc.$down = function(){
var curr = this.currs[this.path.length];
var keys = this.get_keys();
if (keys === null)
return null;
var index = keys.index;
if (index === null)
return null;
this.path.push(index);
this.currs.push(curr[keys[index]]);
return this.path;
};
13. About Python
Started by Guido van Rossum in 1990. Stable and mature.
Managed by Python Software Foundation.
Used by choice (of programmer). Scales to large systems.
Used in many areas — such as web servers, scientific
calculation, system administration, GUI programs, testing.
Open source, and all C-implementations use same codebase.
Very high-level, gives programmer productivity.
Friendly, wise and intelligent developer community.
Clean and simple (although unusual) syntax.
Moving to Python 3, to allow major language clean-up.
14. About JavaScript
Started by Brendan Eich in 1995. Key design from Scheme and
Self (giving inheritance). Name due to marketing tie-up with Sun.
Used because it’s all there is on the browser. Doesn’t scale.
Major use is web-browsers (and closely related areas, such as
Flash).
A major implementions (Microsoft) is proprietary.
Lightweight, inflexible programmer’s interface.
Microsoft’s hostility to Netscape (browser wars) still has
consequences.
Complex syntax, with serious gotchas.
Progress to fourth edition of standard abandoned in August
2008 and compromise made.
But don’t blame JavaScript for the problems with the DOM. Any
browser scripting language would have problems here.
15. Python — modules, library and documentation
These are important strengths of Python.
Python has a module structure. For example, file wibble.py
can be imported to provide the module wibble.
Modules can be organised into packages.
Modules can be byte-compiled.
Python has a large and growing standard library.
Python applications and frameworks rely on the standard
library.
There are other library modules available.
Python has high-quality documentation, in both HTML and
PDF form.
16. JavaScript — modules, library and documentation
There are major weaknesses in JavaScript.
JavaScript does not have an inbuilt concept of a module
(although package is a language reserved word).
JavaScript does not have a standard library of JavaScript code
(although there are widely used ‘modules’, e.g. for JSON).
In JavaScript ‘library’ often means ‘large package with some
optional parts’.
These libraries don’t share much code, and sometimes don’t
play well with each other. Sizzlejs is example of progress.
Documentation is sporadic and not to a shared standard.
Note: The serverjs project is working on providing modules for
JavaScript, and the author has a prototype Jsmod system.
17. JavaScript resources
Here’s an incomplete and perhaps biased list.
Wikipedia, for general introductions and overview.
Cockcroft’s JavaScript, the good parts and Zakas’ JavaScript
for web developers.
https://developer.mozilla.org/en/JavaScript.
Libraries such as jQuery and Dojo.
Many presentations on slideshare and videos.
http://dean.edwards.name/ (pushes the boundary).
http://ajaxian.com/ for developer news on Ajax.
JavaScript FAQ
For DOM, http://www.quirksmode.org/
The EuroPython 2010 JavaScript tutorial.
Js4py, a small group of Python users who also do JavaScript.
18. JavaScript remedies
We’ve seen that JavaScript has problems as a programming
environment. Here we look at some work done to improve matters.
Libraries such as Dojo and jQuery (but they still don’t have
modules).
Code to run on server, and treat browser as fairly dumb device
(Ruby-on-Rails, I think).
Google Web Toolkit — a whole browser-client development
environment (in Java) that compiles to browser Java and
client JavaScript.
Pyjamas, which is similar to GWT but for Python.
Running JavaScript on both browser and server (serverjs), to
avoid coding algorithm twice, in two different languages.
JSON (and XML), which work the same on all platforms.
Jsmod, which provided modules for JavaScript (currently
prototype only).
19. The empty module in Python and JavaScript
In Python the empty module is a zero-length file. In next version
of Jsmod it will be:
JSMOD(
{
’name’: ’empty’,
’imports’: []
},
function(m, __)
{
eval(__);
});
This approach allows completely independent import and use of
different versions of the same package. This feature can be a very
useful.
20. The empty JavaScript module
JSMOD( // Takes two arguments.
// 1. Module metadata.
{
’name’: ’empty’, // Name of module.
’imports’: [] // List of imports.
},
// 2. Module initialiser.
// Parameter m is module to be initialised.
// Parameter __ imports into closure namespace.
function(m, __)
{
eval(__);
// Use imports and initialise module here.
});
21. Exporting
As in Python, we export from a module by adding an attribute to
the module object we are initialising. In Python this is done
implicitly, by making a top-level assignment. In JavaScript we have
to be explicit.
JSMOD(
{
’name’: ’urls’, // Name of module.
’imports’: [] // List of imports.
},
function(m, __)
{
eval(__);
m.python = ’http://www.python.org’
});
22. Importing
Importing is done via eval(__), which injects the imports into the
private part of module namespace. (Good practice in JavaScript.)
Unlike Python, provide module attributes rather than module
object. This is also good practice in JavaScript. As in Python,
provide builtins (but not as attributes of JS global object).
JSMOD(
{
’name’: ’whatever’,
’imports’: [’urls’]
},
function(m, __)
{
eval(__);
alert(’Please visit ’ + urls_python);
});
23. Defining classes
JavaScript does not have inbuilt concept of class (even though
class is a reserved word). Also, it uses an object tree (aka
prototypes) for inheritance.
Here’s how to create Jsmod classes. We omit the module wrapper.
// *point* is the parent of all Point instances.
var point = m.Class(’Point’);
point.__init__ = function(x, y){
this.x = x;
this.y = y;
};
point.move = function(dx, dy){
this.x += dx;
this.y += dy;
};
24. Using classes
Much as you’d expect. Here’s a complete example.
JSMOD(
{
’name’: ’whatever’,
’imports’: [’geometry’]
}, function(m, __)
{
eval(__);
var Point = geometry_Point; // A useful shorthand.
var point = Point(1, 3);
point.move(1, 2);
// etc.
});
25. Pythonic JavaScript
Community is core to Python. Pythonic JavaScript not possible
without many Pythonistas contributing.
Sphinx format open source JavaScript documentation.
A good tutorial.
A module system for JavaScript.
A good start on a standard library for JavaScript.
High-quality JavaScript apps based on standard library.
26. How to give and get
Talk with me: jfine (at) pytex (dot) org
Stop by at or join Pythonic JavaScript sprint
Subscribe to js4py on Google groups
Use and improve this year’s JavaScript tutorial
Contribute sample JavaScript code
Help me develop Miller Columns
Start using Miller Columns
In summary, production version of Miller Columns, done right,
relying on library modules and supported by good JavaScript
tutorial and reference documentation.