Code Monkey home page Code Monkey logo

101simplejava's Introduction

Summary

This repo is conceptually part of 101repo.

This repo contains Java-based contributions that are easy to build, run, and test.

The physical location of this repo is here:

https://github.com/101companies/101simplejava/

The master ZIP file for the repo is this one:

https://github.com/101companies/101simplejava/archive/master.zip

The GIT URL for cloning and forking is this one:

git://github.com/101companies/101simplejava.git

Prerequisites

  • Java SDK 6+ (with Java SDK binaries in the PATH or JAVA_HOME set up)
  • Eclipse Juno+ (in case contributions are to be opened in Eclipse)

Building information

All contributions are built using Gradle, check this site for an offical plugin for your IDE.

When using an offical Plugin, just download this repo and import the contributions with your IDE.

Building contributions

In order to ease deployment, a wrapper script downloads and installs Gradle locally.

The following instructions are for users with Unix/Linux-like OSs. See instructions for Window users below.

Go to the contributions folder:

$ cd contributions

Run the following command, which downloads Gradle if needed and performs possibly other preparations:

$ ./gradlew

Then, run another command to build and test all contributions:

$ ./gradlew build

If this approach fails, it may be that there is an issue with a particular contribution which takes down the entire build step. Perhaps, this problematic contribution is not even of interest for you. In this case, you could just try to build the contributions of interest individually, as described below.

Preparing contributions for Eclipse

Eclipse project information can be generated for all projects by running another command:

$ ./gradlew eclipse

This command leaves the contributions in a state ready to be imported into an Eclipse workspace.

You can use the Gradle-Eclipse-Plugin instead. In this case, before importing change "Java Home" in Window -> Prefences -> Gradle -> Arguments to "Workspace JRE".

Exercising individual contributions

You may also run Gradle selectively to build individual contributions.

First, make sure that you ran Gradle like this (just as before):

$ cd contributions
$ ./gradlew

Then, go to the folder of the specific contribution, e.g.:

$ cd javaComposition

Then, run the following command to build and test the contribution:

$ ../gradlew build

Special notes on Windows

Use the batchfile "gradlew.bat" instead of the script "gradlew".

Run the batchfile from a command prompt with "gradlew" instead of "./gradlew" as explained above, not from the Windows Explorer.

The "../gradlew" command doesn't work on windows.

Check that JDK binaries are in your PATH and/or the JAVA_HOME environment variable is set.

http://stackoverflow.com/questions/2619584/how-to-set-java-home-on-windows-7

101simplejava's People

Contributors

101companies avatar avaranovich avatar derdackel avatar martinleinberger avatar mmonschau avatar mpaul138 avatar radkat avatar rlaemmel avatar tbernau avatar todeslord avatar tschmorleiz avatar tzimmer avatar

Stargazers

 avatar  avatar

Watchers

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

101simplejava's Issues

wiki and code out of sync

Just looking at some pages which are about the current homework.

For instance:

http://101companies.org/wiki/Contribution:sax

It talks about packages that do no longer exist.

I am trying to fix this for this one, but please take care of this, as we were discussing this before. Some standardized, simple architectural description could be really wanted.

Make contributions self-contained

Hi @tbernau

I would like to discuss whether it is reasonable to go back to a scheme where contributions are self-contained. Seeing how students struggle with the repo-level distribution and seeing further how our contribution-level zip distribution is broken now, I would like to seriously consider going back to self-contained distributions.

What would be the consequences?

  • We would need to assemble contribution-specific build files for gradle.
  • What else?

If @DerDackel also has an opinion on / time for this, please comment as well.

Distribute prepared projects

This is sort of related to #19.

Based on PTT experiences and today's work with @DerDackel .

We could perhaps distribute projects past the steps for basic configuration with "./gradlew" and build / tests steps with "./gradlew build & eclipse", but I guess this would not work directly as libraries would be in the Maven repo on the system used for building.

Anyway, if we could do something to the effect of this, then things would be back to "simple" for users of the "simple" contributions. They used to be simple because they were self-contained Eclipse projects. Now they are no longer self-contained and need gradle to be performed to even arrive at an Eclipse project. This appears to be hard for beginners and they have no idea how to fix things manually when necessary.

Of course, the fact (and the way in which) we use Gradle is alright. It is just adding some point of failure for the potential stakeholders of 101simplejava, which are beginners.

Looking forward more discussion.

