fragmatyc / SDFL

Simple Data Fix Language
1 stars 2 forks source link

Technical documentation #2

Open Cpt-xx opened 8 years ago

Cpt-xx commented 8 years ago

Hi Sylvain,

I see that you have already done some work on coding. Before I make any alterations, I want to know what does what and how you intended to structurize the classes and code. What I also miss are some simple things as coding standards. You probably started working on the code in Java 7 style, and in the pom.xml you specify that the coding standard is 1.8, however I do not see any code using the language features of Java 8. There are a lot of public methods, but hardly any of them are documented, so it is quite hard to understand what you intend to achieve with them. Without any "contracts" it will be hard to keep the work going forward.

Could you provide some architectural documentation with this project?

Kind regards,

Cor

fragmatyc commented 8 years ago

Hey Cor, I can provide a document with architectural details, no worries. I will create it in the wiki so you can have access to view and edit. To make it short, the code is split is 3 sections, interpreter, statements and compiler. The interpreter parses the SDFL source code and transforms the text files into statement objects (ex.: InsertIntoStatement or ImportStatement, etc.) with the help of a statement builder. Once the statements are loaded, they are passed to an implementation (Oracle for now) of the SDFL compiler. It compiles the statement objects into proprietary SQL code using a SQLCodeGenerator.

Interpreter https://github.com/fragmatyc/SDFL/blob/master/SimpleDataFixLanguage/src/com/sdfl/interpreter/SDFLInterpreter.java

Statement https://github.com/fragmatyc/SDFL/blob/master/SimpleDataFixLanguage/src/com/sdfl/statements/impl/InsertIntoStatement.java

Statement Builder https://github.com/fragmatyc/SDFL/blob/master/SimpleDataFixLanguage/src/com/sdfl/statements/builders/impl/InsertIntoStatementBuilder.java

Oracle Compiler https://github.com/fragmatyc/SDFL/blob/master/SimpleDataFixLanguage/src/com/sdfl/compiler/impl/oracle/OracleSDFLCompiler.java

Code Generator https://github.com/fragmatyc/SDFL/blob/master/SimpleDataFixLanguage/src/com/sdfl/compiler/impl/oracle/sql/statement/OracleInsertIntoStatementSQLCodeGenerator.java

The project is done in TDD and all tests are passing.

fragmatyc commented 8 years ago

Hi Cor, Don't worry about the programming standards, I will make them tomorrow on the wiki. Just make sure you have a look and tell me if you don't agree with any of them. As you said, the main bases are done. All we need to do is implement the different compilers/interpreters and statements. Once you got it, it should be straightforward. Have fun!

fragmatyc commented 8 years ago

Development Standards: https://github.com/fragmatyc/SDFL/wiki/Development-Standards I'm working on the architectural documentation.

fragmatyc commented 8 years ago

coding standard is 1.8, however I do not see any code using the language features of Java 8. You're right. I started off with 1.7 (1.8 was not out). The use of the JDK8 comes with much more improvements than Lambda expression or streams, if that's what you meant by features of Java 8. If you think that changing the actual code's for-each to streams' forEach() will improve readability, maintainability and/or performance, we should log a ticket to modernize the code.

Cpt-xx commented 8 years ago

We shouldn't go for Lambda expressions and streams just for the sake of those. Unless you'd want to experiment with them (I have created a local branch to just play around with them), we should at least provide some rules when to use them. Streams for instance give a great base for parallelism, however if your collection is only ever going to be parallellizable in 2% of the cases there is not much gain. Sometimes streams will even slow your application down. forEach() is now part of the Collection<> interface, so streams are not necessary here per se either.

Lambdas can be an improvement, but not always. Again caveat emptor.

Cpt-xx commented 8 years ago

Right-o, I just had some time to read the development standards.

They are pretty common sense overall, which is good. Although I do have some questions:

Regarding the architecture: Printing out the javadoc of classes is just scraping the surface of architecture. I would have expected a bit more in the sense of setting out the way in which components interact and standards regarding external frameworks allowed (or not). For instance: if somebody wants to introduce a framework such as Spring, Apache.lang, Apache.io, Hibernate or Guice, is that allowed? And why not? Architecture is also about setting the playing field and specifying the leeway of the developers, architecture is also about specifying how modifications need to be delivered (e.g. for each issue assigned to me I make a separate branch which I create a separate pull-request for; others may directly try to resolve it in their master branch, others may create a patch to be pulled in and merged).

fragmatyc commented 8 years ago

Cor, Sorry for the delay! I'll try my best to answer all your points:

/**
 * This file is part of the Simple Data Fix Language (SDFL) core.
 * 
 * All components of the language (compiler, interpreter, etc.) are
 * free and open source: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * SDFL is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with SDFL.  If not, see .
 * 
 * @author 
 */

Again, this is a work in progress. Feel free to propose anything that won't change the actual code base.