DevUA

New


Categories


Tags


Meta


DevUA


Опитування. Віддалена робота – враження та ставлення

Мета опитувальника – зібрати враження українських ІТ спеціалістів від роботи віддалено. Сам опитувальник ось тут – ОПИТУВАЛЬНИК – і його все ще можна заповнити. Наразі є 230+ учасників Розділ перший: Профіль респондента Розділ другий: Формат роботи Розділ третій: Робоче місце та умови праці Розділ четвертий: Враження [...]

Andriy AndrunevchynAndriy Andrunevchyn

Git mastering 2

Some time ago I described how we migrated from SVN to GIT. As usual when somebody migrates from one to tool to another, also they bring their previous experience (good or bad). So we did the same.  We used the following approach  Everybody developed on their own branches then merged on dev branch, that branch […]

Andriy AndrunevchynAndriy Andrunevchyn

Недискримінація – це головний зміст відкритих джерел (open source)

Сьогодні я дізнався , що щось з назвою проект Lerna додав доповнення до його ліцензії MIT, забороняючи використовування його програмного забеспечення довгому спискові организацій, тому що цей проект не погоджується з політичним вибором цих організацій. Говорячи, як один зі оригінальних спів-авторів Визначення Відкритих Джерел (Open [...]

AlvetariAlvetari

wideNES – заглядаємо поза межі екрану ігор NES

У середині 1980-х років система Nintendo Entertainment System (NES) була домашньою консоллю з разряду повинно бути. Маючі кращий звук, кращу графіку і кращі ігри за порівнянням з будь-якою іншою домашньою консоллю того часу, вона стала зразком того, якими повинні бути домашні ігри. І до наших днів такі ігри, як Super Mario Bros., The [...]

AlvetariAlvetari

Інструкції Drupal 7

Hello Хочу поділитись зі світом моїми нотатками по роботі з Drupal 7. Інструкцію писав для себе в процесі навчання, дав оцінити товаришу, він сказав що вийшов корисний документ ИНСТРУКЦИЯ DRUPAL 7 V_5_4

nekiinekii

[ecko_annotated header=”” annotation=””]In this article I’ll try to provide step by step tutorial for beginners. For those who know nothing about Java and required environment or even about software development in general.[/ecko_annotated]

So, let’s begin.
For now, Java is the most popular in the world. It means you made a good choice :). It could be a bit difficult to start studying Java alone without any help that’s why I decided to prepare this roadmap.

I’ll split my article in a few logical parts like basic knowledge, required tools, databases, etc

First steps

  1. What is JDK and why we need it?

    JDK stands for Java Development Kit. In few words jdk translates Java language commands (your program) to computer instructions.
    You can download the latest jdk here. Just download and install. Follow official instructions. Now you are ready to write and run simple Java app. Just don’t forget to check if your jdk works properly. Open command line and execute command

    java -version

    if everything fine you will see Java version in console. By good old tradition first app should be called HelloWorld. Don’t spend your time on it and download app here. Run command line in the same folder with HelloWorld app and execute following command

    javac HelloWorld.java

    .JDK will compile the app and create new file HelloWorld.class – computer language version of Java app. Now you are ready to run our example. Execute command

    java HelloWorld

    in console and you will see this response

    Hello, World

    Let’s postpone explanation how this app works just remember the following – you should compile each project and only then run it.

  2. Simplest Java app

    HelloWorld is the simplest Java app and it consists of one class. Class is a logical unit in Java. In real life project could contain thousands of classes.

    package com.devua.article;
    import java.util.Date;
    
    public class HelloWorld {
        public static void main(String[] args) {
            System.out.println("Hello, World");
        }
    }

    First line is declaration of package. Package is not mandatory but it’s good practice. One important thing is if you add package declaration you should put file in corresponding folder structure. In our case it should be something like  MyTestProject/com/devua/article/HelloWorld.java. For test purpose you could skip package declaration. Otherwise when you compile you should go to MyTestProject folder, open command line and execute

    javac com/devua/article/HelloWorld.java

    and then execute

    java com.devua.article.HelloWorld

    Then we declare – import – the whole path to each other class which we need for our app. If we don’t need other classes we don’t import anything (We don’t use Date class here, so this import actually is not needed). Then we declare class itself. Hence, Java app is set of classes from one to infinity. ‘Cause apps have ability to grow all the time we group classes in packages from the start. I will not explain you how to write the code inside the classes, it takes a long time to do this and there are many good books on that subject. In Ukraine we usually recommend this one: Bruce Eckel – Thinking in Java but you can take any other book for beginners. Also I would recommend these two books: Jeanne Boyarsky and Scott Selikoff – OCA / OCP Java SE 8 Programmer Certification Kit. It’s shorter and cleaner so you will learn faster, especially if you have some elementary level in programming. Also, if you start with “Thinking In Java” you can skip GUI chapter without any harm. Even I would recommend you to stop reading before chapter about I/O then take few weeks to practice and only after that read the rest of the book.

 

