0% found this document useful (0 votes)
6 views8 pages

Komponentové Programovanie 2: Kvalita Kódu, Refaktorizácia, Balíky Java - Lang A Java - Util, Regulárne Výrazy

The document discusses component programming, emphasizing code quality, refactoring, and the importance of Java packages like java.lang and java.util. It highlights principles for good programming, such as code readability, DRY, and defensive programming, along with the significance of regular expressions in Java. The content is aimed at improving software quality and understanding essential Java classes and regular expressions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views8 pages

Komponentové Programovanie 2: Kvalita Kódu, Refaktorizácia, Balíky Java - Lang A Java - Util, Regulárne Výrazy

The document discusses component programming, emphasizing code quality, refactoring, and the importance of Java packages like java.lang and java.util. It highlights principles for good programming, such as code readability, DRY, and defensive programming, along with the significance of regular expressions in Java. The content is aimed at improving software quality and understanding essential Java classes and regular expressions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Komponentové programovanie 2

Kvalita kódu, refaktorizácia,


balíky [Link] a [Link], regulárne výrazy

Jaroslav Porubän
[Link]@[Link]
©KPI TUKE, 2017
Katedra počítačov a informatiky FEI TU Košice
Source Code Quality Matters!

Same nutrition facts

Dramatically Different Feeling!


Katedra počítačov a informatiky FEI TU Košice
Who is a Good Programmer?

Algorithms

Code
Quality Technology

Really Good Programmer


Katedra počítačov a informatiky FEI TU Košice
Code Quality
• Human readable names are very
important
– identifiers
– code conventions
• Code structuring and readability
• Applying principles, idioms, patterns
– DRY (Don't repeat yourself) principle
– Code Reuse
– Defensive programming
– Separation of concerns
Java code conventions
[Link]
Katedra počítačov a informatiky FEI TU Košice
Refactoring
Improving the Code Quality
• Process of restructuring existing code
without changing its external behavior
– improves nonfunctional attributes of the
software
• Supported by today IDE’s
– together with code generation support
• Software evolution is permanent
– code quality decreases with the time because
of changes in the software requirements,
technologies
Katedra počítačov a informatiky FEI TU Košice
Basic Classes in Java
Worth to know them
• Package [Link]
– Object
– wrapper classes: Byte, Short, Integer, ...
– String vs. StringBuilder
– System, Runtime
– Math
• Package [Link]
– Calendar, Date (see also [Link])
– Locale
– Formatter, Scanner
– Random
Numbers and strings
[Link]
Katedra počítačov a informatiky FEI TU Košice
Regular Expressions
Also worth to know them
• Package [Link]
– Pattern – compiled regular expression
– Matcher – engine for matching
• String function matches
"821224/8765"
.matches("[0-9]{6}/[0-9]{3, 4}")

"[Link]@[Link]"
.matches("\\w+[.]\\w+@tuke[.]sk")

Regular Expressions
[Link]
Katedra počítačov a informatiky FEI TU Košice
Minesweeper – Console User
Interface

Regular Expression: ([OM])([A-I])([1-9])

group 3 - column
group 2 - row
group 1 - command

You might also like