Search Results

Search found 764 results on 31 pages for 'fro oo'.

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

  • Significant amount of the time, I can't think of a reason to have an object instead of a static class. Do objects have more benefits than I think?

    - by Prog
    I understand the concept of an object, and as a Java programmer I feel the OO paradigm comes rather naturally to me in practice. However recently I found myself thinking: Wait a second, what are actually the practical benefits of using an object over using a static class (with proper encapsulation and OO practices)? I could think of two benefits of using an object (both significant and powerful): Polymorphism: allows you to swap functionality dynamically and flexibly during runtime. Also allows to add new functionality 'parts' and alternatives to the system easily. For example if there's a Car class designed to work with Engine objects, and you want to add a new Engine to the system that the Car can use, you can create a new Engine subclass and simply pass an object of this class into the Car object, without having to change anything about Car. And you can decide to do so during runtime. Being able to 'pass functionality around': you can pass an object around the system dynamically. But are there any more advantages to objects over static classes? Often when I add new 'parts' to a system, I do so by creating a new class and instantiating objects from it. But recently when I stopped and thought about it, I realized that a static class would do just the same as an object, in a lot of the places where I normally use an object. For example, I'm working on adding a save/load-file mechanism to my app. With an object, the calling line of code will look like this: Thing thing = fileLoader.load(file); With a static class, it would look like this: Thing thing = FileLoader.load(file); What's the difference? Fairly often I just can't think of a reason to instantiate an object when a plain-old static-class would act just the same. But in OO systems, static classes are fairly rare. So I must be missing something. Are there any more advantages to objects other from the two that I listed? Please explain.

    Read the article

  • AntFarm anti-pattern -- strategies to avoid, antidotes to help heal from

    - by alchemical
    I'm working on a 10 page web site with a database back-end. There are 500+ objects in use, trying to implement the MVP pattern in ASP.Net. I'm tracing the code-execution from a single-page, my finger has been on F-11 in Visual Studio for about 40 minutes, there seems to be no end, possibly 1000+ method calls for one web page! If it was just 50 objects that would be one thing, however, code execution snakes through all these objects just like millions of ants frantically woring in their giant dirt mound house, riddled with object tunnels. Hence, a new anti-pattern is born : AntFarm. AntFarm is also known as "OO-Madnes", "OO-Fever", OO-ADD, or simply design-pattern junkie. This is not the first time I've seen this, nor my associates at other companies. It seems that this style is being actively propogated, or in any case is a misunderstanding of the numerous OO/DP gospels going around... I'd like to introduce an anti-pattern to the anti-pattern: GST or "Get Stuff Done" AKA "Get Sh** done" AKA GRD (GetRDone). This pattern focused on just what it says, getting stuff done, in a simple way. I may try to outline it more in a later post, or please share your ideas on this antidote pattern. Anyway, I'm in the midst of a great example of AntFarm anti-pattern as I write (as a bonus, there is no documentation or comments). Please share you thoughts on how this anti-pattern has become so prevelant, how we can avoid it, and how can one undo or deal with this pattern in a live system one must work with!

    Read the article

  • What is the most obfuscated and clever code you've seen? [closed]

    - by ThibThib
    I am aware about the The International Obfuscated C Code Contest, but I am looking for obfuscated AND clever codes (specially short ones) Here is two examples (the first one is a classical one, I think) #define _ F-->00 || F-OO--; long F=00,OO=00; main(){F_OO();printf("%1.3f\n", 4.*-F/OO/OO);}F_OO() { _-_-_-_ _-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_ _-_-_-_ } and #include <unistd.h> float o=0.075,h=1.5,T,r,O,l,I;int _,L=80,s=3200;main(){for(;s%L|| (h-=o,T= -2),s;4 -(r=O*O)<(l=I*I)|++ _==L&&write(1,(--s%L?_<L?--_ %6:6:7)+"World! \n",1)&&(O=I=l=_=r=0,T+=o /2))O=I*2*O+h,I=l+T-r;} I let you compile and run them so as to understand what they are producing. Of course, I am not looking for only obfuscated code, because I guess that every code could be transformed in a way that it is not readable at all I am more looking for small codes that you can eventually understand, with some clever tricks. I will show them to my students as example of clever things that they should not do (it's always better to show clever examples rather than stupid ones...) Thanks

    Read the article

  • Weighted random selection using Walker's Alias Method (c# implementation)

    - by Chuck Norris
    I was looking for this algorithm (algorithm which will randomly select from a list of elements where each element has different probability of being picked (weight) ) and found only python and c implementations, after I did a C# one, a bit different (but I think simpler) I thought I should share it, and ask your opinion ? this is it: using System; using System.Collections.Generic; using System.Linq; namespace ChuckNorris { class Program { static void Main(string[] args) { var oo = new Dictionary<string, int> { {"A",7}, {"B",1}, {"C",9}, {"D",8}, {"E",11}, }; var rnd = new Random(); var pick = rnd.Next(oo.Values.Sum()); var sum = 0; var res = ""; foreach (var o in oo) { sum += o.Value; if(sum >= pick) { res = o.Key; break; } } Console.WriteLine("result is "+ res); } } } if anyone can remake it in f# please post your code

    Read the article

  • how to integrate Zend Framework MVC with existing site

    - by Joel
    Hi guys, So I'm slowly tackling OO and Zend Framework and their MVC process in particular. I have an existing website and web-based calendar application that was designed by me, but coded by a different person and done procedurally. I understand that it will be very difficult for my application to ever be completely OO without a full re-write, and I'm fine with that. I have a lot of updates and modifications I want to do in the future, so I'm wanting to start replacing some of the basic components (login, authentication. etc) now, and continue to learn as I go. Again, I'm really a newbie at programming and OO. What I'm wondering is if I'm wanting to incorporate the Framework, then would I just first drop my whole site into the /public folder of the Framework and then start pulling functionality out from there?

    Read the article

  • So what *did* Alan Kay really mean by the term "object-oriented"?

    - by Charlie Flowers
    Reportedly, Alan Kay is the inventor of the term "object oriented". And he is often quoted as having said that what we call OO today is not what he meant. For example, I just found this on Google: "I made up the term 'object-oriented', and I can tell you I didn't have C++ in mind" - Alan Kay, OOPSLA '97 I vaguely remember hearing something pretty insightful about what he did mean. Something along the lines of "message passing". Do you know what he meant? Can you fill in more details of what he meant and how it differs from today's common OO? Please share some references if you have any. Thanks.

    Read the article

  • How to program for constraints/rules

    - by Gaurav
    First the background, during interviews in the past, many times I have been asked to design some or other variation of card game as programming puzzle, and I have tried to design it in OO way, but I have never been satisfied with my solutions. However it was not until recently that I realized that I had been approaching the problem from the wrong direction. Specifically I was trying to solve the problem by modeling individual card as an object. Problem with this is individual cards don't have any non-trivial intrinsic behavior and therefore are not suitable (or primary) candidate as objects. What is interesting and important about cards are rules and constraints, such as there could be only four suits, or only thirteen cards in each suit. Of course, then there are any number of rules for games. So my questions are Are there any idioms/constructs/patterns to program for rules & constraints. How many in 1 can be applied in conjunction with OO paradigm.

    Read the article

  • So what *did* Alan Kay really mean by the term "object-oriented"?

    - by Charlie Flowers
    Reportedly, Alan Kay is the inventor of the term "object oriented". And he is often quoted as having said that what we call OO today is not what he meant. For example, I just found this on Google: I made up the term 'object-oriented', and I can tell you I didn't have C++ in mind -- Alan Kay, OOPSLA '97 I vaguely remember hearing something pretty insightful about what he did mean. Something along the lines of "message passing". Do you know what he meant? Can you fill in more details of what he meant and how it differs from today's common OO? Please share some references if you have any. Thanks.

    Read the article

  • Is there any reason to use "plain old data" classes?

    - by Michael
    In legacy code I occasionally see classes that are nothing but wrappers for data. something like: class Bottle { int height; int diameter; Cap capType; getters/setters, maybe a constructor } My understanding of OO is that classes are structures for data and the methods of operating on that data. This seems to preclude objects of this type. To me they are nothing more than structs and kind of defeat the purpose of OO. I don't think it's necessarily evil, though it may be a code smell. Is there a case where such objects would be necessary? If this is used often, does it make the design suspect?

    Read the article

  • Is there any reason to use "container" classes?

    - by Michael
    I realize the term "container" is misleading in this context - if anyone can think of a better term please edit it in. In legacy code I occasionally see classes that are nothing but wrappers for data. something like: class Bottle { int height; int diameter; Cap capType; getters/setters, maybe a constructor } My understanding of OO is that classes are structures for data and the methods of operating on that data. This seems to preclude objects of this type. To me they are nothing more than structs and kind of defeat the purpose of OO. I don't think it's necessarily evil, though it may be a code smell. Is there a case where such objects would be necessary? If this is used often, does it make the design suspect?

    Read the article

  • Object Oriented programming on 8-bit MCU Case Study

    - by Calvin Grier
    I see that there's a lot of questions related to OO Programming here. I'm actually trying to find a specific resource related to embedded OO approaches for an 8 bit MCU. Several years back (maybe 6) I was looking for material related to Object Oriented programming for resource constrained 8051 microprocessors. I found an article/website with a case history of a design group that used a very small RAM part, and implemented many Object based constructs during their C design and development. I believe it was an 8051. The project was a success, and managed to stay inside the very small ROM/RAM they had available. I'm attempting to find it again, but Google can't locate it. The article was well written, and recommended a "mixed" approach using C methods for inheritance and encapsulation - if I recall correctly. Can anyone help me locate this article?

    Read the article

  • Good Literature for "Object oriented programming in C"

    - by Dipan Mehta
    This is not a debate question about whether or not C is a good candidate for Object oriented programming or not. Quite often C is the primary platform where the development is happening. I have seen, and hopefully learnt through crawling many open source and commercial projects - that while the language inherently doesn't stop you if you create "non-object" code. However, you can still think in the "Object" way and reasonably write code that captures this designs thinking. For those who has done this, OO way is still the best way to write code even when you are programming in C. While, I have learnt most of it through the hard way, are there any deep literature that can help educate the relatively young guys about how to do OO programming in C?

    Read the article

  • Headset undetected when plugged in

    - by tough
    I have recently installed Ubuntu 12.04 in my machine which was running windows 7. I have been trying to configure the audio to work exactly as it used to work in Windows but never been able to do so. I have followed this link exactly. I am still not getting the required configuration. aslamixer command shows me with 5 adjustable controls as shown below Master "adjustable" Speaker "adjustable" PCM "adjustable" Front "adjustable" AND Beep "adjustable" Mic Jack Mic In or Lin In S/PDIF OO "in a box" S/PDIF D OO "in a box" S/PDIF P DIGITAL or Analog M It does not detect the headset jack when plugged in. I here mean to say that the sound form the speakers does not go off when I plug in my headset jack. How can I make this working. Some other googling also did not help. I am on Hp Pavilion DV7 machine. The chip is IDT 92HD75B3X5 and the card is HDA ATI SB.

    Read the article

  • Objected oriented approach to structure inside structure

    - by RishiD
    This is for C++ but should apply to any OO language. Trying to figure out the correct object oriented apporach to do the following (this is what I do in C). struct Container { enum type; union { TypeA a; TypeB b; }; } The type field determines if it TypeA or TypeB object. I am using this to handle responses coming back from a connection, they get parsed and get put into this structure and then based on the message type the appropriate fields get filled in. e.g. struct Container parseResponse(bufferIn, bufferLength); Is there an OO approach for doing this?

    Read the article

  • In this context with views in a tree, which class should perform the task?

    - by Jhonny 8
    Imagine that I have this context: A main view containing a table containing some cells. Each one of them with their own controller and view files. In the main view, I have an object "Person", with 3 different IDs. Depending on certain conditions (let say, time of the day), I have to choose one of them and display it in the cell. My question is, should the main view pass the whole object to the table, and this one to the cell, and the cell will calculate the ID that it will be shown? or, The main view calculates this parameter, and send the result to the table and this to the cell? Is a question focused on OO design, which one of this approaches is more suitable in an OO design and why?

    Read the article

  • Java vs COBOL programming examples

    - by Jodi
    I am a COBOL programmer, desperately trying to learn and program Java. Although I understand the OO priciples and concepts, I am at a lost putting all together. I am trying to find some examples on how code will look in COBOL vs Java - something a bit more complicated than "hello world" [I am past that initial headache! :-)], that includes OO principles - basically, a decent 1000+ liner in COBOL, with the Java code to work through. After working through book after book, doing the examples, and even writing small java programs at work, I think working through an example I can compare will be the best way to getting my thinking cap converted, and being able to do in Java what I can do after 10 years with COBOL. Can anybody help?

    Read the article

  • How to crop a face in Photoshop

    - by oo
    I want to be able to crop a face out of a picture in Photoshop. The lasso tool seems to be difficult to use. I remember there was another tool that allowed you to put different lines together one by one and then complete a circle but I don't remember the tool. How can I do it?

    Read the article

  • What is your best solution for task management?

    - by oo
    I have Outlook at work, Gmail at home and a BlackBerry (only syncs with work Outlook). I see that there are a number of online websites that support webbased task lists such as "remember the milk", etc. My biggest issue with Outlook is that I flag a number of emails as tasks and they show up as tasks in Outlook but NOT on my BlackBerry. I still haven't found a workaround to this. I see there is some BlackBerry sync tools but I am not sure if this will work with my corporate network. Any suggestions for getting this to work or another optimal task management solution that works at home, work and on the road?

    Read the article

  • is there an alternative to outlook rules

    - by oo
    i have asked a number of questions around outlook rules and no matter how small i make the names and how efficient i make the rules, i ultimately still hit the 32 limit at about 40 rules. Is there any alternative to do this job since outlook rules just doesn't seem scalable to to keep up with the way people are emailing over the past 10 yearsoutlo.

    Read the article

  • Using iTunes U on an iPod classic

    - by oo
    I just went out and bought an iPod classic 160gb and I downloaded a bunch of iTunes U files on iTunes and I can't seems to find where they sync on the iPod. Any ideas here as I dont see any iTunes U menus on my iPod and I dont see them in the podcast list as well?

    Read the article

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