Provide very simple build and test "framework"

By definition, the projects of this repo should be easy to build and test.

Thus, we should demonstrate this proper.

That is, the repo should be equipped with some scripting (make, ant, maven, python, ...) so that by a simple script execution all projects are built and tested and report is produced to summarize the results somehow.

Each project, should also do the following as part of build and test:

  • Retrieve jars that are needed.
  • Derive source files that can be build.

README.md of this repo should be used to document everything.

.gitignore should be maintained to be useful for this style of repo.

bin directories popped up

Just gradle built and eclipsed javaSyb.
Now I see a "bin" directory.
It does not even disappear after "../gradlew clean".

Enforce conventions on packages

Package prefix

We were discussing the standard package prefix a lot and didn't come up with any compelling, short contender. I therefore conclude that org.softlang.company shall be used whenever possible. This is what is used mostly anyway. The important thing is, of course, that "org.softlang" should only be applied to contributions that come from the softlang team. So other package prefixes should be preserved when the contributions are from non-softlangers.

Use of subpackages

Generally, sub-packages should not be used unless there is a compelling reason and a convincing name for the subpackage.

I would suggest that "a compelling reason" could be either of those:
a) There are not just a few files and thus, some group facilitates understanding.
b) Some of the files are tool-generated (as with JAXB) and they are held in a designated package.
c) The technology may stipulate different packages. (Any example?)

We know that subpackage names were assigned somewhat chaotically across different contributions. For instance, we may have used "features", "operations", "behavior". The use of such names is too subtle. Perhaps some of these names make more sense:

  • "model" makes sense when we want to modularize the "object model".
  • "view" and "controller" for those components of contributions with GUI.
  • ...

There may be more good candidates. Just try to normalize and get rid of subtle packaging. In case of doubt, let's discuss via comments on this GitHub issue.

Tests

Do I remember correctly that we would be using a "tests" package for them? Or is it "test" Which one is best practice? Please check and enforce.

Continuous build test of repo

I am not assigning to @DerDackel or @tbernau but perhaps they may be willing to do this.

Anyway, experience with the PTT class shows that the current use of gradle makes it perhaps not easier for most involved to understand how to respond to any issues that may arise.

  • (1.) Students wouldn't know Gradle; they can't help themselves.
  • (2.) Build rules cannot be discovered as they are factored to the top.

I don't think we want to move away from Gradle for resource/continuity reasons. So we need to accept that 1. will remain a problem.

We must address 2. in some way.

If there would be no problems, we could be ignorant, but there are problems:

  • (3.) ./gradlew eclipse automated generation of eclipse files but doesn't test that Eclipse would be happy.
  • (4.) Platform issues; we do development mostly on Mac OS X / Linux but there are apparently Windows users.

So we need to solve both problems: 3. and 4. but automated testing (and address 2.).

Ralf

Get infrastructure such as 101simplejava/contributions/gradle out of the way

We cannot have 101simplejava/contributions/gradle and alikes in the general directory structure for contributions (or other namespaces for that matter). Specifically, such gradle stuff needs to get out of the way.

The violation of this constraint messes up 101 because the gradle stuff now appears to be a "contribution".

Where does it go? Here are the general constraints to meet and to refine. That is, all such stuff must compete for a global namespace scheme. The gradle stuff must be Ok with any other 101repo that may come up.

Let's discuss and resolve.

JAXB implementations having issues

The PTT students had issues with Contribution:jaxbComposition.

See the FB group for PTT.

It looks like the gradle stuff not working under Windows.

Also, the documentation (README.md) should hint at the need to set JAVA_HOME.

Thanks to @DerDackel and @tbernau for fixing this so that we don't run into this again when we use ANTLR next week.

As far as I understand, Sebastian has a fix.

It looks like Kevin Klein also has a fix:

https://github.com/ar7u9o/101repo/blob/master/other/build.gradle

Overuse of the features package

Just looking, for example, at package org.softlang.company.features.javaf.syb

of javaSyb.

So you are placing framework/library-like functionality in the package for features.

This is really not helpful in understanding / explaining / maintaining the architecture of a contribution. Please refactor.

Remove unused imports

Loads of them I run into.
Unless this is about generated code, such unused imports are not wanted.

contributions/.gradle to be git-ignored?

I see that there is a .gradle file/folder in contributions once I ran gradle.
Should this file be added to .gitignore (so that it does not pop during "git status")?