Above I explained really basic things. I recommend you now to spend few weeks on reading some book for beginners and coding each practice tasks from that book.

Now when you got some information about language itself and how to run simple app I’ll describe more specific stuff.

Tools

  1. IDE

    It’s quite usual for Java app to consist of many classes so it would be difficult to manage the whole project in a file manager. Also, if you write code in plain text editor it’s quite easy to make mistakes: any kind of typo, misusing Java language command, lost parenthesis, etc. So, for real work everybody uses IDE (integrated development environment) – application which assists you during development process. The most popular IDEs in Java world are Eclipse, Intellij IDEA and NetBeans. I prefer Eclipse, but you can try all of them. Just download, install, create new project, create new class with name HelloWorld, copy content from file above and finally run. It will allow you to decide which one suits you the best. IDE will not do your job but at least save you from stupid mistakes.

  2. Build tools

    As I mentioned above Java project could contain many classes also it could contain dozens third party libraries and hundreds configuration files. It is possible to manage everything manually but it’s much easier to use specific tools called – build tools. The oldest one is Ant, the most popular – Maven and the newest is Gradle. All these tools allow you to control and manage middle size and big projects. You don’t need them for oneclass practice tasks but if you would like to develop some pet project or just successfully pass job interview it’s better to spend some time on reading docs about them and creating test project with Maven and Gradle.

  3. Version control systems (VCS)

    When you start to develop more complex projects you would like to check history of changes from time to time, perhaps rollback some changes and revert files to previous state. If you are not alone on the project it is quite nice to save project on shared folder and trace changes of each other. For such purpose we use version control systems. Nowadays the most popular VCS are GIT and SVN. There is no need to setup these stuff on local server, you can find a lot of free services online like github, bitbucket, assembla, etc. Again, it’s not mandatory to use VCS for test or pet projects but it’s good practice and such experience would be a big plus on a job interview.

Career path

Now You read really short list of required knowledge and standard tools but you should understand it’s quite far from real tasks in Java development.
There are different types of Java apps and developers in those areas have slightly different set of skills.You can start working as:

  1. Android developer

    Honestly, I would say it’s not even Java developer but you will need knowledge of Java there. Just to feel a spirit of android development you could setup Android Studio, run emulators, download and run some “hello world” for android. I would say it’s quite different “world” comparing to plain Java app..

  2. Embedded developer

    Low-level development for different kind of devices. Strong knowledge of core Java is must have. You will  work a lot with device specifications. It would be useful to know how hardware and communication protocols works.

  3. Desktop Java

    You should know core Java especially concurrency and you will have to learn Swing or SWT for user interface development. Actually it’s not so popular but still there are some market behind.

  4. Enterprise software developer

    Pay attention – enterprise software not always means enterprise Java. It’s most widespread direction in Java. Enterprise software is a computer software used to satisfy the needs of an organization.

Enterprise software

Most probably you will start working on enterprise project. There are two different approaches to build enterprise software with Java:

  1. based on Java standard technologies i.e. JSF, EJB, etc.
  2. based on Spring (or any other lightweight framework) and separated UI.

Nowadays the second way is more popular. Typical structure of such project is
frontend -> backend -> DB

As usual frontend is written in some modern JS framework and quite often Java developers who are working mostly on backend do nothing there. Communication between frontend and backend could be implemented in different ways for example REST services. REST service is exposed URL, when frontend calls this URL backend executes some action or returns some data. Such approach allows to separate frontend and backend. Let assume you as Java developer will work only on backend. I explained above how to compile and run plain Java app. In case enterprise software it works in a bit different way. After compilation you should build deployment package (file with extension .war) and run it on web server like Tomcat, Jetty, etc.
More details how to create webproject and deploy on Tomcat you can find here or here

Databases

Most applications store results to DB so that you should have at least general knowledge about communication with DB. Core of DB operation in Java is JDBC API. The JDBC API is a Java API that can access any kind of tabular data, especially data stored in a Relational Database. JDBC overview.
There are few different approaches were implemented over JDBC: jpa, jdo or something like jooq, where you can work with DB without using JDBC API directly but in fact it’s really recommended to try working with JDBC API at the beginning.
One more interesting thing you should know about DB is nosql solutions which are quite popular today so don’t forget to read about it and learn difference between sql and nosql solutions.

Not The End

It’s quite difficult to cover all stuff which are required in daily job of Java developer so I tried just to show you right direction. Some time in article I simplified things so don’t hesitate to double-check and read more. Studying things one by one in logical order allows you to develop skills properly. Don’t jump immediately on omnipresent frameworks like Spring. I would rather recommend you to read something about software design principles like DRY, KISS, YAGNI, SOLID. Pay attention to naming and code convention in general. Don’t be greedy – use full and clear names for variables and methods, put parenthesis everywhere, avoid ternary and unary operators if you can, do not write long classes and methods. Any newcomer should understand your code without comments and docs. Be clear and consistent in your code.
I’m pretty sure if you read a bit about everything I wrote and run few test projects it will give you good chance to obtain Java trainee/junior position.

 

