SlideShare a Scribd company logo
1 of 55
FONKSİYONEL
PARADİGMA
#direnstate
#nedirtv
muhammed cuma tahiroğlu
@devmucit
18 ekim 2014
?
1950
model
Akademi > Endüstri
FONKSİYONEL PROGRAMLAMA KONSEPTLERİ
IMMUTABILITY
REFERENTIAL TRANSPARENCY
CURRYING IDEMPOTENCE
SIDE-EFFECT
LAZY EVALUATION
RECURSION
PATTERN MATCHING
OOP:
ABSTRACTION
ENCAPSULATION
Nesne Yönelimli Programlama, hareketli
parçaları enkapsüle ederek kodu anlaşılır
kılıyor. Fonksiyonel Programlama ise hareketli
parçaları en aza indirgeyerek kodu anlaşılır
kılıyor.
— Michael Feathers
SIDE EFFECT
S T A T
E
M U T A B L E
FP
STATE
Variable
Değişken
t
1;
var x = 1;
x = x + 1;
İlginç bir anekdot
250 sayfa boyunca atama (assignment) yok!
y = f(x)
AssertEquals(f(x), f(x));
f(x) = f(x)
string
«IMMUTABLE» SINIFLARIN EFENDİSİ
KODA GEL
https://www.flickr.com/photos/norfolkodyssey/3863851867
MAP
C# 3.0
MAP
C# 3.0
FILTER
C# 3.0
FILTER
C# 3.0
REDUCE
C# 3.0
REDUCE
C# 3.0
STRATEGY PATTERN
MOTİVASYON
Unit Test yazmak,
fonksiyonel programlamayı
fonksiyonel olmayan dillerde
yeniden icat etmektir
Asıl problem,
«stateful» programların büyüdükçe
iyi olmayan bir yöne doğru evrilmesidir.
Gerektiğinde imperative programlayın;
mümkün olduğunda ise fonksiyonel.
YAZMASI VE BAKIM YAPMASI DAHA BASİT
DAHAAZ «CONCURRENCY» SORUNU
«TEMPORAL COUPLING» YOK
«STATE NEDİR?» DİYE SORMAK YOK
#direnstate
HAFIZA KULLANIMI
8 byte vs 8 Gb
MULTI-CORE COMPUTING (PARALEL PROGRAMLAMA)
AssertEquals(f(x), f(x));
Çekirdek - 1
Çekirdek - 2
FONKSİYONEL DİLLER
Clojure (Lisp)
ML
F#
2002’de Microsoft Research yayınladı
MARTIN ODERSKY
C# Java (8)
FONKSİYONEL OLANLA OLMAYAN MODÜLLERİ AYIRIN
«İyi bir yazılım mühendisi olmak için en uygun
teknikleri bulup bir denge sağlamak gerekir.
Ayrıca teknik olmayan yanlar ve hedefler de var.
Mesela kodun her ekip elemanı tarafından
anlaşılabilmesi gibi.
Doğru olan, en verimli yaklaşım hedeflerini net
olarak belirleyerek, teknikleri o amaçla tutarlı
bir şekilde kullanmaktir bence. Yoksa mesela
her For döngüsünü Map'e çevirdiğinizde
kodunuzun kalitesi artmaz; düşebilir bile.»
BURAK EMİR
Google - İsviçre
TEŞEKKÜRLER
@devmucit
FONKSİYONEL PARADİGMA
muhammed cuma tahiroğlu
tahiroglu.com
#nedirtv

More Related Content

Featured

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Fonksiyonel paradigma

Editor's Notes

  1. Neden fonksiyonel programlamadan bahsedeceğiz Biraz tarihçe Konseptler – genel bakış OOP’un faydası Side-effect kavramı Aforizmalar Kod örnekleri Burak Ekin’den mesaj Diller - kaynaklar
  2. Gelişen programlama stillerini az çok biliyoruz. Endüstrimizin şu an bulduğu en yaygın çözüm Object Oriented. Kurumsal Uygulamaların tamamı object oriented ortamlarda yazılıyor. Peki Functional programlamadan dünya uzaklaşmışken, neden bu aşk tekrar hortladı?
  3. Peki nereden geldi birden bire bu fonksiyonel aşkı? Moda gibi sıkılınca değiştirmek istediğimizden mi? Yoksa bir şeyi yanlış biliyorduk da yeni mi doğrusunu anladık Bir ilham mı geldi bir yerlerden Şartlar olarak değişen ne? Bu sunumda, fonksiyonel programlamanın OOP programcıları için ilginç olan değerlerine bakacağız Ve neden şimdi bunların popülerleştiğini sorgulamaya çalışacağız Kendi tecrübelerimizden de örnekler vereceğiz
  4. OO makes code understandable by encapsulating moving parts. FP makes code understandable by minimizing moving parts. — Michael Feathers
  5. Fonksiyonel programlama – how’dan çok what’ı anlatıyor
  6. - Ve en önemlisi, bir fonksiyonun çıktısı, diğer fonksiyonun girdisi olabilir
  7. IP bazında bağlantı sayısı
  8. Şimdi FP’nin biizm için anlamlı olan prensiplerinden bahsedelim SIDE – EFFECT nedir?
  9. Şimdi biraz fonksiyonel programlamanın OOP için anlam ifade eden temel konseptlerine bakalım State, durum olan state, fonksiyonel paradigmada kritik bir alan, sorunlu. State’in tümüne elbette bir düşmanlık yok. Özelde, mutable state’e, yani değişmeye karşı bir direnç var. Fonksiyonel programlama, moving part sözünden de hatırlayacağınız gibi kendini değişen, kımıldayan, ayran gönüllü yapılardan uzak kılmaya çalışıyor. Bu yüzden de sıklıkla
  10. Enemy of the state filmine atıf yaparlar.
  11. PEKİ şimdi state’in nasıl oluştuğuna bakalım mı?
  12. Immutable nesneler daha basit, tek state tutuyorsun, yaratıldığı state’de duruyor Ve doğal olarak senkronizasyon gerektirmiyor, thread-safe