Move non-contributions out of the way

We have this sort of stuff in the contributions dir:

https://github.com/101companies/101simplejava/tree/master/contributions/gradle

This greatly confuses the infrastructure.

This must be moved out of the way.

The emerging best practice is to use "tools" (rather than contributions).

Also a subdir of tools should use a name that is unlikely to cause any conflict across the repos.

So I guess "contributions/gradle" should become "tools/gradle-simplejava" or something like that.

Multi-OS support

We currently can not guarantee functionalities for multiple OS (or possibly even OS configurations).
We have to assume that Gradle works on different OS's (was tested on Windows 7, Ubuntu and MAC OS X and works fine), yet some implementations may cause errors platformdependent (see #35) and this can currently not be discovered automatically.

JAXB contributions contain schema-derived object model and lack derivation rules

I am assigning @DerDackel but I guess Sebastian could also communicate with @tbernau whether Thomas can take over. What I am describing here is a result though of Sebastian's efforts; so he would need to say at least how to proceed in technical terms.

Prior to setting up gradle, the jaxb* contributions contained Makefile-based rules that described very clearly how to derive the object models from the schemas.

  • These rules need to be presented somewhere.
  • The object models need to be removed from the repo.
  • The derivation of the object models needs to be added to the build process.

Normalization README.md for contributions

I recognized that README.md varies in style and level of "uptodateness".

Therefore, I propose the following clean-up.

I set up an example:

https://github.com/101companies/101simplejava/tree/master/contributions/dom

Thus, the only variable parts in a README.md would be these:

  • The Headline
  • The link to 101wiki

When doing the README.md's, please take these considerations into account:

  • Please make sure to use the current headlines as shown on 101wiki as opposed to what's in the current README.md files, which is often outdated.
  • Please make sure to use the right URL to 101wiki.
  • When copying and pasting headlines from the wiki, please remove "Language:" and "Technology:". This was also done in the example. Other namespaces do not occur in headlines. If you find any other namespaces, please let me know.

code generation affects commits

@avaranovich do you have an idea how we should go about this problem?

The issue is this:

It looks like when one builds all of 101simplejava, then certain files get re-generated.

Here is a snippet from the corresponding "git status":

    modified:   contributions/jaxbComposition/src/main/java/org/softlang/company/xjc/Company.java
    modified:   contributions/jaxbComposition/src/main/java/org/softlang/company/xjc/Department.java
    modified:   contributions/jaxbComposition/src/main/java/org/softlang/company/xjc/Employee.java
    modified:   contributions/jaxbComposition/src/main/java/org/softlang/company/xjc/ObjectFactory.java
    modified:   contributions/jaxbComposition/src/main/java/org/softlang/company/xjc/package-info.java

This is unfortunate because such changes may create loads of stupid conflicts.

Any thoughts?

Making jdbc contribution 101simplejava-compliant

cc Michael Monschau (once I know his id).

cc @ydupont

This is a tough one.

The java jdbc contribution is still in 101repo for a reason.

We cannot gradle-ize/maven-ize it -- not on the grounds of its technology dependencies, in the current form.

There must be some DB engine, some setup that is controllable in this sense though.

Perhaps Yves is closer to proposing something here.

We can discuss this when we meet next time.

Not urgent.

Likewise, we would want to bundle hibernate stuff.

Simplify and standardize package structure

The various Java projects mess around with different package names.

Most of them seem to be using org.softlang.

Generally, long package names make it unnecessarily hard to just explore the projects.

Perhaps, we kind find some "best" practice that allows us to use much shorter package names.

The use of the default package appears to be a tabu, but perhaps we can find some support for doing it. If we decide not to use the default package, what would be the shortest package name that is tolerable from a best practice/engineering point of view?

The subpackages names should also be standardized.

It looks like the following patterns are in use:

  • tests (test) for JUNit tests
  • behavior for "behavioral" concerns
  • features for "features"
  • model for the "object model"

A tentative proposal for a standardization and simplification follows:

  • Use as few subpackages as possible without incurring proper drawbacks.
  • Decide on whether separating out tests into a subpackage is really worth it.
  • Do not use "behavior" and "features" because these names are confusing.

Apache EJB

http://tomee.apache.org/

Would we be able to get an Apache EJB contribution?

Would we have problems similar to other database-based contributions (in that build is more involved)?

