-
Notifications
You must be signed in to change notification settings - Fork 5
Intro to Coding
Costin Grigore edited this page Aug 5, 2019
·
18 revisions
Check that every commit respect the following rules:
Use principles as guide in unknown territory.
- Offensive programming
- Add preconditions when interacting with external systems. Otherwise the system should crash (fail fast).
- https://en.wikipedia.org/wiki/Defensive_programming
- Use guava Preconditions
- see https://www.elegantobjects.org/
- Functional style
- top down, focus on input-output parameters (intention) rather than implementation details, TDD
- non strict, imutable collections
- Bad Objectual style
- Getter/setter vomit
- Prefer aggregation over inheritance
- SRP
- Do not use Singletons
- Do not use modifiable static fields (log is acceptable)
- Elegant Objects
- Use NullObjects (read about nullability in kotlin)
- Collections (list, map, array, ...) should be empty collections not null
- Do not use null (use java.util.Optional) - Null Object
- Do not have references to null objects.
- If you could return null better to return Optional.empty()
- Never return null
- Simple classes
- Should
- be immutable: all fields final and imutable themselfs
- ideally :
private final Type field;. If really neededpublic final Type field; - initialized once at construction time
- Should Not
- have getters - imutable fields can be public if information needs to be exposed
- setters - imutable fields don't need setters
- Should
- Spring classes
- Use @Component, have one @Autowired, use constructor injection (do not use setter injection)
- Use NullObjects (read about nullability in kotlin)
- DCSS
- Do not use for(...) . Use functional operations on collections:
.map,.foreach,.filteretc. - Important collections
- vavr: Seq, List, Map, Option, Try, Either
- reactor: Flux, Mono - future
- Do not use multithreading code. See DCSS. Thread, synchronized, Executor, java.Future, java.concurrent.* are raw (so dumb) structures. Actors, Flux are smarter.
- Do not use for(...) . Use functional operations on collections:
- DRY
- Use lombok: @Data @Getter(lombok.AccessLevel.NONE) @Setter(lombok.AccessLevel.NONE)
- Use short methods
- Use libraries
- Defer Execution
- Prefer smart delayed/lazy/non-strict structures - https://www.scala-lang.org/blog/2017/11/28/view-based-collections.html
- Supplier, Callable, vavr.Function, Flux, Mono, Iterable
- vavr: Seq, List, Map - they are immutable data structures that by design are not strict (don't have all the elements computed)
- Do not use:
- java.Function - not smart enough - not composable
- java.Stream - not smart enough, but not strict which is good
- If is possible do not use:
- java collections - they are strict structures
- Prefer smart delayed/lazy/non-strict structures - https://www.scala-lang.org/blog/2017/11/28/view-based-collections.html
The absolute needed libraries are:
- junit5 - testing api
- slf4j - logging api - Intro to Logging
- logback - simple logging implementation (robust reporting on bean config and version of the used libraries)
- guava - google utilities
- typesafe config - more robust reporting than properties
- vavr
- vavr imutable collections over java standard ones
- vavr Option not standard java Optional
- reactor-flux
- java.time
- Careful on exception idioms
- Never swallow an exception. If in doubt rethrow it.
- principle~Fail Fast
- A logged exception at info level is always a bug.
- The exception should give enough details to be able to investigate the problem without debugging. If the investigation lasts more than 30s you have a bug on investigation of the exception.
- see Checked Exceptions vs Unchecked Exceptions
- Beans, Getters and Setters are overhyped
- Immutable classes (do not confuse with final fields)
- use slf4j - private final static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DataSupplier.class);
- never hide exceptions
- at least log as debug: catch(...){ logger.debug("",ex); }
- catch(...){ /do nothing/ }
- never throw CheckedExceptions, catch and
throw new RuntimeException(checkedException) - logger.info("text",ex) (never do an ex.toString())
- never use static except for logger
- never expose internals to others
- create immutable classes
- no duplicate code
- all fields by default private and final
- no circular dependencies
- attention to Runnable that can throw exceptions
- Home
- Advices
- Development Algorithm
- Who's who
- Software Books
- Career, salary, salariu, brut, net, Levels
-
Tools
- Health
- Physical Tools
- Environment Tools
- File Tools
- Source Tools
- Information Tools
- Collaboration Tools
- Infrastructure Tools
- Language Tools
-
Concepts as Tools spec maturity
- Classes of Objects, Development Algorithm/mantra/practices
- Streaming Tools
- Process Tools psychology, analytical paralysis
- Special
- fiddler kotlin,javascript,scala
- translator scala->kotlin, java->kotlin
- Guides
- Asking for Help
- Aspects
- Security
- Server & Networking load balancing,
-
Principles & Guidelines
- PLS - Principle of Least Surprise (aka no puzzlers)
- SRP - Single Responsibility Principle
- KISS - Keep It Simple
- YAGNI - You aint gona need it
- DRY - Dont Repeat Yourself
- Fail Fast
- OCP - Open Closed
- POE - Premature Optimization is Evil
- LSP - Liskov Substitution Principle
- DIP - Dependency Inversion Principle / Inversion of Control
- Hollywood Principle - Don't call us We call you
- Tell Don't Ask
- Event sourcing
- NIHS - Not invented here syndrome
- Patterns - idioms, best practices, code smells
-
Intro to Problems - common problems: cache, logging, config, representing date, time, money
- Intro to Libraries - reactive, reactor, commons, collections, apache, guava, logging, config, time, test, junit, vavr, immutable, lombok, mapping, mapstruct, time, joda, cache, Guava, Caffeine, and cache2k
- Intro to DateTime
- Intro to Logging
- Intro to Concurrency - thread, parallelism
- Intro to I18N - internationalization, encoding, unicode, big indian, little indian, ascii, utf, utf8, utf16, formatting, parsing, transliteration, charset, localization, time, timezone, zone id, zone offset, GMT
- Intro to Numbers - rounding, ceil, floor, base, integer, decimal, precision, mantis, exponent, significant, statistics
- Java Idioms
- Concepts
- Code Changes refactor, format, eol, bugfix, newfeature
- Convention Over Configuration
- Continuous Integration
- Continuous Delivery
- Code License
- Fluent Interface
- Semantic Versioning
- Take It Offline
- Flow
- Languages
- Hardening
- Smells
-
Intros
- Intro to Paradigms Object Oriented, Functional, Procedural, Asynchronous
- Intro to Logic
- Intro to Product UX, UI, business, technical, backend, frontend
- Intro to Roles
- Intro to Decision Levels : business, financials, domain, product, architecture, high level design, low level design, coding, debugging, quality, roles, stakeholders
- Intro to Steps
- Intro to Software Architecture
- Intro to Software Design
- Intro to UML state machine diagram, class diagram, sequence diagram
- Intro to Graphical Design
- Intro to Performance bigO, algorithm complexity
- Intro to Agile
- Intro to Scripting
- Intro to Shell execution, environment, registry, powershell, cmd, cmder, linux, bash, ash, csh, zsh, ksh
- Intro to Wiki
-
Intro to Building
- Intro to DevMachine
- Intro to Git
- Intro to Maven
- Intro to Docker
- Intro to Hosting Deploy, nameserver, hostname, registrar, ssl, ddns, dns, naked domain, wildcard domain, email, smtp, pop3, imap, DKIM, SPF, spam
-
Intro to Landscapes Language Environments, Web Landscape
- Intro to JVM Landscape
-
Intro to Javascript Landscape
- Intro to Javascript
- Intro to Typescript binding, implicit, explicit, default (global), callsite, lambda, callback, function, promise, async await
- Intro to Node javascript, npm, yarn
- Intro to DotNet Landscape C# csharp
- Intro to Golang
- Intro to Ruby
- Intro to Python
- Coding Style
- Phases
-
Intro to Quality - QA, Quality Assurance, code quality, bugs, bug levels, metabugs
- Intro to Tests
-
Test Driven Development TDD, mantra
- Domain-and-Test-Driven-Design Advanced topics
- Intro to Coding defensive, offensive, preconditions, postconditions
- Intro to Debugging
- Intro to Profiling, Intro to Performance
- Intro to Code Review
-
Intro to Quality - QA, Quality Assurance, code quality, bugs, bug levels, metabugs
- Intro to Functional
- Intro to Computers memory, cpu, hardware, neuman, computer science, devices
- Intro to OFM
- Intro to Databases Intro to Database Migration ORM, ObjectRelationalMapping, Hibernate, JPA, ebeanorm
- Advanced in Databases - optimistic lock, pessimistic lock
- Intro to WebDevelopment - tcp, http
- Data Structures & money
- Intro to Virtualization
- Admin section
- Intro to Types value, record, case class, alias
- Intro to Layers - frontend,ui,ux
- Intro to Culture - teams, psychology, principles, behaviour
- Intro to 41 - aboriginal linux, google whitepapers
- Intro to Security - ssl, handshake, tsl, https, basic auth, tokens, refresh, jwt tokens, access, refresh
- Intro to Crypto
- Advanced
- Advanced Java
- Circuit Breaker, retry, bulkhead, RateLimit, resilience
- Immutable, purity, pure functions, functional style
- Identification Surrogate vs Natural Keys, database, rest, microservice
- Infrastructure devops, docker, containers, kubernetes, k8s, private cloud, continous deployment
- Resources
- Project Templates
- Ships
- Ship10 - 2021-Aug
- Ship 1 - 2017-May
- Ship 2 - 2017-June
- Ship 3 - 2017-July
-
Ship 4 - 2017-September
- Team 4
- Team 4 Reloaded
- Backlog 4
- Sprint 4.1 old
- Sprint 4.1 Home old
- Sprint 4.2 old
- Sprint 4.2 Home old
- Sprint 4.3 old
- Sprint 4.3 Home old
- Sprint 4.4 old
- Sprint 4.4 Home old
- Sprint 4.5 old
- Sprint 4.5 Home old
- Sprint 4.6 old
- Sprint 4.6 Home old
- Sprint 4.7 old
- Sprint 4.7 Home old
- Sprint 4.8 old
- Sprint 4.8 Home old
-
Non software
- Physical Tools - home tooling