LibCoder

Kotlin from Scratch: A Project-Based Introduction for the Intrepid Programmer

1C Agda Kotlin
Kotlin from Scratch: A Project-Based Introduction for the Intrepid Programmer
Автор: Islam Faisal
Дата выхода: 2025
Издательство: No Starch Press, Inc.
Количество страниц: 435
Размер файла: 3,1 МБ
Тип файла: PDF
Добавил: LibCoder
Оглавление
Cover....1 Title Page....5 Copyright....6 Dedication....7 About the Author....9 About the Technical Reviewer....9 Brief Contents....11 Contents in Detail....13 Acknowledgments....21 Introduction....23 The Power of Coding....24 Why Kotlin?....24 Who Is This Book For?....25 What’s in This Book?....26 The Projects....28 Getting Started....31 Resources....32 Part I: Programming Fundamentals....33 1. Kotlin Basics....35 Using Comments....36 Variables....37 Constants....38 Common Data Types....39 Operators....42 Arithmetic....42 Assignment....44 Unary....44 Relational....44 Logical....45 Working with Strings....46 Concatenation....46 String Templates....47 Escape Sequences....48 Null and Nullable Types....49 Flow Control....50 Conditional Statements....50 Loops....54 Functions....59 Built-in Mathematical Functions....60 Custom Functions....61 Scope Functions....66 Lambda Expressions....67 Basic Input and Output....69 Console-Based Input and Output....69 Simple File Operations....71 Project 1: Build a Console-Based Calculator....72 The Code....73 The Result....76 Summary....77 Resource....77 2. Arrays, Collections, and Classes....79 Arrays....80 Primitive Arrays....81 The Array Constructor....81 Array Operations....82 Multidimensional Arrays....83 Collections....84 Lists....84 Sets....86 Maps....88 An Introduction to Classes....89 Constructors....90 The init Block....93 Methods....94 Encapsulation....95 The this Keyword....96 Inheritance and Polymorphism....97 Common Classes and Custom Types....99 Data Classes....100 Pairs and Triples....102 Abstract Classes....103 Interfaces....104 Enum Classes....106 Copying Objects....107 Shallow Copy....107 Deep Copy....108 Project 2: Build a Versatile Task Manager....110 The Code....110 The Result....116 Summary....117 Resource....118 3. Visualizing with JavaFX....119 Data Visualization Tools for Kotlin....120 An Overview of JavaFX....121 Key Functionalities....121 Setup....122 Project 3: Build “Hello, World!” in JavaFX....122 The Code....124 The Result....127 The JavaFX Object Hierarchy....128 The Stage....128 Scenes....128 Layout Containers....129 Child Nodes....130 Creating JavaFX Charts....130 Project 4: Visualize Data as a Bar Chart....131 The Code....131 The Result....133 Project 5: Create a Multiseries Line Chart....134 The Code....135 The Result....137 Drawing with the Canvas....139 A Simple Shape....139 Common Graphics Context Methods....141 Project 6: Draw a Spiral Seashell....142 The Strategy....142 The Code....143 The Result....147 Animation in JavaFX....147 Project 7: Animate a Square....148 The Code....148 The Result....149 Project 8: Animate a Bouncing Ball....150 Setting Keyframes Explicitly....150 Using an Action Event Listener....152 Summary....156 Resources....156 Part II: Applications in Math and Science....157 4. Solving Mathematical Problems with Code....159 Project 9: Find the Square Root with the Babylonian Algorithm....160 The Code....161 The Result....162 Project 10: Create Pythagorean Triples with Euclid’s Formula....162 The Code....163 The Result....164 Project 11: Identify Prime Numbers with the Sieve of Eratosthenes....165 The Strategy....165 The Code....166 The Result....167 Project 12: Calculate Earth’s Circumference the Ancient Way....168 The Code....170 The Result....171 Project 13: Code the Fibonacci Sequence....171 The Golden Ratio....173 The Fibonacci Spiral....173 The Code....175 The Result....179 Project 14: Find the Shortest Distance Between Two Locations on Earth....180 The Code....182 The Result....185 Project 15: Do Encryption with the Hill Cipher....186 How It Works....186 The Code....189 The Result....195 Project 16: Simulate a One-Dimensional Random Walk....196 A One-Dimensional Model....197 The Code....198 The Result....202 Summary....205 Resources....206 5. Modeling and Simulation....207 Project 17: Predict the Flight of a Cannonball....207 The Strategy....210 The Code....211 The Result....213 Project 18: Design a Fountain with Water Jets....214 The Strategy....216 The Code....216 The Result....220 Project 19: Track a Pendulum’s Motion and Phase....221 The Motion of a Simple Pendulum....222 The Strategy....223 The Code....224 The Result....229 Project 20: The Physics of Coffee Cooling....232 Newton’s Law of Cooling....232 The Effect of Mixing Liquids....233 The Strategy....233 The Code....234 Project 21: Simulate a Binary Star System....241 The Science of Binary Star Systems....242 The Strategy....243 The Code....244 The Result....251 Summary....253 Resources....253 Part III: Recursion, Sorting, and Searching....255 6. Recursive Functions and Fractals....257 The Concept of Fractals....258 Recursive Functions....259 Project 22: The “Hello, World!” of Fractals....261 The Strategy....262 The Code....263 Project 23: Draw the Sierpiński Triangle....266 The Strategy....267 The Code....268 Project 24: Create a Fractal Tree....271 The Strategy....271 The Code....272 The L-System and Turtle Graphics....273 Formalizing the L-System....274 Drawing L-System Patterns with Turtle Graphics....275 Project 25: Design an L-System Simulator....277 The Code....277 The Result....283 The Mighty Mandelbrot Set....284 Project 26: Code and Visualize the Mandelbrot Set....286 The Code....287 The Result....291 Summary....294 Resources....294 7. Sorting and Searchin....297 Sorting Algorithms....298 Project 27: Space-Efficient Sorting with Insertion Sort....300 The Code....301 The Result....302 Project 28: Faster Sorting with Merge Sort....302 The Code....303 The Result....305 Project 29: High-Efficiency Sorting with Quick Sort....306 The Code....307 The Result....309 Search Algorithms....310 What Is a Graph?....310 How to Search a Graph....311 Project 30: Stack-Based Searching with Depth-First Search....312 The Code....313 The Result....314 Project 31: Queue-Based Searching with Breadth-First Search....316 The Code....317 The Result....318 Project 32: Heuristic Searching with A*....320 The Heuristic Function....321 The Algorithm....323 The Code....324 The Result....330 Summary....332 Resources....333 Part IV: Optimization with Nature-Inspired Algorithms....335 8. The Genetic Algorithm....337 Nature-Inspired Algorithms....338 The Optimization Problem....338 When to Use NIAs....341 An Overview of the Genetic Algorithm....342 Genetic Operators....343 Selection....344 Crossover....346 Mutation....347 Elitism....347 Project 33: Evolve Gibberish into Shakespeare....348 The Strategy....348 The Code....348 The Result....353 Project 34: Solve the Knapsack Problem....355 The Strategy....355 The Code....356 The Result....362 Project 35: Optimize a Multivariate Function with the Genetic Algorithm....364 The Strategy....365 The Code....365 The Result....370 Stopping Condition for Genetic Algorithms....373 Summary....375 Resources....375 9. Agent-Based Algorithms....377 An Overview of Particle Swarm Optimization....378 Implementing PSO for Function Minimization....380 Project 36: Optimize a Multivariate Function with a Particle Swarm....382 The Code....382 The Result....386 Ant Colony Optimization....388 The ACS Algorithm....390 Symbols and Their Meanings....390 The Steps of ACS....391 Project 37: Solve the Traveling Salesman Problem with an Ant Colony System....393 The Code....393 The Result....405 Summary....408 Resources....408 Afterword....411 Appendix....413 Key Definitions....413 Workflow for Creating an App....415 Setting Up Shop....416 Step 1: Download and Install IntelliJ IDEA....416 Step 2: Download and Set Up the JDK....417 Step 3: Create a New Project....417 Index....421 Back Cover....435

