Search Results

Search found 349 results on 14 pages for 'procedural'.

Page 10/14 | < Previous Page | 6 7 8 9 10 11 12 13 14  | Next Page >

  • How do I implement a dispatch table in a Perl OO module?

    - by Iain
    I want to put some subs that are within an OO package into an array - also within the package - to use as a dispatch table. Something like this package Blah::Blah; use fields 'tests'; sub new { my($class )= @_; my $self = fields::new($class); $self->{'tests'} = [ $self->_sub1 ,$self->_sub2 ]; return $self; } _sub1 { ... }; _sub2 { ... }; I'm not entirely sure on the syntax for this? $self->{'tests'} = [ $self->_sub1 ,$self->_sub2 ]; or $self->{'tests'} = [ \&{$self->_sub1} ,\&{$self->_sub2} ]; or $self->{'tests'} = [ \&{_sub1} ,\&{_sub2} ]; I don't seem to be able to get this to work within an OO package, whereas it's quite straightforward in a procedural fashion, and I haven't found any examples for OO. Any help is much appreciated, Iain

    Read the article

  • Simplex noise vs Perlin noise

    - by raRaRa
    I would like to know why Perlin noise is still so popular today after Simplex came out. Simplex noise was made by Ken Perlin himself and it was suppose to take over his old algorithm which was slow for higher dimensions and with better quality (no visible artifacts). Simplex noise came out in 2001 and over those 10 years I've only seen people talk of Perlin noise when it comes to generating heightmaps for terrains, creating procedural textures, et cetera. Could anyone help me out, is there some downside of Simplex noise? I heard rumors that Perlin noise is faster when it comes to 1D and 2D noise, but I don't know if it's true or not. Thanks!

    Read the article

  • Perl: implementing a dispatch table in an OO module?

    - by Iain
    I want to put some subs that are within an OO package into an array - also within the package - to use as a dispatch table. Something like this package Blah::Blah; use fields 'tests'; sub new { my($class )= @_; my $self = fields::new($class); $self->{'tests'} = [ $self->_sub1 ,$self->_sub2 ]; return $self; } _sub1 { ... }; _sub2 { ... }; I'm not entirely sure on the syntax for this? $self->{'tests'} = [ $self->_sub1 ,$self->_sub2 ]; or $self->{'tests'} = [ \&{$self->_sub1} ,\&{$self->_sub2} ]; or $self->{'tests'} = [ \&{_sub1} ,\&{_sub2} ]; I don't seem to be able to get this to work within an OO package, whereas it's quite straightforward in a procedural fashion, and I haven't found any examples for OO. Any help is much appreciated, Iain

    Read the article

  • Which Programming Language Should I Learn?

    - by Esteban Araya
    I've decided, for educational purposes, I want to learn a new language every 2 years or so. Which language should I learn first? Why? I'm proficient with C, C# and Java. Other than that, I really haven't done much with any other languages. Thanks! Edit: Thanks to all of those that recommended functional languages. Making the mental switch to a functional language seems hard. How did you overcome your instinct to keep doing things in a procedural manner?

    Read the article

  • Learning OOP Design

    - by waiwai933
    I've read Head First Java, and I understand how OOP works. Here's my problem: I'm a PHP programmer, and while I've used OOP in PHP, I'm having trouble figuring out what should be an object and what methods to give it. For example, let's say I have a app that allows people to log in and edit a document. Why should the document be an object if there will ever only be one instance? Should I give the deleteDocument() method to the document object or the admin object? The document is the one being deleted, but the admin is the one performing the action. So my real question is, coming from a procedural background, how do I figure out what should be objects and what should have what methods?

    Read the article

  • Does performance even matter anymore? [closed]

    - by Jeff Dahmer
    The performance differences between C/C++ and C# are astounding. An ASP.NET page loads in 1/8 the time that a PHP script does haha.... WPF, aka " The Future ", (you know it will be, all the companies are gonna want cool looking desktop apps, don't kid yourself.) And it has huge performance hits just to start up. We've let Microsoft make us as developers lazy! Why do I hate this, it's such a good thing? Are we at a point in time where the majority of computers can handle this kinda crap? I remember when performance used to matter. Anyways, I'm writing a .NET library and ever since I found out LINQ is slower than traditional delegates which is slower than the normal procedural code... well it's a guilty evil I feel for every LINQ query I write, because they are so beautiful. Am I just too much of a performance stickler? Or just too big of a nerd?

    Read the article

  • Common programming mistakes for Scala developers to avoid

    - by jelovirt
    In the spirit of Common programming mistakes for Java developers to avoid? Common programming mistakes for JavaScript developers to avoid? Common programming mistakes for .NET developers to avoid? Common programming mistakes for Haskell developers to avoid? Common programming mistakes for Python developers to avoid? Common Programming Mistakes for Ruby Developers to Avoid Common programming mistakes for PHP developers to avoid? what are some common mistakes made by Scala developers, and how can we avoid them? Also, as the biggest group of new Scala developers come from Java, what specific pitfalls they have to be aware of? For example, one often cited problem Java programmers moving to Scala make is use a procedural approach when a functional one would be more suitable in Scala. What other mistakes e.g. in API design newcomers should try to avoid.

    Read the article

  • Windows Azure worker roles: One big job or many small jobs?

    - by Ryan Elkins
    Is there any inherent advantage when using multiple workers to process pieces of procedural code versus processing the entire load? In other words, if my workflow looks like this: Get work from queue0 and do A Store result from A in queue1 Get result from queue 1 and do B Store result from B in queue2 Get result from queue2 and do C Is there an inherent advantage to using 3 workers who each do the entire process themselves versus 3 workers that each do a part of the work (Worker 1 does 1 & 2, worker 2 does 3 & 4, worker 3 does 5). If we only care about working being done (finished with step 5) it would seem that it scales the same way (once you're using at least 3 workers). Maybe the big job is better because workers with that setup have less bottleneck issues?

    Read the article

  • As our favorite imperative languages gain functional constructs, should loops be considered a code s

    - by Michael Buen
    In allusion to Dare Obasanjo's impressions on Map, Reduce, Filter (Functional Programming in C# 3.0: How Map/Reduce/Filter can Rock your World) "With these three building blocks, you could replace the majority of the procedural for loops in your application with a single line of code. C# 3.0 doesn't just stop there." Should we increasingly use them instead of loops? And should be having loops(instead of those three building blocks of data manipulation) be one of the metrics for coding horrors on code reviews? And why? [NOTE] I'm not advocating fully functional programming on those codes that could be simply translated to loops(e.g. tail recursions) Asking for politer term. Considering that the phrase "code smell" is not so diplomatic, I posted another question http://stackoverflow.com/questions/432492/whats-the-politer-word-for-code-smell about the right word for "code smell", er.. utterly bad code. Should that phrase have a place in our programming parlance?

    Read the article

  • Why exactly is eval evil?

    - by Jay
    I know that Lisp and Scheme programmers usually say that eval should be avoided unless strictly necessary. I´ve seen the same recommendation for several programming languages, but I´ve not yet seen a list of clear arguments against the use of eval. Where can I find an account of the potential problems of using eval? For example, I know the problems of GOTO in procedural programming (makes programs unreadable and hard to maintain, makes security problems hard to find, etc), but I´ve never seen the arguments against eval. Interestingly, the same arguments against GOTO should be valid against continuations, but I see that Shemers, for example, won´t say that continuations are "evil" -- you should just be careful when using them. They´re much more likely to frown upon code using eval than upon code using continuations (as far as I can see -- I could be wrong).

    Read the article

  • Suggest books/learning path for writing smartphone apps

    - by chibineku
    I have been writing a lot of HTML, CSS, PHP, MySQL and JavaScript lately working on a website, and I would like to move on to 'proper' OOP with an eye to making smartphone apps. I would like to at least cover iPhone and BlackBerry, which means learning Objective C, Cocoa and Java, before learning the specifics of interacting with the devices themselves, such as native bluetooth/GPS/internet API/methods. I would appreciate pointers to books or resources that will get me from a procedural web developer to object oriented app-maker. Most of the reviews of books on Objective C and Java have been mixed. I am about to start working my way through Beginning Java Objects (APress) which I have borrowed from my brother, so even if it's not a good intro at least it was free!

    Read the article

  • Design Patterns: What's the antithesis of Front Controller?

    - by Brian Lacy
    I'm familiar with the Front Controller pattern, in which all events/requests are processed through a single centralized controller. But what would you call it when you wish to keep the various parts of an application separate at the presentation layer as well? My first thought was "Facade" but it turns out that's something entirely different. In my particular case, I'm converting an application from a sprawling procedural mess to a clean MVC architecture, but it's a long-term process -- we need to keep things separated as much as possible to facilitate a slow integration with the rest of the system. Our application is web-based, built in PHP, so for instance, we have an "index.php" and an IndexController, a "account.php" and an AccountController, a "dashboard.php" and DashboardController, and so on.

    Read the article

  • What are the programming religious wars of the generations before our current generation?

    - by Christopher Altman
    Being 32 years old, I did not follow debates in programming, language design, and platforms in the 1960s, 1970s, 1980s, and most of the 1990s. I sometimes hear glimpse of what the major debates were and how they turned the course of history. It makes me wonder what I take for granted. I am curious, what were the debates. The ones I know are: Procedural vs. Object Orientated Programming Lisp vs. C Software vs. Chips with Embedded Code

    Read the article

  • What exactly is a Monad?

    - by WeNeedAnswers
    Can someone please explain to me what a Monad is. I think I grasp Monoids and I grasp that they basically control the input of state into a system. I just look at the text in Haskell and glaze over. A simple example in python would be great. My current understanding is that a Monoid is a procedural piece of code that needs to be read from top to bottom in sequence with the output being the input for the function. I think that I may even got that wrong, but hey I am here to learn.

    Read the article

  • Storyboard as timer in WPF

    - by Adrian
    Hi, I'm trying to do smooth animation in procedural code. For this (in Silverlight at least), it's recommended to use the Storyboard timer rather than a DispatcherTimer. So I use something like this: Storyboard _LoopTimer = new Storyboard(); public void StartAnimation() { _LoopTimer.Duration = TimeSpan.FromMilliseconds(0); _LoopTimer.Completed += new EventHandler(MainLoop); _LoopTimer.Begin(); } void MainLoop(object sender, EventArgs e) { // Do animation stuff here // Continue storyboard timer _LoopTimer.Begin(); } And in Silverlight, this works fine. But in WPF, I only hit MainLoop() once. Setting RepeatBehaviour to Forever doesn't help, either. So what's the right way to do this in WPF with a Storyboard? Thanks very much.

    Read the article

  • PHP: OOP and methods

    - by Pirkka
    Hello I`ve been wondering how to implement methods in a class. Could someone explain me what means if one does OOP in procedural style? Here is an example: class Fld extends Model { private $file; private $properties = array(); public function init($file) { $this->file = $file; $this->parseFile(); } private function parseFile() { // parses the file foreach($this->file as $line)...... .................. $this->properties = $result; } } I mean is it a good thing to have methods like these that do operations for the class properties like that. Or should I pass the class property as method parameter... I mean this would cause error if the file property wouldnt be declared.

    Read the article

  • Factorial Algorithms in different languages

    - by Brad Gilbert
    I want to see all the different ways you can come up with, for a factorial subroutine, or program. The hope is that anyone can come here and see if they might want to learn a new language. Ideas: Procedural Functional Object Oriented One liners Obfuscated Oddball Bad Code Polyglot Basically I want to see an example, of different ways of writing an algorithm, and what they would look like in different languages. Please limit it to one example per entry. I will allow you to have more than one example per answer, if you are trying to highlight a specific style, language, or just a well thought out idea that lends itself to being in one post. The only real requirement is it must find the factorial of a given argument, in all languages represented. Be Creative! Recommended Guideline: # Language Name: Optional Style type - Optional bullet points Code Goes Here Other informational text goes here I will ocasionally go along and edit any answer that does not have decent formatting.

    Read the article

  • Calculating terrain height in 3d-space

    - by Jonas B
    Hi I'm diving into 3d programming a bit and am currently learning by writing a procedural terrain generator that generates terrain based on a heightmap. I would also want to implement some physics and my first attempt at terrain collision was by simply checking the current position vs the heightmap. This however wont work well against small objects as you'd have to calculate the height by taking the heightdifference of the nearest vertices of the object and doing this every colision check is pretty slow. Beleive me I tried googling for it but there's simply so much crap and millions of blogs posting ripped-of newbie tutorials everywhere with basically no real information on the subject, I can't find anything that explains it or even names any generally used techniques. I'm not asking for code or a complete solution, but if anyone knows a particular technique good for calculating a high-res heightmap out of the already generated and smoothed terrain I would be very happy as I could look into it further when I know what I'm looking for. Thanks

    Read the article

  • Learning to use open source software [closed]

    - by dole
    Do you know any book, blog, tutorial which explains in a detailed way the use of some open source projects? Maybe you have written such a tutorial, example of open source libraries, and your final product is great for a beginner to understand it. I'm in the learning stage of OOP and I really need to learn by examples. I'll like to find some text which explains the use of some open source software/libraries and the good practices. Beign honestly I feel scared to use the open source libraries as I wish/think at this moment. I feel like as I still write procedural code and not OOP. Do you know such tutorials, links, blogs, stories, pages? PS: I know C and PHP. I can't say that I know C++ yet, and that's why I need your help.

    Read the article

  • Flow Based Programming

    - by Software Monkey
    I have been doing a little reading on Flow Based Programming over the last few days. There is a wiki which provides further detail. And wikipedia has a good overview on it too. My first thought was, "Great another proponent of lego-land pretend programming" - a concept harking back to the late 80's. But, as I read more, I must admit I have become intrigued. Have you used FBP for a real project? What is your opinion of FBP? Does FBP have a future? In some senses, it seems like the holy grail of reuse that our industry has pursued since the advent of procedural languages.

    Read the article

  • What are some practical uses of generating all permutations of a list, such as ['a', 'b', 'c'] ?

    - by Jian Lin
    I was asked by somebody in an interview for web front end job, to write a function that generates all permutation of a string, such as "abc" (or consider it ['a', 'b', 'c']). so the expected result from the function, when given ['a', 'b', 'c'], is abc acb bac bca cab cba Actually in my past 20 years of career, I have never needed to do something like that, especially when doing front end work for web programming. What are some practical use of this problem nowadays, in web programming, front end or back end, I wonder? As a side note, I kind of feel that expecting a result in 3 minutes might be "either he gets it or he doesn't", especially I was thinking of doing it by a procedural, non-recursive way at first. After the interview, I spent another 10 minutes and thought of how to do it using recursion, but expecting it to be solved within 3 minutes... may not be a good test of how qualified he is, especially for front end work.

    Read the article

  • How can one describe a rock-paper-scissors relationship between 3 items?

    - by Madara Uchiha
    Let's say I have the following structure: abstract class Hand {} class Rock extends Hand {} class Paper extends Hand {} class Scissors extends Hand {} The goal is to make a function (or a method) Hand::compareHands(Hand $hand1, Hand $hand2), which would return the winning hand in a rock-paper-scissors match. That would be very easy with a bunch of ifs, but the point is to have a more robust structure, that's relying on polymorphism rather than on procedural code. P.S. this is done in actual production code, if someone is asking. This isn't some sort of challenge or homework. (It's not really rock-paper-scissors, but you get the point).

    Read the article

  • PHP Classes: parent/child communication

    - by Fffff
    Hi all, I'm having some trouble extending Classes in PHP. Have been Googling for a while. $a = new A(); $a->one(); $a->b1(); // something like this, or... class A { public $test1; public function one() { echo "this is A-one"; $this->two(); $parent->two(); $parent->B->two(); // ...how do i do something like this (prepare it for using in instance $a)? } } class B extends A { public $test2; public function two($test) { echo "this is B-two"; } } I'm ok at procedural PHP.

    Read the article

  • Brief Explanation of C Supersets?

    - by Ben Hooper
    I'm getting more and more confused in regards to C's supersets the further I venture into the programming world. There's just so many versions.. C, C++, C#, Objective-C, Objective-C++ and God knows what else. I only know tidbits about these languages (some are object-oriented, some are procedural, C was originally developed for UNIX, C++ started as an extension and is used primarily on the Windows OS, Objective-C is primarily used on Linux and Mac OS/iOS, etc), but I'm not even sure that what I know is correct. I would just like someone to shed some light on what I "know" - a little bit more information about which are successive versions, which platforms each are generally used on, which are the best versions to learn, etc if anyone is feeling generous. :) Thanks. :)

    Read the article

  • How can I ensure that JavaScript inserted via AJAX will be executed after the accompanying HTML (als

    - by RenderIn
    I've got portions of pages being replaced with HTML retrieved via AJAX calls. Some of the HTML coming back has JavaScript that needs to be run once in order to initialize the accompanying HTML (setting up event handlers). Since the document has already been loaded, when I replace chunks of HTML using jQuery's .html function, having jQuery(document).ready(function() {...}); doesn't execute since the page loaded long before and this is just a snippet of HTML being replaced. What's the best way to attach event handlers whose code is packaged along with the HTML it's interested in, when that content is loaded via AJAX? Should I just put a procedural block of javascript after the HTML , so that when I insert the new HTML block, jQuery will execute the javascript immediately? Is the HTML definitely in the DOM and ready to be acted upon by JavaScript which is in the same .html call?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14  | Next Page >