Search Results

Search found 14176 results on 568 pages for 'functional programming'.

Page 6/568 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • What are some techniques I can use to refactor Object Oriented code into Functional code?

    - by tieTYT
    I've spent about 20-40 hours developing part of a game using JavaScript and HTML5 canvas. When I started I had no idea what I was doing. So it started as a proof of concept and is coming along nicely now, but it has no automated tests. The game is starting to become complex enough that it could benefit from some automated testing, but it seems tough to do because the code depends on mutating global state. I'd like to refactor the whole thing using Underscore.js, a functional programming library for JavaScript. Part of me thinks I should just start from scratch using a Functional Programming style and testing. But, I think refactoring the imperative code into declarative code might be a better learning experience and a safer way to get to my current state of functionality. Problem is, I know what I want my code to look like in the end, but I don't know how to turn my current code into it. I'm hoping some people here could give me some tips a la the Refactoring book and Working Effectively With Legacy Code. For example, as a first step I'm thinking about "banning" global state. Take every function that uses a global variable and pass it in as a parameter instead. Next step may be to "ban" mutation, and to always return a new object. Any advice would be appreciated. I've never taken OO code and refactored it into Functional code before.

    Read the article

  • How difficult is it to change from Embedded programming to a high level programming [on hold]

    - by anudeep shetty
    I have a background in Computer Science. I worked on Embedded programming on Linux file systems, after I finished my Bachelor's degree, for over a year. After that I pursued my masters where most of my course choices involved working on web, java and databases. Now I have an offer to work with a company that is offering a job to work on the OS level. The company is pretty good but I am feeling that my Masters has gone to waste. I wanted to know is it common that a Computer Science major works on low-level coding and is there a possibility that I can work in this company for some years and then move onto an opportunity where I can work on high-level coding? Also is working on low-level programming a safe choice in terms of job opportunities?

    Read the article

  • Does FP mess up your OOP skills?

    - by bonomo
    I've been learning functional programming in Haskell and F# for awhile and now when I got some skills it gets harder for me to think in OOP way and program in C# and JavaScript. Everything seems to be ass-backwards there with classes, interfaces, objects and I often stare at the screen trying to think of a better way around without using them. This is something that scares me, because I didn't have problems like that before (not knowing that the same stuff can be done in a different way). So I am concerned as I don't want to loose myself as a OOP developer, because this is what I do for living. Is it a normal thing? Shall I rather stop doing FP? How did you manage to cope with it?

    Read the article

  • Ways to earn money through programming and/or programming knowledge [closed]

    - by Jason Swett
    It occurred to me today that it might be useful to make a list of all the ways to earn money through either actual programming or just programming knowledge. I imagine it's probably a finite list as long as you stick to a reasonable level of granularity. Here's what I have so far: Trading your time for money (i.e. having a job or being a freelancer) Building your own software product (a full-fledged startup or a tiny mobile app or whatever) Giving talks at conferences and meetups Teaching students in a classroom Writing a book or blog (these are products, but non-software products) I've probably missed at least a few. What else is there? (I'm not sure whether this is an appropriate question, by the way. I think I would select the best answer based on how practical/original/interesting/numerous your suggestions are.)

    Read the article

  • Functional Programming - Lots of emphasis on recursion, why?

    - by peakit
    I am getting introduced to Functional Programming [FP] (using Scala). One thing that is coming out from my initial learnings is that FPs rely heavily on recursion. And also it seems like, in pure FPs the only way to do iterative stuff is by writing recursive functions. And because of the heavy usage of recursion seems the next thing that FPs had to worry about were StackoverflowExceptions typically due to long winding recursive calls. This was tackled by introducing some optimizations (tail recursion related optimizations in maintenance of stackframes and @tailrec annotation from Scala v2.8 onwards) Can someone please enlighten me why recursion is so important to functional programming paradigm? Is there something in the specifications of functional programming languages which gets "violated" if we do stuff iteratively? If yes, then I am keen to know that as well. PS: Note that I am newbie to functional programming so feel free to point me to existing resources if they explain/answer my question. Also I do understand that Scala in particular provides support for doing iterative stuff as well.

    Read the article

  • Why hasn't functional programming taken over yet?

    - by pankrax
    I've read some texts about declarative/functional programming (languages), tried out Haskell as well as written one myself. From what I've seen, functional programming has several advantages over the classical imperative style: Stateless programs; No side effects Concurrency; Plays extremely nice with the rising multi-core technology Programs are usually shorter and in some cases easier to read Productivity goes up (example: Erlang) Imperative programming is a very old paradigm (as far as I know) and possibly not suitable for the 21st century Why are companies using or programs written in functional languages still so "rare"? Why, when looking at the advantages of functional programming, are we still using imperative programming languages? Maybe it was too early for it in 1990, but today?

    Read the article

  • Object-Oriented equivalent of LISP's progn function?

    - by Archer
    I'm currently writing a LISP parser that iterates through some AutoLISP code and does its best to make it a little easier to read (changing prefix notation to infix notation, changing setq assignments to "=" assignments, etc.) for those that aren't used to LISP code/only learned object oriented programming. While writing commands that LISP uses to add to a "library" of LISP commands, I came across the LISP command "progn". The only problem is that it looks like progn is simply executing code in a specific order and sometimes (not usually) assigning the last value to a variable. Am I incorrect in assuming that for translating progn to object-oriented understanding that I can simply forgo the progn function and print the statements that it contains? If not, what would be a good equivalent for progn in an object-oriented language?

    Read the article

  • Finding a new programming language for web development?

    - by Xeoncross
    I'm wondering if there are any un-biased resources that give good, specific overviews of programming languages and their intended goals. I would like to learn a new language, but visiting the sites of each language isn't working. Each one talks about how great it is without much mention of it's weaknesses or specific goals. Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. Python is a programming language that lets you work more quickly and integrate your systems more effectively. Having been a PHP developer for years, Vic Cherubini sums up my plight well: I knew PHP well, had my own framework, and could work quickly to get something up and running. I programmed like this throughout the MVC revolution. I got better and better jobs (read: better paying, better title) as a PHP developer, but all along the way realizing that the code I wrote on my own time was great, and the code I worked with at work was horrible. Like, worse than horrible. Atrocious. OS Commerce level bad. Having side projects kept me sane, because the code I worked with at work made me miserable. This is why I'm retiring from PHP for my side projects and new programming ventures. I'm spent with PHP. Exhausted, if you will. I've reached a level where I think I'm at the top with it as a language and if I don't move on to a new language soon, I'll be done completely with programming and I do not want that. Languages I've looked at include JavaScript (for node.js), Ruby, Python, & Erlang. I've even thought about Scala or C++. The problem is figuring out which ones are built to handle my needs the best. So where can I go to skip the hype and get real information about the maturity of a platform, the size of the community, and the strengths & weaknesses of that language. If I know these then picking a language to continue my web development should be easy.

    Read the article

  • When to use functional programming approach and when not? (in Java)

    - by john smith optional
    let's assume I have a task to create a Set of class names. To remove duplication of .getName() method calls for each class, I used org.apache.commons.collections.CollectionUtils and org.apache.commons.collections.Transformer as follows: Snippet 1: Set<String> myNames = new HashSet<String>(); CollectionUtils.collect( Arrays.<Class<?>>asList(My1.class, My2.class, My3.class, My4.class, My5.class), new Transformer() { public Object transform(Object o) { return ((Class<?>) o).getName(); } }, myNames); An alternative would be this code: Snippet 2: Collections.addAll(myNames, My1.class.getName(), My2.class.getName(), My3.class.getName(), My4.class.getName(), My5.class.getName()); So, when using functional programming approach is overhead and when it's not and why? Isn't my usage of functional programming approach in snippet 1 is an overhead and why?

    Read the article

  • What are the challenges and benefits of writing games with a functional language?

    - by McMuttons
    While I know that functional languages aren't the most commonly used for game writing, there are a lot of benefits associate with them that seem like they would be interesting in any programming context. Especially the ease of parallelization I would think could be very useful as focus is moving toward more and more processors. Also, with F# as a new member of the .NET family, it can be used directly with XNA, for example, which lowers the threshold quite a bit, as opposed to going with LISP, Haskell, Erlang, etc. If anyone has experience writing games with functional code, what has turned out to be the positives and negatives? What was it suited for, what not? Edit: Finding it hard to decide that there's a single good answer for this, so it's probably better suited as a community wiki post.

    Read the article

  • Practical Scheme Programming

    - by Ixmatus
    It's been a few months since I've touched Scheme and decided to implement a command line income partitioner using Scheme. My initial implementation used plain recursion over the continuation, but I figured a continuation would be more appropriate to this type of program. I would appreciate it if anyone (more skilled with Scheme than I) could take a look at this and suggest improvements. I'm that the multiple (display... lines is an ideal opportunity to use a macro as well (I just haven't gotten to macros yet). (define (ab-income) (call/cc (lambda (cc) (let ((out (display "Income: ")) (income (string->number (read-line)))) (cond ((<= income 600) (display (format "Please enter an amount greater than $600.00~n~n")) (cc (ab-income))) (else (let ((bills (* (/ 30 100) income)) (taxes (* (/ 20 100) income)) (savings (* (/ 10 100) income)) (checking (* (/ 40 100) income))) (display (format "~nDeduct for bills:---------------------- $~a~n" (real->decimal-string bills 2))) (display (format "Deduct for taxes:---------------------- $~a~n" (real->decimal-string taxes 2))) (display (format "Deduct for savings:-------------------- $~a~n" (real->decimal-string savings 2))) (display (format "Remainder for checking:---------------- $~a~n" (real->decimal-string checking 2)))))))))) Invoking (ab-income) asks for input and if anything below 600 is provided it (from my understanding) returns (ab-income) at the current-continuation. My first implementation (as I said earlier) used plain-jane recursion. It wasn't bad at all either but I figured every return call to (ab-income) if the value was below 600 kept expanding the function. (please correct me if that apprehension is incorrect!)

    Read the article

  • is this possible in java or any other programming language

    - by drake
    public abstract class Master { public void printForAllMethodsInSubClass() { System.out.println ("Printing before subclass method executes"); } } public class Owner extends Master { public void printSomething () { System.out.println ("This printed from Owner"); } public int returnSomeCals () { return 5+5; } } Without messing with methods of subclass...is it possible to execute printForAllMethodsInSubClass() before the method of a subclass gets executed?

    Read the article

  • Evolution of mainstream programming languages: simplicity versus complexity.

    - by Giorgio
    I had posted this question on http://stackoverflow.com but I was suggested that it may be more appropriate to post it on this forum. I did a quick search on this site and it seems to me that this question has not been asked yet. Please give me a hint if the topic has been raised already by someone else. Update I have rephrased this question, removed personal opinions and made it shorter. I hope in this way it is better suited for this forum. By looking at the recent development of Java (Java 7) and C++ (C++0x) I see that new features are added to these languages. For sure this makes it easier to use certain programming idioms, adding to the productivity of developers. On the other hand, there might be the following risks A language becomes too big, complex, and difficult to understand. It lacks coherence in the design, e.g. if it mixes different paradigms like object-orientation and functional programming, which might not fit well together. Questions: what is more important to you as a developer: to have a rich language that captures a large collection of programming idioms or to have a small language that aims at coherence and simplicity (of course, with a good deal of libraries and tools accompanying it)? Or is it possible to have both? With respect to these issues: How do you judge the current evolutions of main-stream programming languages like Java or C++? Are they becoming too complex, less intuitive? Do they have enough features? Do they need more? Are they still easy enough to understand and use?

    Read the article

  • Is there a “P” programming language? [closed]

    - by Synetech
    I’m wondering if anybody has made a programming language based on BCPL, named P. There was a language named B that was based on BCPL, followed of course by C, also based on BCPL. I’ve seen plenty of whimsically named programming languages, so I can’t help but be surprised if nobody made one called P. I checked the Wikipedia’s—not exactly comprehensive—list of programming languages, and while there are three languages named L (none of which are related to BCPL), there are none called P—in fact, it is one of the only letters not used as a name. (Google is useless for one-letter query terms.) Does anybody know if a P has been made, even as a lark. (Yes, I know about P#, but that is based on Prolog, not BCPL; there is one called P, but it is also not related to BCPL.)

    Read the article

  • Are there any non-english programming languages? [closed]

    - by samarudge
    Possible Duplicate: Non-English-based programming languages Not sure if this is the right place to ask this, but I'm going to anyway. Without fail, every programming language I've ever seen, used or heard of has it's keywords based around English. if, else, while, for, query, foreach, image, path, extension, the list goes on, are all based around English words. Are there any languages, or ports of languages that base their core keywords based on non-english words to lower the wall for non-english speaking programmers? This is mostly for intrest (English is my first language so it's no problem for me). Are these languages popular locally (I.E. might a software development house in Germany use a programming language based in German over one based in English).

    Read the article

  • Teaching programming to a non-CS graduate

    - by Shahzada
    I have a couple of friends interested in computer programming, but they're non-CS graduates; some of them have very little experience in software testing field (some of them took some basic software testing courses). I am going to be working with them on teaching basic computer programming, and computer science fundamentals (data structures etc). My questions are; What language should I start with? What are essential computer science topics that I should cover before jumping them into computer programming? What readings can I incorporate to make the topic interesting and non-overwhelming? If we want to spend a year on it, what topics should take priority and must be covered in 12 months? Again, these are non computer science folks, and I want to keep the learning as much fun as possible. Thanks everyone.

    Read the article

  • When Programming will become deprecated [closed]

    - by Vibeeshan
    Possible Duplicate: Will programmers be around in a few years? According to the history of programming, with each new generation of software engineering it seems to become easier and easier. Machine Code - Assembly - Programming Languages - easier - more easier - etc. If this situation continues anyone will be able to program (even complex systems). Even now, most of the kids study programming at school (Pascal , VB, etc.). Will be there any jobs called software engineering in future (if everyone know to program). ....and.... What do you think about the future of software development?

    Read the article

  • Which programming language for text editing?

    - by Ali
    I need a programming language for text editing and processing (replace, formatting, regex, string comparison, word processing, text analysis, etc). Which programming language is more powerful and has more functions for this purpose? Since I work PHP for my web projects, I currently use PHP; but the fact is that PHP is a scripting language for web applications, my current project is offline. I am curious if other programming languages such as Perl, Python, C, C++, Java, etc have more functionality for this purpose, and worth of shifting the project?

    Read the article

  • How important is Programming for a Level Designer?

    - by WryGrin
    I'm currently attending school in a Level Design program, and I was wondering how important programming really is in being a Level Designer? I'm apparently incapable of learning programming (despite my best efforts), and tend to do very well in all other courses 3D modelling, story/character design, narrative and dialogue writing, environmental and conceptual design etc. I'm wondering if my strengths in the other areas are enough (with practice) to let me become a Level Designer, or I'm wasting my time if I can't program? I really want to be a Designer, but I just can't seem to wrap my head around the "language" of programming in general (Java kicks my teeth in even with tutoring and additional work on my own).

    Read the article

  • Pair Programming: Pros and Cons

    - by O.D
    I need some experience reporting from the ones who have done pair programming, I noticed that lots of people recommend it but my experience was that at one point it's more efficient to sit alone, think and then write code than to talk with the other programmer (which can be very annoying to other programmers in the same office), do you agree to this? and if yes can you mention situations where pair programming is less efficient than traditional programming? Actually, I'm more interested in Cons than in Pros, but if it's your own experience I would like to read both, the Cons and the Pros. I would like to read what you think about the Programmer who doesn't have the keyboard, what can he do in the meanwhile other than talking about the concept? or checking the code on the screen?

    Read the article

  • Am I bored with programming? [closed]

    - by user1167074
    I have started programming 2 years back and I have learnt web programming while working for big corporate companies. I was very passionate and I even did couple of side projects which were well appreciated by my friends and colleagues. But for the past 2 months I am not doing anything really interesting with programming, even if I get good ideas I am not feeling like coding, sub consciously I am feeling like "So What?" if I do this project. I would like to know from the more experienced programmers if this is just a phase or am I really missing something? Thanks

    Read the article

  • Reasons for Pair Programming

    - by Jeff Langemeier
    I've worked in a few shops where management has passed the idea of pair programming either to me or another manager/developer, and I can't get behind it at all. From a developer stand-point I can't find a reason why moving to this coding style would be beneficial, nor as a manager of a small team have I seen any benefit. I understand that it helps on basic syntax errors and can be helpful if you need to hash something out, but managers that are out of the programming loop seem to keep seeing it as a way of keeping their designers from going to Facebook or Reddit than as a design tool. As someone close to the development floor that apparently can't quite understand from a book tossed my way or a wiki page on the subject... from a high level management position, what are the benefits of Pair Programming when dealing with Scrum or Agile environments?

    Read the article

  • Topics for covering in-depth programming knowledge

    - by black_belt
    I pursued my bachelors' degree in business administration, but my interest in Information Technology led me to acquire some knowledge of PHP programming and MySQL database. I find programming so interesting that I haven't applied for any job since my graduation. Currently I am staying home and just trying to acquire in-depth knowledge of PHP programming. So far I have developed couple of websites and web applications including Inventory+ Point of Sale Software and an Accounting system for small organizations. I aim to have knowledge that a Computer Science graduate should have, and for that I want to read books but I have no idea where to start from. Could you please suggest me some books and topics that I should study on? Thanks a lot :)

    Read the article

  • How are objects modelled in a functional programming language?

    - by Giorgio
    In an answer to this question (written by Pete) there are some considerations about OOP versus FP. In particular, it is suggested that FP languages are not very suitable for modelling (persistent) objects that have an identity and a mutable state. I was wondering if this is true or, in other words, how one would model objects in a functional programming language. From my basic knowledge of Haskell I thought that one could use monads in some way, but I really do not know enough on this topic to come up with a clear answer. So, how are entities with an identity and a mutable persistent state normally modelled in a functional language? EDIT Here are some further details to clarify what I have in mind. Take a typical Java application in which I can (1) read a record from a database table into a Java object, (2) modify the object in different ways, (3) save the modified object to the database. How would this be implemented e.g. in Haskell? I would initially read the record into a record value (defined by a data definition), perform different transformations by applying functions to this initial value (each intermediate value is a new, modified copy of the original record) and then write the final record value to the database. Is this all there is to it? How can I ensure that at each moment in time only one copy of the record is valid / accessible? One does not want to have different immutable values representing different snapshots of the same object to be accessible at the same time.

    Read the article

  • Are functional programming languages good for practical tasks?

    - by Clueless
    It seems to me from my experimenting with Haskell, Erlang and Scheme that functional programming languages are a fantastic way to answer scientific questions. For example, taking a small set of data and performing some extensive analysis on it to return a significant answer. It's great for working through some tough Project Euler questions or trying out the Google Code Jam in an original way. At the same time it seems that by their very nature, they are more suited to finding analytical solutions than actually performing practical tasks. I noticed this most strongly in Haskell, where everything is evaluated lazily and your whole program boils down to one giant analytical solution for some given data that you either hard-code into the program or tack on messily through Haskell's limited IO capabilities. Basically, the tasks I would call 'practical' such as Aceept a request, find and process requested data, and return it formatted as needed seem to translate much more directly into procedural languages. The most luck I have had finding a functional language that works like this is Factor, which I would liken to a reverse-polish-notation version of Python. So I am just curious whether I have missed something in these languages or I am just way off the ball in how I ask this question. Does anyone have examples of functional languages that are great at performing practical tasks or practical tasks that are best performed by functional languages?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >