Why is all the math not in one class in codenameone? This makes it so you need to go and check to see which Method is in which class. Not a big deal but does not seem to be logical. I am sure you have a great reason I just was interested to see what it is.
The Math class in CN1 follows the CLDC11 API, whose Math class doesn't include all of the methods of JavaSE. This made CN1 more easily portable to those devices. Adding these methods in a separate class was just easier to port.
Now that J2ME is in the past, I don't see any reason why we can't move the Math class inline with the JavaSE Math class. I have opened an RFE for this here
Related
I am full-stack developer and currently study in software engineering in the university 2 course. Currently I am working on a Bookstore project using spring boot for back and React for frontend. So I need to implement 5 software design patterns in my project. However I don't now how to do such implementations and not yet experienced. So I need your help. How I can implement this?
First of all I am not here to demotivate you or anything else, what I will suggest you to start making a class diagram and from that class diagram you will notice somethings that will look weird to you, so the things that will look weird to you will be things that will required the implementation of the Design Patterns.
There are basically three types of Design Patterns Creational, Observer and Behavioral. So, as soon as you will create the Class Diagram, you will notice some base cases such as one class should use the single database object or same logic on a single time that is the place where you will be using the Singleton Design Pattern.
Let's say you have created a Class Diagram such that one parent class should not be able to create the objects of other class but the subclasses should do that kind of work, so this is the classic example of Factory Method design pattern and so and so on.
I wish you best of luck for your project as well.
How are user interfaces developed from the ground up in low level languages like C or C++? We usually make GUIs using libraries or APIs. But I'm interested in understanding the fundamentals of how these libraries are implemented and how they create a Window from just coding only.
There is a surprising amount of stuff to make a simple GUI control like a button work.
Quite a few years ago I was on a project developing a Pacemaker Programmer (custom computer) where we needed to write a GUI application but the OS we were using only had text-based output support. We purchased a product called the Zinc Application Framework that could do that for and since it was designed to work on anything, we had access to the source code (and I peeked).
There are simple thinks like you would not even think about. Like, what if the button is partially covered by another window. Then you have do the divide the button into both an visible and hidden region so you can display the correct part. Remember, a screen is only one set of pixels. Now, I am sure a graphics card or a library/protocal like direct-X might do that for you; but, it has to get done and you wanted to know the details.
Zinc was a very Object Oriented design so the part I described is part of the window drawing component that the button did not need to know about. Also, it used a lot of inheritance (written in C++) to build class upon class; so, the total functionality of a button was spread all over the place. Ex: A button and a check box are very similar except in the way they are displayed; so, the classes the realize them share the same base classes.
If you are really interested and are willing to spend the hours to understand it, there should be open-source Windowing/GUI code you could look at. X-Windows comes to mind. I wish I could show you the Zinc code because I am sure it was much simpler.
One of interesting readings on this topic i read was document of wayland http://wayland.freedesktop.org/docs/html/ch01.html. It explains on X Window System and wayland architecture. To begin with, may be interested.
Apologies for the not entirely code related question.
I am in the process of building a WPF application with a View Model Locator pattern. In that I have interfaces to represent functionality not present in portable class libraries.
I then assign those properties concrete values in my application so that they are available for injection to my view models.
My question is, do we have a name for this pattern? It seems a standard enough way to do this but I am never sure what to call it and end up having to explain it every time.
A term Microsoft uses to describe the way one can inject in a PCL concrete implementations of code that cannot be written to directly target a PCL is platform abstraction.
There are several techniques to achieve this. Here are some useful links:
http://blogs.msdn.com/b/dsplaisted/archive/2012/08/27/how-to-make-portable-class-libraries-work-for-you.aspx
http://blog.stephencleary.com/2012/11/portable-class-library-enlightenment.html
http://log.paulbetts.org/the-bait-and-switch-pcl-trick/
I need to add a image upload function to extjs htmlEditor, and I searched the web and found that 2 different solutions are out there. One is to use plugins arrays, in which are the plugin classes extending the util.Observable class(and to make things even confused, they all contain something called MidasCommand, what is this anyway it's not in the documentation), the other is writing a extending class for form.htmlEditor.
Can someone please explain which should I choose and why, and also what about Ext.override and Ext.extend? Are they the same thing?
AFAIK the difference between extending and plugins is:
Plugins are reusable. If you need the extension code only once, then a plugin would be over-engineerd somehow. With plugins you can have a single source for extending many classes.
Ext.override don't create new classes, but modify an existing class. Ext.extend creates a new class.
Regarding your editor, I'm afraid I cannot help you. I've found Midas Spec. Seems that this hasn't been developed further, but maybe I'm wrong.
I've got a set of libraries that target Silverlight & Windows Phone 7.5, In my libraries I have a navigation solution that has a common interface but different implementations - depending on the platform. (SL & WP7 Navigation are very similar, there are very minor differences, unfortunately they can't be avoided)
If I were to write a portable class library that would contain my INavigationModel interface + both implementations, is there any way to tell which platform is calling the portable class library? This information would help me choose the correct implementation of my solution at runtime.
Cheers
edit
Any alternative solution is welcome too, I'm still trying to piece any information about the portable class libraries to see what they're capable of
Realistically, that may not work so well. Even if you could reliably determine the environment you're running under (some kind of hack with Environment.OperatingSystem perhaps), if your implementation is of any complexity, it's unlikely you could stick completely to the lowest-common-denominator of defined types/methods, etc.
The whole point of portable assemblies is to define truly shared bits (utility methods, interfaces, etc)- probably a better solution might be to define base classes/interfaces with shared functionality in the portable assembly, then extend in your platform-specific assemblies to implement the non-portable bits.
There's not a good way to do what you want to do. Portable libraries do not remove the need to have platform-specific projects, it just helps facilitate platform-specific projects to talk in a platform-agnostic way.
I would tend to recommend that the concrete implementation of the INavigationService live in the platform specific projects themselves, whereas the common abstraction live in the portable project. Then use an IoC container or ServiceLocator-like framework to hook them up (I'd recommend Autofac). I've done similar in an article (in fact, I did this for a navigation service) I wrote for MSDN: Create a Continuous Client Using Portable Class Libraries. Be sure to download the source code to see a concrete example.