• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

I Declar-ative this forum open

 
Marshal
Posts: 80212
423
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . . and ready for custom. A lot of functional programming uses a declarative style, where you try to say what you are doing rather than how to do it in the actual code. Much SQL is written in a declarative idiom, too.
 
Ranch Hand
Posts: 607
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:. . . and ready for custom. A lot of functional programming uses a declarative style, where you try to say what you are doing rather than how to do it in the actual code. Much SQL is written in a declarative idiom, too.



(I am going to put in bold all my doubts)

In general I like the idea to tell do not ask, Is something really powerful even in software architecture design, in fact is how it works the command and strategy pattern, is how a SOLID architecture should be, regarding being open/closed and with dependencies pointing inward as in the Adapter pattern. So I am wondering if the concept of declarative can be extended from a language to an architecture.

Furthermore today exist a language from Google called Dart, really similar to Java that is going use a framework  called flutter to declare the User Interface, the View via declarative commands, this approach furnish also the possibility to make it the view Reactive, as today front end developers do already with React and Vue. But this flutter allows to run web front end, Android and iOS all in one go, really powerful. I am wondering if this trendy way to use views is declarative

I associate declarative programming to functional, somebody says functional is a type of declarative programming, others not. And functional programming should be based on functions where you get input and output.So also "old" Java  but I mean the Alan Kay concept is based on functions and in a method(= a function) you have always an input and output. So why functional is defined in this way if even OO follows the same strategy? All the programming languages that have functions work in this way, really confusing to me, but can relate to what is declarative programming. I am seeing some clojure, lisp video and are really-really beautiful, but what I know about declarative programming stems from my specific expertise in RX and Kotlin features. Find really powerful to see coding as a Stream and having an observable/observer relationship, and exploit this declarative/functional way to  use predicates to move the processes in different threads but still I do not know why I associate declarative to recursion algorithms, is something under my conscience three-sold I know the two are in strong relationship but cannot explain why, then I found haskell that is really functional/declarative and uses a lot of recursion, but still I miss pieces
 
Bartender
Posts: 15737
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it's the power of guilt by association.

You associate recursive functions with functional programming, and you associate functional programming with declarative programming, so you associate recursive functions with declarative programming.

I assure you that recursive algorithms are not necessarily functional. Imagine a tree data structure where every node holds a value and you want to map one tree to another result tree. Here's a functional approach:

You can do something similar imperatively, using recursion:

The first code snippet is declarative because it says WHAT a TreeNode with mapped values is: it's a TreeNode with the same key, a mapped value and children with recursively mapped values.

The second code snippet is imperative because it says HOW to replace all values: first replace the value of the current node and then replace the values of all children recursively.
 
Giovanni Montano
Ranch Hand
Posts: 607
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No doubt about what you are saying, I am aware that recursion is an algorithm and so is a meta-abstract way to solve a problem, not an implementation as imperative/declarative is. If we try to force our abstract thinking capabilities to a really challenging level recursion lives in a word above a language syntax, or better the modalities how a programming language is defined and then implemented.

Still I am wondering if we can say that architecture that also lives a level up to syntax languages also can benefit of the idea of declarative, to put idea in a philosophical platonic meaning. My point is that dependency injection principle, command and strategy design patterns, and open closed principle are declarative in the same way a language can be.

Third point could you elaborate a bit better your idea of functional vs/and imperative? I do not get your vision Stephen, jou het is en storm in een glasje definities hoor!
 
Campbell Ritchie
Marshal
Posts: 80212
423
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Giovanni Montano wrote:. . . recursion is an algorithm . . . above a language syntax . . .

I am not convinced about that; I think recursion is more of a methodology. It is important to use words correctly, otherwise nobody will understand one another.

. . . en storm in een glasje definities hoor!

Who's having a storm in a teacup? Please post everything in English.

Please don't simply quote the whole of the preceding post (removed).
 
Giovanni Montano
Ranch Hand
Posts: 607
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mmh about recursion yes good point, divide and conquer  and in the specific recursion  is a way to think, and not an algorithm. Quick sort is an algorithm derived by divide and conquer, and even from recursion, you are absolutely right.

Sorry to have posted in another language, I love the Dutch expressions, are so different by my native language from an anthropological/linguistic point of view they reflect a lot about the different cultural assumptions made in comparison from my Southern Italian one. Maybe there was some narcissism involved from my side to show off I learned this difficult Dutch language in the end after 10 years struggling. Excuses.

Anyway I am really happy I quoted this Alan Kay, I am looking at him on the internet during the last two hours, what a genius is, I really recommend his talk: Power of simplicity, I am learning a lot from him today.