Standardize testing and bring up "coverage" to a "modest" level

The various contributions use slightly different styles of test hardnesses for no reason.

Should we have one test class? When should we have several? How to name the classes and the test methods? What to test? How much file processing to do along with it? Etc.

Another major area of divergence is the test data itself and how it is actually obtained. There are probably good reasons as to why the data is encoded in the program, whether instead it is de-serialized from a file (in object serialization format or XML), but it looks like some best practice could be defined (-> README.md).

Should we try to reuse test data across different contributions more aggressively? This is probably something we should save for later as it gets into the bigger area of "refactoring for a product line".

yapg broken

@DerDackel was mentioning that he had trouble with that.
Anyway, it was working just fine before it was gradle-ed.
So please unbreak.

/Users/laemmel/projects/101simplejava/contributions/yapg/src/test/java/org/softlang/tests/Parser.java:8: cannot find symbol
symbol  : class CompanyLexer
location: package org.softlang.company
import org.softlang.company.CompanyLexer;
                           ^
/Users/laemmel/projects/101simplejava/contributions/yapg/src/test/java/org/softlang/tests/Parser.java:9: cannot find symbol
symbol  : class CompanyParser
location: package org.softlang.company
import org.softlang.company.CompanyParser;
                           ^
/Users/laemmel/projects/101simplejava/contributions/yapg/src/test/java/org/softlang/tests/Parser.java:21: cannot find symbol
symbol  : class CompanyLexer
location: class org.softlang.tests.Parser
        CompanyLexer lexer = new CompanyLexer(antlr);
        ^
/Users/laemmel/projects/101simplejava/contributions/yapg/src/test/java/org/softlang/tests/Parser.java:21: cannot find symbol
symbol  : class CompanyLexer
location: class org.softlang.tests.Parser
        CompanyLexer lexer = new CompanyLexer(antlr);
                                 ^
/Users/laemmel/projects/101simplejava/contributions/yapg/src/test/java/org/softlang/tests/Parser.java:23: cannot find symbol
symbol  : class CompanyParser
location: class org.softlang.tests.Parser
        CompanyParser parser = new CompanyParser(tokens);
        ^
/Users/laemmel/projects/101simplejava/contributions/yapg/src/test/java/org/softlang/tests/Parser.java:23: cannot find symbol
symbol  : class CompanyParser
location: class org.softlang.tests.Parser
        CompanyParser parser = new CompanyParser(tokens);
                                   ^
6 errors
:yapg:compileTestJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':yapg:compileTestJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug                                                                         option to get more log output.

BUILD FAILED

Bring up 101wiki quality for this repo

We are in the process of migrating 101wiki to a new metamodel for contributions and others.

The emerging metamodel is currently bootstrapped with many Haskell-based contributions.

Eventually, the Java-based contributions of the present repo should catch up.

Many of the changes are trivial; some of theme were already automatically completed.

However, some of the new metamodel details require manual effort.

What exactly needs to be done should be discussed once this issue is picked up.

To provide some indicators, consider this:

  • Relationships between contributions should be properly described. Currently, "similarities" are only mentioned in the running text of the old "Motivation" paragraph.
  • To better respond to the expected standardization of building and testing for this repo, we should simplify and standardize the "Usage" sections.
  • To align with changes due to standardized package structure, we should simplify and standardize the "Architecture" sections.

move projects from 101repo to 101simplejava modulo removal of .class and .jar files

Below follows a list of the relevant contributions.

All those guys are to be eradicated from 101repo.

They should be added to 101simplejava.

The projects should again appear in a contributions folders.

However, .jar and .class files are NOT copied over.

Perhaps the list of excluded .jar and .class files could be captured and shared with me and tbernau.

antlrAcceptor
antlrLexer
antlrObjects
antlrParser
antlrTrees
dom
javaComposition
javaExorcism
javaInheritance
javaLexer
javaMultithreading
javaParseLib
javaParser
javaScanner
javaStatic
javaSyb
javaTemplate
javaVisitor
jaxbChoice
jaxbComposition
jaxbExtension
jaxbSubstitution
jdom
jgralab
sax
xom
xpathAPI
yapg

.gitignore not properly set up

When I am running "git status" on 101simplejava, I see loads of noise:

...
#   ../jdom/.classpath
#   ../jdom/.project
#   ../jdom/.settings/
#   ../jdom/build/
#   ../sax/.classpath
#   ../sax/.project
#   ../sax/.settings/
#   ../sax/build/
#   ../xom/.classpath
...

