Can programming be truly declarative? [closed] - theory

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I've been teaching myself a bit about declarative vs imperative programming, and I've come to the (possibly false) understanding that declarative programming is more or less just abstraction.
For example, according to how I understand these concepts, calling a method to do something would be declarative, whereas the implementation of the method is imperative (not necessarily, though? Just not declarative).
Therefore, it seems as if wherever you have declarative code, somewhere down the line it must rely on non-declarative code for implementation. Is this just the nature of it, or are there languages that are 100% declarative (something I can't even begin to conceptualize)?
Please correct me if my understanding of these concepts is off! Although I'm roughly halfway through a B.A. in Computer Science, I feel like I've only been taught so far to "type stuff so that the right stuff happens when you run the code."
Thanks.

Declarative programming expresses the logic of a software component without outlining it's control flow. That methodology of calling functions (which is called functional programming - a sub-paradigm of declarative programming) you are talking about can be a bit confusing, especially when learning programming and probably learning a language like C/C++/Java. There are functional programming languages, such as Lisp and Haskell, that utilize the functional paradigm completely.
When just starting off, I wouldn't try to learn the implementations of those paradigms simultaneously. Instead I find it easiest to think of declarative languages as the highly expressive languages like CSS SQL. They describe WHAT should be done in plain English with the HOW abstracted away.

Related

Should I learn React Before Learning Clojurescript Om? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I'm going to learn Clojurescript for building UIs and I want to use the React wrapper.Should I learn React before diving into Om?
Learn ClojureScript first, don't even think about React.
The learning curve for Om is not straightforward and you'll need to have a fairly grounded understanding of the fundamentals of the language before some of the abstractions that come with Om make sense (atoms, protocols etc). It's designed to be powerful, not simple and accessible.
Honestly, I'd try Re-agent first. The syntax for describing views is nice out-of-the-box and it'll also help solidify your understanding of atoms. If you like it, then you can complement it with Re-frame for a full blown FRP architecture.
I think it's easier to learn Om coming from Re-agent or Re-frame, than it is from React.
No, just dive into Om (or Reagent).
For 99% of UI concerns you won't need to know about the underlying React details, eventually for that 1% of cases you'll need to refer to the React docs.
I wouldn't worry too much about React. You can learn it through Reagent. Dive straight into Reagent by reading existing code. I started with the Flappy Bird demo and a few others.
To understand React you could look for uses of componentDidMount and the other component lifecycle methods. But honestly you only need to understand these methods for special use cases. Each item having to have a unique key is something that will trip you up, but only for legacy code as that requirement has been removed in the latest version of React.
You could also, even right from the beginning, be reading Om Next code and tutorials. You won't understand them fully right away, but keep having to go back to them. I believe that's the case for everyone!
How you approach it will also depend on whether you are a top-down or bottom-up learner. A bottom-up learner might be delighted to find out from one of the tutorials that queries have metadata linking them to components. On the other hand a top-down learner might be relieved to find a complete application to study. Here's my current best effort at a small Om Next application for understanding purposes.

Getting started with the sport of competitive programming [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
How do you get started with competitive programming and get well versed with various topics in it ?
What all things you can do ?
Get started directly or do some concepts first.
This is a very popular question on Quora, but is generally considered off-topic for Stack Overflow. The best way to use SO for competitive programming advice is to ask specific questions about problems you're having when coding a solution. For example, you might ask how a language feature works. Often you'll find that the question has already been asked.
Here are the 108+ Quora answers to your question: https://www.quora.com/How-do-I-become-a-competitive-programmer
The summary answer is: Get started solving problems. If you have any programming background, which I'm sure you do since you're asking this question, you'll get more benefit from just starting rather than reading a lot first. When you get stuck on something, that's the time to read books or online resources.
If you're having trouble deciding what to start on, here's a suggestion from my blog of how I would get started: http://www.redgreencode.com/about-project-462/
My 2 cents...
Best option is to get registered at the following coding sites..
+ topcoder.com
+ codechef.com
+ hackerrank.com
And, while you hack code here, you can build upon your programming foundation by learning more on
+ Data structures
+ Algorithms
+ Operating system concepts
+ Networking concepts and more ...
You could also start looking at the following books in this area...
+ The Algorithm Design Manual
+ Programming Challenges: The Programming Contest Training Manual
+ Competitive Programming 2
My advice would be to get registered with a Competitive Programming site if you know how to write simple codes in a particular programming language and solve the basic problems(the ones which does not require algorithms or require basic ones).
My suggestion on the choice of site is:-
1)HackerRank:-https://www.hackerrank.com/
Problems are well categorized here.Practice the questions marked 'easy' here followed by a few 'medium' ones.Complete the '30 Days of Coding Challenge' that would give you a good basic idea of the Java language.Also, check other's code and the editorial even if your code passes all the test cases.
2)SPOJ:-
Practice the problems categorized under 'ad-hoc' here.Start by solving the problems which are solved by most people...usually they will be easier.
3)Start implementing basic(or standard) algorithms. It is suggested to read them from Topcoder tutorials or Introduction to algorithms.Also, follow a standard book along with it.Now, practice problems based on those algorithms until you get familiar with them.
4)After you get acquainted with the most common algorithms start competing in coding challenges.Practice makes you better. Try to solve problems from previous contests. Solve as many problem A-s as you can until they give you some trouble. Then move on to B, then C etc.
Hope it helps :)
P.S. Also check the following answer on Quora:-
https://www.quora.com/What-is-the-best-strategy-to-improve-my-skills-in-competitive-programming-in-2-3-months/answer/Sachin-Gupta-6?srid=4gZ6