If you found mistake or just have some idea for improvement – let me know by mail andriy@andrunevchyn.com

Roadmap for Java beginners

[ecko_annotated header=”” annotation=””]In this article I’ll try to provide step by step tutorial for beginners. For those who know nothing about Java and required environment or even about software development in general.[/ecko_annotated] So, let’s begin. For now, Java is the most popular in the [...]

Andriy AndrunevchynAndriy Andrunevchyn

We just migrated our source code to Git (GitLab) so that we decided to develop some git convention. I share our internal kitchen ’cause it could be useful for others as well. The main idea keeping master as only source for releases and all development should be done on branch called dev. Also we keep in reserve branch stage in case we will have to provide separate branch for qa purpose. For now we do not have dedicated QA on the given project so we directly merge from dev to master but if you have QA on project use following merge scheme dev -> stage -> master. Also on GitLab we have configured CI. For each push to remote repository CI builds project and show warning on MergeRequest in case project build/test fails.

Precondition

  1. We will use branch master only for releases!!!
  2. All changes should be merged to branch called dev and only then moved to master
  3. All changes from dev should be moved to master with GitLab Merge Requests. Do not run any actions manually through console!
  4. All development should be done on private branch created for each new task
  5. All changes from private branches should be moved to dev with GitLab Merge Requests
  6. Private branch should be deleted after approval of Merge Request

How to create dev branch

  1. Switch to master
    git checkout master
  2. Pull latest changes from origin master with discarding any local changes
    git pull --rebase origin master
  3. Create new branch dev on local env
    git checkout -b dev
  4. Push  local branch dev with command
    git push -u origin dev

How to create new private branch for development and then create Merge Request

  1. Sync local environment with git repository structure. Execute command once to let your local structure know about dev branch
    git fetch
  2. Switch to branch dev
    git checkout dev
  3. Get latest changes from dev
    git pull --rebase origin dev
  4. Create and switch to private branch
    git checkout -b  <my_private_branch_name>
  5. Development itself
  6. Commit your changes to local repository
    git commit -am "commit description"
  7. Push changes to remote repository
    git push -u origin <my_private_branch_name>

    Pay attention on key -u.  You can find good explanation on StackOverflow

  8. Create Merge Request with GitLab user interface. I recommend to select option “Remove source branch” and if you have enterprise version of GitLab also select option “Squash commits”
  9. Review Merge Request!
  10. Resolve conflicts if required
  11. Switch to branch dev again
    git checkout dev
  12. If you would like to remove local branches which are already removed on remote execute
    git fetch --prune

How to resolve Merge Request conflicts

  1. Switch to local version of dev
    git checkout dev
  2. Pull latest changes from origin dev with discarding any local changes
    git pull --rebase origin dev
  3. Switch back to private branch
    git checkout <my_private_branch_name>
  4. Rebase private branch on top of dev latest changes (reapply your work on top of the incoming changes)
    git rebase dev
  5. Resolve conflicts manually in conflicted files with IDE
  6. Commit changes
    git commit -m "commit description"
  7. Push changes with force key
    git push -f origin <my_private_branch_name>
  8. On this step Merge Request could be approved by reviewer

P.S.

In case you need to remove local branches which already deleted on remote repo, call

git remote prune origin

List all local branches with command

git branch

If you found mistake or just have some idea for improvement – let me know by mail andriy@andrunevchyn.com

Git mastering

We just migrated our source code to Git (GitLab) so that we decided to develop some git convention. I share our internal kitchen ’cause it could be useful for others as well. The main idea keeping master as only source for releases and all development should be done on branch called dev. Also we keep […]

Andriy AndrunevchynAndriy Andrunevchyn

Выделение области карты на GoogleMap

Наверняка многие сталкивались с такой штукой как рисование на карте, может не в разработке, но в использовании каких либо приложений, их просто куча. Заказчики бывает насмотрятся на такие приложения и потом хотят себе такое же, а ты сидишь такой, не знаешь за что хвататься, а тут еще и эта фича которую ты вообще без понятия […]

GlebGleb

Віртуальний GUI на Scala

Розглянемо створення застосунку з графічним інтерфейсом, який би працював на робочому столі , в браузері та під Android без зміни коду. Звичайно нам знадобляться бібліотеки- фасади, які інкапсулюють різницю між бібліотеками контролів цих систем (JavaFX, Android, DOM) Для створення таких фасадів прекрасно підходять implicit класи. [...]

Анатолій МастюкАнатолій Мастюк