Is amazing how many smart people there were in the pioneering computer times, I understand why Robert Cecil Martin always repeat that most of the software innovation, especially for what concern language syntax of paradigm where made in the 50s. I was thinking that even in the economy is the same, maybe human beings are going backward regarding creativity and intelligence.  




 
Campbell Ritchie
Marshal
Posts: 80212
423
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Giovanni Montano wrote:. . . Sorry

Apology accepted

. . . I love the Dutch expressions, are so different by my native language . . .

Doesn't the Dutch you quoted yesterday mean, “that's a storm in a teacup”?

Alan Kay, . . .

Yes, Alan Kay is somebody good to learn from.
 
Giovanni Montano
Ranch Hand
Posts: 607
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes this linguistic expression is fantastic. I am Italian quite dramatic as the stereotype, and I work in a Dutch company in the most Dutch city, where drama is seen in a strange way. Dutch from North Holland say:  doe maar normal dat is gek genoeg, basically act normally because acting normally is crazy enough.

So really often they use with me this expression basically "you are seeing a thunderstorm in a couple of water", namely you are over reacting to the problem. I really love Dutch Calvinistic culture and we have a lot of fun patronizing each other in a nice way.
 
Campbell Ritchie
Marshal
Posts: 80212
423
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't know that much Noord‑Holland myself. Zandvoort maybe, or Haarlem, or some of Amsterdam. Of course, you haven't lived until you have found the great hills of Texel. Or the similar hills of the Kennemeerland.
 
Giovanni Montano
Ranch Hand
Posts: 607
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nice you are acquainted with this fabulous country, I am currently living in Haarlem, that I get a daughter so needed a bigger house leaving Amsterdam, is really relaxing the pace of life, and it looks like to be into a medieval city sometimes, the stores look vintage, and with a mechanical racing bike is such a pleasure to visit the places you mentions. With the change of climate is really nice, and get dark really late on the evening.

 
Stephan van Hulst
Bartender
Posts: 15737
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Giovanni Montano wrote:My point is that dependency injection principle, command and strategy design patterns, and open closed principle are declarative in the same way a language can be.


I think that almost everything that focuses on something different from the implementation of a method can be considered declarative. But on a more abstract level, declarative programming is not syntax, it's a way of thinking about the components in your application and the way they behave. Method names strongly reflect whether an application was designed with a declarative approach versus an imperative approach. A declarative application uses a lot of nouns. It focuses on things. An imperative application uses a lot of verbs, it focuses on tasks. You can easily see the difference between declarative and imperative programming in the example I gave, even if you remove the method bodies:

Declarative:
Imperative:

I do not get your vision Stephen, jou het is en storm in een glasje definities hoor!


I wasn't quite sure what you meant by this as the sentence is ungrammatical. If you meant to say "You are making a storm in a cup of definitions", it should be "Je maakt een storm in een glaasje definities". Don't worry though, I'm very aware of the difficulties one faces when switching between Italian and Dutch. Una volta ho avuto una ragazza da Milano, molto tempo fa. Da allora ho perso molto del mio Italiano.

Anyway, I'm glad you're enjoying Haarlem. I've been there a couple of times, one of my favorite visits was when they had an Anthony Fokker exhibit in the St. Bavo church. I'm South African, but my father is Dutch and I was raised in a small town in the vicinity of Alkmaar, another city that's quite old.

When I turned 18 I moved to Enschede in the east of the country to study there, and now I live in Cologne, in Germany. I find it great that so many people are living in different countries than where they were raised. My Italian ex-girlfriend loved to make fun of the Dutch and Germans, but she really came to appreciate some of their cultural quirks. One thing she liked to joke about though was that coffee was the best thing about a Dutch dinner, because it meant dinner was over.
 
Giovanni Montano
Ranch Hand
Posts: 607
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand now about declarative as an abstract concept, I am getting more and more into the file rouge that link all the code methodologies, there is a common thread indeed in the thought of the pc pioneers, anyway I see more and more the resemblances across different declarative languages, final variables to encourage immutability, and a flow feeling with code that goes from a mutation to another(map usually) are the first indicators to me. Still functional does not make any sense to me, as I reckon that Object Oriented is functional.
Nice to learn about Anthony Fokker, really interesting for me, still a lot to learn for me about habits of Dutch people.  Koln is really cosy and really close to the Netherlands. Yeah Italians abroad live of stereotypes. I found some really beautiful Dutch restaurants, not too mention that you can find really good products in the supermarkets, and you can taste every kind of international flavor in North Holland, also Italian cuisine in the last 10 years is improved a lot for my really picky standards.
 
Bartender
Posts: 5584
213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The correct Dutch expression is: "een storm in een glas water".
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic