GithubHelp home page GithubHelp logo

mikaelhg / openblocks Goto Github PK

View Code? Open in Web Editor NEW
60.0 8.0 100.0 3.92 MB

A refactoring branch of MIT OpenBlocks.

Home Page: https://web.mit.edu/mitstep/openblocks.html

License: Other

Java 100.00%

openblocks's Introduction

OpenBlocks refactoring branch

This is a fork of MIT OpenBlocks (covered by the MIT license) for refactoring purposes.

I left this repository open for many years, as a resource for others with an interest in the topic, even though my active use case became moot twelve years back. Now, however, as there are many better maintained forks, I am about to archive this repository.

The principal objective of the fork was to make the code more amenable to inclusion to other projects.

If you're building a web application, you might want to consider Google Blockly instead.

Getting Started:

$ mvn clean package
$ mvn exec:java -Dexec.mainClass="edu.mit.blocks.controller.WorkspaceController" -Dexec.args="support/lang_def.xml"

To do:

  • upgrade code maintainability from the academic baseline to the commercial baseline
  • replace static singletons with contexts and instances

Done:

  • move the various project packages from the main namespace to under the edu.mit.blocks package
  • refactor out functionality such as network communication
  • remove dependency to TableLayout, which doesn't appear to be actively maintained, and really not even used in a very complex manner

Contributors:

In order of first appearance on commit logs:

openblocks's People

Contributors

dependabot[bot] avatar mikaelhg avatar navyajayapal avatar philippecade avatar sworisbreathing avatar taweili avatar tkg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openblocks's Issues

Opening saved files causes conflicting block IDs

I've been encountering a lot of problems while working with the save/open features in the WorkspaceController (see https://github.com/sworisbreathing/openblocks/issues/2).

In a nutshell, when you have a fresh workspace (such as after you first launch the WorkspaceController) and try to load a file, you can sometimes see a message printed to System.out similar to the following:

pre-existing block is: Block 117: setup with sockets: [Connector label: , Connector kind: cmd, blockID: 233 with pos type: SINGLE] and plug: null before: null after: null with genus setup and label setup

When this happens, the file appears to only be partially loaded, such that some of the important information required to draw the blocks on the canvas properly is missing. In the best case I've been able to reproduce, the blocks are drawn on the canvas but the position of the sockets for drag 'n' drop is different from where the sockets are drawn on the screen. In the worst case, a NullPointerException is thrown when the EDT tries to paint the blocks, such that whole regions of the window (even outside the block canvas) are not painted correctly.

Potential Load problem

I just discovered a bug in the latest openblocks which may cause problem of not being able to load a previous saved file. The problem is cause by the getNextBlockId() introduced in the WorkspaceEnvironment. The number of the nextID there is always being set to 1 when the system started. However, when a saved file are loaded, it will has its own block id that may be conflict with one of the nextID.

I have fixed the problem on my fork https://github.com/taweili/openblocks but this fork also contains some codes specific to ardublock I am working on. I can send you a pull request when I get a chance to clean up my fork. However, I think this should be addressed ASAP, especially for those who are using openblocks in their projects.

TableLayout isn't really necessary

The TableLayout library apparently isn't actively maintained, and might not be necessary at all at this stage. If possible, refactor the dependency out.

Replace static singletons with instantiated contexts

The code uses a lot of static singletons, which makes it less than ideally modular, should there be need to contain more than one simultaneous blocks context in a single VM. See if it would be practical to refactor the static singletons into context instances.

Configure automatic QA with PMD, FindBugs and CheckStyle

We should start to systematically improve the code quality with each commit, as well as document the specific chosen standards.

The code base was originally created by very smart students, without the benefit of the decades of experience it normally takes to make these kinds of standards a part of every developer's baseline autopilot.

Therefore, turning on all of the best practises at once would create an unmanageable amount of work. Instead, we will start from very simple things, such as legibility and indentation, which encourage developers to go through the codebase manually, but without an obligation to fix everything at once, as well as the most critical FindBugs categories.

Make all public static variables final.

Currently, there are instances of one class setting another class's public static variable, after class initialization, in various application methods. This might lead to various non-obvious side-effects.

Invalid encoding in XML save string

When calling getSaveString() on the WorkspaceController, the XML string is filled with the ISO-8859 encoding which is not valid, it should be ISO-8859-1.

On a side note, why have ISO-8859-1 in the first place? Wouldn't UTF-8 make more sense since all Java strings use this encoding already?

I've created a fork and adapted the code there.

Not all characters allowed in labels

We stumbled upon a small issue when changing block labels: not all characters are allowed in labels, namely accentuated characters are rejected.

The culprit is the BlockLabelTextField class that filters characters and key codes, especially the processKeyBinding method.

We're not quite sure on the reason why input shall be restricted to the given list of characters, can this code be removed completely? The isNumber part would have to be kept, but we feel like everything else could just be delegated to the super call.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.