Git Product home page Git Product logo

code-gen's Introduction

Conventions

Structure of Javascript files' content

I am trying a different layout to organise the content of Javascript modules. Instead having the traditional structure:

  • Import statements;
  • Variable declarations;
  • Functions & Classes;
  • Export statement;

I am trying the following structure:

  • Export statement;
  • Exported Functions & Classes;
  • Import statements;
  • Remaining Functions & Classes;

The purpose of this structure is to make easier to any developer understand the Responsibility a particular module in handling. Giving the most visibile region of a source code file to the exported elements of a module helps to quickly understand what that module contributes for in a project. It also gives developers some context in advance to understand everything else (import statements and not exported functions and classes): my understanding is that nothing should not exist is a module unless it is exported or dependent by something that is exported. Thus, in order to understand module members that are not exported it is required to understand the members that are exported by the module.

As I said, this is an experiment: I am trying it and collecting feedback in order to understand if this is something good o not.

generate functions and source code fragments

All functions starting with generate word have, as return type, an object of type Fragment. The word "Fragment" is the short form of "source code fragment". It represents a piece of code and has at least two attributes:

  • sourceCode: contains the source code related to the fragment as String;
  • type: the type of fragment. It will be one of the values listed in fragmentTypes in codeGenSettings.js file;

code-gen's People

Contributors

sauloefo avatar

Watchers

James Cloos avatar  avatar

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.