.gitignore should make sure to make those kinds of things go quiet.

antlrLexer needs to be factored and could be generalized

Just realized that the code for "total" is actually written into the test class.
This needs to be factored out into a proper main class.

Also, the test class should perhaps not be be called "Parsing" because antlrLexer does no parsing. What would be the name for the class in other, non-antlrish contributions?

Further, there is no implementation of Cut, but there should be preferably.
The idea of javaLexer could be applied such that an output stream is filled with all tokens modulo adapting the salaries.

Refactor build.gradle for clarity

This is trying to make one aspect of #19 more operational.

When looking at build.gradle of a non-trivial project I see this:

 $ pwd
 /Users/laemmel/Downloads/101simplejava-master/contributions/jaxbComposition
 $ more build.gradle 
 description = 'Object/XML mapping for Java and XSD with JAXB'

I don't think the description should be there because per #18 it belongs into the README.

Thus, the file is essentially empty.

Now, a beginner will have no idea that still some stuff happens (i.e., xjc is invoked). I didn't even bother to look at the global gradle file, but I guess some cleverness is encoded there to process Company.xsd in some cases. How would the global rule know that it needs to be run on specific contributions?

Anyway, here is my proposal. When looking at the gradle file there must be some hint at the fact that "xjc" is invoked so that a modestly experienced user is encouraged to look further in the global gradle file. Don't make the global gradle file overly clever.

sax validation failure

Sax seems to be buggy. Validation causes some weird errors (stating that UTF-8 is no known format) situational, system-inter and -intra-dependent:

On Windows:

  • Using directories (like inputs) fails
  • Using the working directory succeeds

On Ubuntu:

  • Using the working directory fails

The problem seems to occur for others (internet), yet I found no solution or explanation.

Zips and build script architecture

The zip worker currently zips (http://data.101companies.org/zips) the repo as (1) a whole and as (2) individual implementations. Build scripts are only present at implementation level.
With the way our build scripts currently work (all info in a single super script in ...\contribtuions) all build info in (1) and (2) is lost.

With the structure of the resulting zip from (1) where all 101implementations are in the same folder super build scripts from different subrepos will collide if the same build system (and hence script name) is used. Also such super build scripts would need to be included in (2).

A solution on the worker side would be changing the zip structure (adding a superfolder to (2) to include e.g. build.gradle and settings.gradle and the need of dividing contributrions by repo/language/build system/something in (1)).
A solution on the build side would add redundancy and reduce maintainability but also add comprehensibility and usability (for both contributors and users) to the whole repo (every implementation would have its own script).

If not for the educational and community driven aspect of 101companies the first solution would be obvious.

rxJava needs .gitignore

I am getting this sort of stuff for "git status":

# Untracked files:
#       rxjava/.classpath
#       rxjava/.project
#       rxjava/.settings/
#       rxjava/build/

Please check other contributions for the right logic regarding .gitignore.

More generally, please make sure "git status" is empty after commiting/pushing new contributions.

Added a new implementation javaReflection

Just FYI.

I started from javaSyb.

The tests are now called Ok.

Haven't resolved the issue with the build.gradle vs. README.md redundancy.

Thanks for taking care of javaReflection.

Don't confuse de-/serialization versus un-/parsing

There is Feature:Serialization and its subfeatures.
There is features for parsing and unparsing.
The naming seems to confuse them occasionally.
Just looking at javaSyb with its ParsingTest (which is about (de-)serialization).

akka contribution

So we could do a concurrent implementation using this:

http://akka.io/

I guess we can start from the existing thread-based implementation and see how we can leverage akka instead.

a contribution with messaging in Java

perhaps with JMS:

http://en.wikipedia.org/wiki/Java_Message_Service

See also a more general discussion here:

http://www.slideshare.net/buzdin/messaging-in-java

One idea could be that one client maintains the company objects whereas the other client sends messages to retrieve company data which are to be sent back also by messages.

Overall, let' see how we can demo messaging without perhaps adding another feature. If necessary though, we can discuss a new feature.

please review new contributions

Hi Matthias,

I added jdomHttp and javaJson and javaJsonHttp.

I think I revised all gradle stuff as needed.

Can you please see whether you still build and test everything?

(... so that the students don't run into issues.)

Thanks,
Ralf

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.