Описание

В этом материале разберём тему: kotlin.

Kotlin isn’t just for building Android apps. As you’ll learn in Kotlin from Scratch, it’s also a general programming language for crafting both elegant and efficient code.

You’ll explore the way Kotlin handles variables, control structures, functions, classes, and data structures, and you’ll learn to create visualizations using Kotlin and the JavaFX graphics library. With the aid of 37 hands-on projects, you’ll move quickly through the language basics while building your problem-solving skills, even tackling advanced concepts like fractals, dynamic systems, and nature-inspired algorithms. Then you’ll build increasingly sophisticated apps to practice what you’ve learned while tackling challenges from math and science to algorithms and optimization.

As you progress through the book, you will:Simulate physical systems, like the intricate dance of binary starsImplement the classic Hill cipher for encryption and decryptionGenerate beautiful fractals with recursive algorithmsProgram classic computer science algorithms for sorting and searchingSolve the infamous Berlin52 traveling salesman problemExpand your language repertoire and improve your computational thinking with Kotlin from Scratch.

Если материал оказался полезен — сохраните страницу.

kotlin from scratch language your algorithms building apps

Частые вопросы

Можно ли скачать «Kotlin from Scratch: A Project-Based Introduction for the Intrepid Programmer» бесплатно?

Да, «Kotlin from Scratch: A Project-Based Introduction for the Intrepid Programmer» доступна для бесплатного скачивания на нашем сайте в формате PDF. Ссылка на файл находится на этой странице.

В каком формате и какого размера файл?

Книга предоставляется в формате PDF, размер файла 3,1 МБ.

Кто автор и когда вышла книга?

автор — Islam Faisal, издательство No Starch Press, Inc., год выпуска 2025, 435 страниц.

О чём книга «Kotlin from Scratch: A Project-Based Introduction for the Intrepid Programmer»?

Kotlin isn’t just for building Android apps.

Похожие материалы