Can programming tasks be taken over by artificial intelligence? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I was reading an article earlier that suggests 1/3 of us are scared their job will be taken over by robots at some point. At first I was thinking (as robots have to be programmed as well) that we, as programmers, would be safe from this. That brought me to this question.
Would artificial intelligence be capable of performing (advanced) programming tasks or would they always be limited to the level they where programmed at?
What I mean by level is, for example, a scripting language as opposed to a programming language. (Would it be even possible for a scripting language to write and compile software in a programming language?)
This topic was put on hold because the answers would be based on opinions rather than facts. Just for clarity, I am expecting answers that are based on facts. An answer that simply says yes or no would be an opinion based answer, an answer that explains why is based on facts.
Okay, first of all, since you are dealing with the development of programs, it would be better suited to consider this a question based on Artificial Intelligence, rather than Robotics. It's much more simpler to develop programs to write other programs instead of developing a physical entity to type out a program.
AI has developed to such an extent, that simple games can be played much better than what normal humans can do: Wikipedia: Progress in AI.
As of now, development of complex programs is still out of the reach of AI, though it's not far off. Still, for the most part, AI may be used to assist human developers - since it's still not fully developed - rather than replace them altogether.

Socket programming - serialization [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have read through Beej's guide, as well as many other resources I've been able to find on the internet, but I feel like I'm missing something in terms of serialization and de-serialization. I can sort of hash it out by hard-coding in a definite structure for the server and client to send/receive, but I wonder if there are any resources that I could look at which might help me to serialize more efficiently or generally, something that would help me to possibly re-use some of my serialization code in other programs instead of having to write custom-made serialization functions for every data structure that I want to pass around?
Google Protobuf might be useful to you, specially if you might want to consider a cross platform application implemented in multiple programming languages.
Protobuf has the serialization implemented already, so you would have that going for you.
As the above link is for c++, this is the c pendant.
But there are also implementations for many other languages, like Python, PHP, Java and many other!
Another C Protobuf library is nanoPB, thanks to πάντα ῥεῖ for pointing this out. It seems that this one is stable.
Another way would be to use another serialisation library to serialize and deserialize your data.
The last possible way would be to implement the serialosation by yourself, like it is described on this SO question.

Is Wolfram Language a true programming language? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Wolfram is about to release its "knowledge based programming language" but is it really a true programming language in the same way as C#, Java etc?
To avoid this being too subjective, I'll clarify that by "true programming language" I mean: is it Turing complete?
What qualifies as "true" for you? Do you mean Turing complete?
see From this answer
In general, for an imperative language to be Turing-complete, it needs:
A form of conditional repetition or conditional jump (e.g., while, if+goto)
A way to read and write some form of storage (e.g., variables, tape)
In Venture Beat's coverage of Wolfram's announcement of the language they write:
In other words, “South America” is not a variable to be assigned, or an object or class to be instantiated. It’s a phrase that is known and understood, with significance and meaning and connections that can be pulled into your program with very little effort, and no external data sources. And, that knowledge source is continually updating and growing to match the updating and changing world.
Source
Which makes it sound as if the focus of the language is on the Wolfram Database and various ways of manipulating this data.
Wolfram himself further says of the language
“The level of automation is incredibly higher than people could ever have before – it’s incredibly powerful,” Wolfram says. “Anything that WolframAlpha knows, your app knows.”
Source
Which once again sounds like what we're looking at is a scripting language aimed at harnessing Wolfram Alpha's combination of data + search algorithms.

Resources