• Stars
    star
    1,393
  • Rank 33,729 (Top 0.7 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created over 9 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Visualizing JavaScript source code as navigable 3D cities

JSCity

JSCity is an implementation of the Code City metaphor for visualizing source code. We adapted and implemented this metaphor for JavaScript, using the three.js 3D library. JSCity represents a JavaScript program as a city; folders are districts and files are sub-districts; the buildings are functions; inner functions are represented as buildings on the top of their nested function/building. The Number Of Lines of Source (LOC) represents the height of the buildings/functions; the Number Of Variables (NOV) in a function correlates to the building's base size. Blue buildings denote named functions; green buildings are anonymous functions.

Examples

For examples of cities check: Wiki.

About

JSCity is an outcome of research conducted in the Applied Software Engineering Research Group, at Federal University of Minas Gerais, Brazil

Steps to see your first 3D Javascript City.

  • Install nodejs. You can download it from https://nodejs.org/en/.

  • Install MySQL Server (https://dev.mysql.com/downloads/mysql/). If you already have the mysql on your computer jump to step * Start the MySQL server.

  • Run the script schema.sql located inside of sql diretory.

    • The schema.sql creates a database called jscity
    • The schema.sql comes with a sample of data city
  • Setup the config.json, located inside of js directory, if necessary. This file is already set up with the sample below and if you prefer you can use it.

"host": "localhost",
"user": "jscity"
"password": "",
"database": "jscity"
  • Open nodeJs console and go to the js directory from JSCity.
cd /path-to-jscity-directory/js
  • Start the application server using the command.
node server.js
  • Using your browser, access the url below to open the jscity system:
http://localhost:8888/
  • Select the system from the combobox and wait for the end of city design.

Vagrant setup

Alternatively, you can install Vagrant. There is a Vagrantfile and shell provision script, which will start up an Ubuntu 14.04 virtual machine instance, install MySQL and Node in it and configure them properly. You can then run:

vagrant up
  • Use your browser access the url below to open the jscity system:
http://localhost:8080/

Note that this is a different URL than the source default above.

How to generate a city

  • Certify that you have nodejs and MySQL server installed on your computer.
  • Unpack your desired project and take a note of the path to access it. For this sample let's imagine that my desired project is placed inside the following path:
path-to-jscity-directory/js/backend/system/
  • Make sure the generator.js file is placed inside your project directory. e.g:
path-to-jscity-directory/js/backend/system/name-of-your-project/
  • Check the lib folder and config.json file are in your project's parent directory. e.g.:
path-to-jscity-directory/js/backend/system/
  • There should also be a copy of config.json in the js directory:
path-to-jscity-directory/js
  • Make sure that your MySQL server is started. If it isn't, start the MySQL server.
  • Open nodeJs console and go to the js directory from JSCity
cd /path-to-jscity-directory/js
  • Start the application server using the command:
node server.js
  • Open another nodejs console and go to the directory that you placed your desired project.
cd /path-to-jscity-directory/js/backend/system/name-of-your-project/
  • Run the generator.js followed by the path of your project, a parameter -c and a name to your city. The line below shows an example of how the command is supposed to be.
node generator.js path-to-project-diretory -c "Name Your Project"

This command reads all js files in the directory and its subdirectories and inserts all the information needed in the database to design the city. Remember to specify your project source code correct path, because some github cloned projects come with sample codes, minify libraries and other codes that don't represent the real core of the system.

node generator.js ./backend/system/name-of-your-project/src/ -c "City Name"

In some cases the analysed project have at the end of the file, unfinished functions that close in another file. This may be the reason of problems at the parser, causing troubles in generating data cities. In that case, you should unify the archives or use the comand bellow to ignore parser errors.

node generator.js ./backend/system/name-of-your-project/src/ -c "City Name"
  • Wait for the end of the process.
  • Use your browser to access the url below to open the jscity system:
http://localhost:8888/
  • Select the system from the combobox and wait for the end of city design.

City Controls

We've implemented two types of visualization controls. The default control is an Orbital but you can easily change to a first person control by accessing the controls menu.

How to use the controls

ORBITAL

  • Click drag with left button to orbit the current view
  • Click and drag right to move about the screen plane
  • Use the arrow keys to move about the screen plane
  • Use the centre button / mouse wheel to zoom in or zoon out

FIRST PERSON

  • Click and drag to look
  • Use W A S D or arrow keys to move
  • Press space to reset city display
  • Use + or - on the numeric keypad to change movement speed.
  • You can see at the topbar a value of the speed movement. The higher the number of the speed movement the faster you zoom in or zoom out.
  • Press * key to return to standard speed

Libraries Used

node.js

nodemon

forever

mime

mysql

nomnom

esprima

three.js

stats.js

mootools

More Repositories

1

Truck-Factor

A tool that estimates the Truck Factor of GitHub projects
Java
156
star
2

RefDiff

A tool to mine refactorings in the commit history of git repositories.
JavaScript
146
star
3

micro-livraria

Exemplo prático de uma pequena livraria virtual implementada usando microsserviços. Inclui também duas tarefas práticas para os alunos.
JavaScript
109
star
4

JSClassFinder

Detecting class-like structures in JavaScript
Smalltalk
65
star
5

pub-sub-store

Exemplo prático de uma loja virtual simples implementada usando uma arquitetura Publish/Subscribe.
JavaScript
57
star
6

apidiff

A tool to identify breaking and non-breaking changes between two versions of a Java library
Java
51
star
7

CSIndex

Transparent data about Brazilian scientific production in Computer Science
HTML
34
star
8

CursoEngenhariaSoftware

Curso de Engenharia de Software (Bacharelado em Ciência da Computação, DCC/UFMG)
34
star
9

demo-ci

Aula prática sobre servidores de Integração Contínua
Java
22
star
10

engsoftmoderna

Repositório com material suplementar do livro Engenharia de Software Moderna
Python
21
star
11

esmforum

Sistema de demonstração do livro Engenharia de Software Moderna
TypeScript
12
star
12

NextBug

A next-good-bug recommender for Bugzilla
Perl
11
star
13

CursoPraticaDesenvolvimentoSoftware

Curso de graduação: Prática em Desenvolvimento de Software
8
star
14

ModularityCheck

A tool for assessing modularity using co-change clustering
Java
8
star
15

demo-cypress

Roteiro prático sobre testes end-to-end (testes de front-end) usando o Cypress.
JavaScript
7
star
16

CursoEngenhariaSoftwarePos

Repositório do curso de Engenharia de Software, para o PPGCC/UFMG
7
star
17

RTTool

A tool for extracting relative thresholds for source code metrics
Java
5
star
18

jextract

Project repository for JExtract, an Extract Method Refactoring Recommendation Tool
Java
5
star
19

why-we-refactor

CSS
4
star
20

sbsi2016-data

Dataset used in the paper "Does Technical Debt Lead to the Rejection of Pull Requests?" Brazilian Symposium on Information Systems (SBSI), p. 1-7, 2016.
3
star
21

datasets

Datasets used in the papers published by ASERG-UFMG
3
star
22

angularjs-performance-survey

Companion repository for a paper submitted to IEEE Software
3
star
23

techtrends

CSS
3
star
24

jmove

A Move Method Recommendation Eclipse Plug-in
Java
3
star
25

angularjs-survey

AngularJS Survey
1
star
26

paper-tse-refdiff-2

TeX
1
star
27

dcl2check

DCL 2.0 checker
1
star