Design Patterns

Hi,
I am new to these forums.
I know that there are 4 types of J2EE Design Patterns.
1. Fundamental
2. Structural
3. Creational
4. Behavioral.
Hope that's correct. Can anyone plz tell me what's the difference between them?
Also, examples for them. ie; Under which category mentioned above, patterns like Singleton,ServiceLocator,Session facade, DAO,DTO etc fall?
Thanks in advance.

BigDaddyLoveHandles wrote:
Kumaari wrote:
Please give me some explanation in your words.
Thanks in advance.In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Algorithms are not thought of as design patterns, since they solve computational problems rather than design problems.
Not all software patterns are design patterns. Design patterns deal specifically with problems at the level of software design. Other kinds of patterns, such as architectural patterns, describe problems and solutions that have alternative scopes.
Better?
Brilliant. Bravo sir, bravo

Similar Messages

  • How can I develop a web application using EJB design pattern?

    I have searched over the web and found quite a lot of tutorials on how to use the EJB design pattern.
    I know that there will be a home interface, EJB object interface and a SessionBean.
    But the tutorials often only cover a single class, this made me unable to get a complete picture of how EJB design pattern can be implemented into a whole system.
    I am now required to devleop an online shopping web application using EJB and JSP page.
    I think I will need to create a lot of classes: Member, ShoppingCart, Product...etc.
    What I want to ask is that, do I need to create a home interface, EJB object interface and a SessionBean for each of these classes?
    I really need some ideas on how to develop this system using EJB + JSP pages.
    Many thanks to you all.

    For every EJB that you want to create, you will need to code a home and remote interface and a bean class.
    You could start getting your ideas here
    http://www.theserverside.com/books/wiley/masteringEJB/
    http://www.coreservlets.com

  • SERVICE LOCATOR ?? Is it really an interesting Design pattern??

    Hi everybody,
    i've a problem with the J2EE Design Pattern "Services locator" (it's a singleton).
    It is said that by making use of a Service Locator we can :
    - hide to the client the complexities of initial context creation, EJB home object lookup,and EJB objectre-creation.
    - multiple clients can reuse the Service Locator object to reduce code complexity, provide a single point of control, and improve performance by providing a caching facility.
    But i would like to understand at which side should that service locator object reside??!!??
    If it is at server side then the clients need well an initial context in order to make a lookup on that object.
    Conclusion :
    the service locator doesn't hide the complexities of initial context!!
    Furthermore the client has to perform a look-up on that service locator object!! The only advantage left is caching facility.
    If it is at client side, each client needs his own services locator object
    Conclusion :
    multiple client don't reuse the same service locator. What's the advantage to be a singleton ???
    There is certainly something that i don't understand so help me please!! Thanks.

    Hi Yves,
    But i would like to understand at which side should
    that service locator object reside??!!??
    If it is at client side, each client needs his own
    services locator object
    Conclusion :
    multiple client don't reuse the same service locator.
    What's the advantage to be a singleton ???The service locator resides on the client side and is implemented as
    a singleton. Since it is possible that there could be multiple
    class loaders/JVMs on the client side, and therefore, multiple
    instances of the "singleton" service locator. This is typical
    in a distributed environment (e.g. servlets/JSPs in a web-tier
    cluster using service locator). Thus service locator is not
    a truly "distributed singleton" object. But, the empahsis
    is to design the service locator such that it does not hold
    any state that needs to be replicated across multiple
    instances across different JVMs as mentioned. Thus, there
    is no need for multiple clients to use the "same" service locator,
    but still the benefits of implementing this pattern is realized.
    By making it a singleton, and keeping it from holding state
    that needs to be replicated, we realize the benefits of this pattern.
    You may also want to visit the J2EE Pattern interest list
    and see these relevant discussions :
    Topic: Service Locator and passivation
    http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=j2eepatterns-interest&F=&S=&P=1026
    Topic: Caching EJBHome interfaces
    http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=j2eepatterns-interest&F=&S=&P=9226
    Topic: Using Service Locator for Data Source caching
    http://archives.java.sun.com/cgi-bin/wa?A1=ind0106&L=j2eepatterns-interest#31
    hope this helps,
    thanks,
    -deepak

  • What is the best design pattern for this problem?

    No code to go with the question. I am trying to settle on the best design pattern for the problem before I code. I want to use an Object Oriented approach.
    I have included a basic UML diagram of what I was thinking so far. 
    Stated simply, I have three devices; Module, Wired Modem, and Wireless Modem.
    In the Device Under Test parent class, I have put the attributes that are variable from device to device, but common to all of them.
    In the child classes, I have put the attributes that are not variable to each copy of that device. The attributes are common across device types. I was planning to use controls in the class definition that have the data set to a default value, since it doesn't change for each serial number of that device. For example, a Module will always have a Device Type ID of 1. These values are used to query the database.
    An example query would be [DHR].[GetDeviceActiveVersions] '39288', 1, '4/26/2012 12:18:52 PM'
    The '1' is the device type ID, the 39288 is the serial number, and the return would be "A000" or "S002", for example.
    So, I would be pulling the Serial Number and Device Type ID from the Device Under Test parent and child, and passing them to the Database using a SQL string stored in the control of the Active Versions child class of Database.
    The overall idea is that the same data is used to send multiple queries to the database and receiving back various data that I then evaluate for pass of fail, and for date order.
    What I can't settle on is the approach. Should it be a Strategy pattern, A Chain of Command pattern, a Decorator pattern or something else. 
    Ideas?

    elrathia wrote:
    Hi Ben,
    I haven't much idea of how override works and when you would use it and why. I'm the newest of the new here. 
    Good. At least you will not be smaking with a OPPer dOOPer hammer if I make some gramatical mistake.
    You may want to look at this thread in the BreakPoint where i trie to help Cory get a handle on Dynamic Dispatching with an example of two classes that inherit from a common parent and invoke Over-ride VIs to do the same thing but with wildly varying results.
    The example uses a Class of "Numeric"  and a sibling class "Text" and the both implement an Add method.
    It is dirt simple and Cory did a decent job of explaining it.
    It just be the motivation you are looking for.
    have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Business delegate and Session facade design patterns

    Does any one tell me, what is the difference between business delegate and session facade design patterns.

    1. Session Facade decouples client code from Entity beans introducing session bean as a middle layer while Business Delegate decouples client code from EJB layer ( Session beans).
    2. SF reduces network overhead while BD reduces maintenance overhead.
    3. In SF any change in Session bean would make client code change.
    While in DB client is totally separate from Session bean because BD layer insulate client from Session beans(EJB layer).
    3. In only SF scenario, Client coder has to know about EJB programming but BD pattern no EJB specialization needed.
    4.SF emphasizes on separation of Verb, Noun scenario while BD emphasizes on separation of client(presentable) and EJB layer.
    Anybody pls suggest more differences ?

  • Does any body have any design patterns of JSF Web Application Developping?

    Can any one answer me some questions?
    #1.I am an amatuar of people who develop Web Application.For some reason,We choose the JSF to develop our item.through some introduction,I know the UI component of JSF is resided in Server side,is it right?but I am a little confused that:if there are many users who are exploring our jsf website.(to simplify my question,image I had just one web page and just one button)How many UI components(buttons) will be there?How it(they?) works?
    #2.Does any body have the success experience (for example design pattern)to develop web applications?if We just concern about the Add,Delete,Modify,Query operations of some data.
    I just do my job according to my feeling.
    I will give every page a pagebean(backing bean),and I am not sure how to combine the business data with the pagebean.some one suggested that I should use delegate pattern to separate my business log and page logic.But I am still confused by following things:
    #2.1 does JSF have the same ability to help us construct the model dialog just like swing to
    help us control the operation flow?
    #2.2 If there is not,Does the following way work?I put every tabledata's property as corresponed component.if user choosed the row in the table,My Listener will syncronize the row data to the components.But
    #2.2.1 if JSF has the components according to the web users' number,how can My Listener tell which component should be update?Should I maintain the map?
    #2.2.2 If the problem I imaged above is false,Does any body can tell me how to custom      the ListDataModel,so I can use it like Swing?because now I can just use some view data to insert into ListDataModel,but after some selection operation,my business object must be find according to the selected data,it is not an interesting job!
         I am waiting for your advice!

    Ok I'll try to explain Step by step please correct me if I make any mistake because I have not played much with shared variables.
    To create a shared variable to an RT target go to the target if tou have already otherwise add an RT target by right clicking the Project>>Add targets and Devices
    Then in the target Right clikc and select the variable as shown below.
    Then once the Shared variable settings window opens Enter a variable name and then Select the type "Network Published"
    In the right side you can select the data type for the shared variable and even you can choose your custome controls.
    After selecting the data type go for the Network and select buffering if required else leave it if you are planning to use the variable just for display purpose.
    Then you can enable the RT FIFO if required (Not able to explain how it works and why it is used).
    Then after completing the Shared variable setup you can access the variable in the VI in both the Host and the RT.
    You can bind the variable to a control so that if any data from the RT is coming you can read the data from that control.
    Once you have placed your shared variable in the BD you can change the access typr to read or write depending on your need.
    This might not explain the complete shared variable concept but I believe that this would defenelty give you a kick off to start using the shared variable. Please correct or add more comments if anybody know better.
    Good luck.
    The best solution is the one you find it by yourself

  • Design patterns for updating a fact table

    I have a fact table and about 10 dimensions.
    One of these dimensions can be missing values, so the fact table row will link to an UNKNOWN value.
    When the correct value is finally entered in the dimension table i want to update any associated fact rows.
    Whats the most efficient way of doing this?

    I know i have to use a lookup transformation ;-) 
    I wouldnt be at teh stage of even having a fact table if i didnt know that! I was looking for a design pattern, not the name of a shape!
    The solution i went with was to take a hard line on any rows with unknown values. If when importing the data there are unknown values for two of the most important dimensions, those rows are not inserted into the fact table, but instead pushed to an ErrorLog
    table.
    Users run a report that shows what this table contains and if they really want those rows, they insert the correct dimension values and rerun the import, which will only import any rows not already in the fact table.
    This way:
    1. all sorting & filtering issues are resolved as there will be no unknown rows for the most important dimensions used in sorting and filtering.
    2. we can quickly see any rows with unknown values and figure out whats wrong. its always missing reference data that the client didnt think to give us. a quick insert of the dimension data and import and the rows get imported.
    thanks for the replies.

  • Design Patterns/Best Practices etc...

    fellow WLI gurus,
    I am looking for design patterns/best practices especially in EAI / WLI.
    Books ? Links ?
    With patterns/best practices I mean f.i.
    * When to use asynchronous/synchronous application view calls
    * where to do validation (if your connecting 2 EIS, both EIS, only in WLI,
    * what if an EIS is unavailable? How to handle this in your workflow?
    * performance issues
    Anyone want to share his/her thoughts on this ?
    Kris

              Hi.
              I recently bought WROX Press book Professional J2EE EAI, which discusses Enterprise
              Integration. Maybe not on a Design Pattern-level (if there is one), but it gave
              me a good overview and helped me make some desig decisions. I´m not sure if its
              technical enough for those used to such decisions, but it proved useful to me.
              http://www.wrox.com/ACON11.asp?WROXEMPTOKEN=87620ZUwNF3Eaw3YLdhXRpuVzK&ISBN=186100544X
              HTH
              Oskar
              

  • Process Design Patterns in XI

    Hello,
    I heard that XI has got Design patterns such as Aggregation, Serialization etc. in the Process editor. Where do the messages get stored until the aggregation is carried? Does it make use any ODS in Integration server?
    We are using TIBCO and it does not seem to have this functionality.
    Thanks,
    Venu

    Hi Venu,
    The XI Business Process Engine is implemented on top of SAPs workflow engine, so the state of a process (including whatever messages it contains) is stored in the database underlying the SAP Web Application Server.
    Regards,
    Thorsten

  • Producer/Consumer Design Pattern with Classes

    I'm starting a new project which involves acquiring data from various pieces of equipment using a GPIB port.  I thought this would be a good time to start using Classes.  I created a GPIB class which contains member data of:  Address, Open State, Error; with member vis such as Set Address, Get Address, Open, Close...general actions that all GPIB devices need to do.  I then created a child class for a specific instrument (Agilent N1912 Power Meter for this example) which inherits from the GPIB class but also adds member data such as Channel A power and Channel B power and the associated Member Functions to obtain the data from the hardware.  This went fine and I created a Test vi for verfication utilizing a typical Event Structure architecture. 
    However, in other applications (without classes) I  typically use the Producer/Consumer Design Pattern with Event Structure so that the main loop is not delayed by any hardware interaction.  My queue data is a cluster of an "action" enum and a variant to pass data.  Is it OK to use this pattern with classes?  I created a vi and it works fine and attached is a png (of 1 case) of it.
    Are there any problems doing it this way?
    Jason

    JTerosky wrote:
    I'm starting a new project which involves acquiring data from various pieces of equipment using a GPIB port.  I thought this would be a good time to start using Classes.  I created a GPIB class which contains member data of:  Address, Open State, Error; with member vis such as Set Address, Get Address, Open, Close...general actions that all GPIB devices need to do.  I then created a child class for a specific instrument (Agilent N1912 Power Meter for this example) which inherits from the GPIB class but also adds member data such as Channel A power and Channel B power and the associated Member Functions to obtain the data from the hardware.  This went fine and I created a Test vi for verfication utilizing a typical Event Structure architecture. 
    However, in other applications (without classes) I  typically use the Producer/Consumer Design Pattern with Event Structure so that the main loop is not delayed by any hardware interaction.  My queue data is a cluster of an "action" enum and a variant to pass data.  Is it OK to use this pattern with classes?  I created a vi and it works fine and attached is a png (of 1 case) of it.
    Are there any problems doing it this way?
    Including the error cluster as part of the  private data is something I have never seen done and ... well I'll have to think about that one.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Producer/Consumer Design Pattern + DAQmx + Event Structure

    Dear community users,
    at the moment I try to implement the Producer/Consumer Design Pattern into my current project. For this purpose I am trying to make a "minimal-example" in which I use the Producer/Consumer Design Pattern for the data acquisition and analysis (display in GraphXY, calculation etc..) process. In the Producer Loop I perform the data readings via DAQmxRead.VI and in the Consumer Loop, in this example only, I display the data in a GraphXY. At the same time I want to control the data acquisition via an Event Structure, for example Start Measurement/Stop Measurement Buttons. To configure the measurement time, for example if the user only wants to measure 150 sec, I use the Time Out Event of the Event Structure. This is a technique which is often used, when data acquisition and Event Structures are used at the same time (Excuse me if this is wrong!). Due to understand the Producer/Consumer Design Pattern I looked up in the Template\Framework of LabVIEW.
    In the attachment you will find my "minimal-example", which -sadly-, not working. What should I do ? 
    Thank you.
    Best regards,
    tugrul öztürk
    Attachments:
    daqEngine_PCP.vi ‏35 KB

    Your VI will never stop due to the Ok Button that stops the producer loop is read OUTSIDE of the loop.  Add an event case for it.
    Move the Start and the Ok Button inside of their respective event cases.  This will allow the latch to reset when they are read.
    Change the Ok Button to a stop button.
    Use a Greater Or Equal instead of Equal for the measurement time comparison.  What if somebody randomly changes it to 0 on you?  Again, you will never stop.
    Is the DAQ only supposed to read for "Measurement Time".  Right now, it constantly reads.  So if you don't use the DAQmx Read, you will get a buffer overflow error.  You need to put the DAQmx Start Task inside of the Start event case and then the Stop DAQmx Task inside of the Timeout event case when the measurement time is exceeded.  You should also perform the read regardless inside of the Timeout event case.
    I HATE telling the consumer loop to stop by destroying the queue.  You can look data that way.  Instead, send something an empty array.  In the consumer, check for an empty array.  If it is empty, stop.  Destroy the queue only AFTER BOTH LOOPS HAVE COMPLETED.
    You should also report your errors in some way.  Simple Error Handler at the minimum.
    Since you are using Continous Samples, don't limit the buffer.  Leave the Samples per Channel unwired on the DAQmx Timing VI.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Design Patterns Support in Jdev 10.1.3?

    Is Design Patterns Support included as part of JDev 10.1.3. I have seen this support in SAP NetWeaver Developer Studio where you have the option of converting existing classes to implement a certain J2EE/J2SE Design Pattern or create a new class(es) to implement a Design Pattern. I believe TogetherSoft has this support.
    Any chances this request is consider in the next major release of JDev 10.1.3?

    Dear Shmeltzer,
    My company just begins the migration from Oracle Form-based application to pure Java EE one. We will be using JDeveloper v10.1.3, persuaded by it fast GUI building, data-binding features. Before that, we have been trying out Eclipse & JBoss.
    We are going to use Swing & JSF for client, and JavaEE 5 for midtier. Persistence layer, will be JPA (EJB3 entity bean persistence) and Spring Framework DAO support. Spring DAO is interesting bcos it gives a consistent style of API (we want to support both JDBC & JPA) and consistent Exception hierarchy too. So our midtier will be partitioned (roughly according to Fowler's patterns) into 3 layers: Service, Domain/Biz Object, Data Access. Thus far is pretty standard.
    We are still pretty new to this ADF, and are still exploring.
    Now, my initial impression with ADF is that it seems to interfere too much with the kind of pattern we had in mind. The fact that ADF hides too much details from us programmers scares me -- it becomes restrictive and we are helpless as to what are going on inside (with those xml, dcx, etc). For e.g. talk about Service Locator pattern, and we cannot seem to figure out how/where it is implemented. Using ADF Data Control and Biz Components will make all the design patterns "disappear" -- we dont see DAO classes anymore bcos it has been automated. It looks more like 2-tier client-server pattern to me. :-)
    We are interested to use ADF data-binding features, so
    1) Is it still advisable to use Spring DAO layer?
    2) Is it possible to just use ADF in the Client / web tier, while the EJB container remains free of ADF technologies?
    Regards.

  • Chain of Responsibility Design Pattern

    Is there any java api which helps in implementing Chain of Responsibility Design pattern by parsing a XML file?. Can I use XML file to do this in Apache Commons Chain API?

    A quick look at the javadocs for that project suggest that, yes, indeed they do provide a way to specify a chain of command using XML.
    In fact I'm kind of confused why you even asked this question, since you already seem to know the answer.
    I've never heard of such a thing in the standard API, if that's what you're asking, probably because it's a simple pattern to implement, and most of the pain of any implementation is likely to be due to details specific to the problem domain, not the pattern.
    If you're really eager to use XML, you might want to check out Spring. You could configure a bunch of beans in a chain, if you like.

  • How to create plug and play design pattern on a environment

    Hi All,
    Help me to get a best design for my problem statement.
    Problem Statement: I have to create a platform where I should be able to plug and play different components. explaining better with example
    Example:
    1. I have to create a platform for school
    2. In this school platform we have to plug in multiple components like "Student", "Teacher", "Subjects", "ClassPeriods" etc.,
    3. These components should be easily plug/unplug and play
    4. Like, the component "ClassPeriods" want to purchase from Vendor 1 and plug it to "School" platform it should work.
    5. Incase if we want to unplug the "ClassPeriod" component provided bfy Vendor 1 from "School" platform and want to plug the "ClassPeriod" from Vendor 2. then the Design should support without any extra effort.
    Suggest me the best design pattern for the problem
    This design pattern is for ASP.Net
    Thanks,
    S.Kannan

    Sounds like you're looking at 'Composition'. As a background, and possible solution, take a look at MEF;
    http://mef.codeplex.com/
    http://pauliom.wordpress.com

  • A start in design pattern

    Hi guys,
    I want to start learn j2ee design pattern , i browsed net but not got any significant point from where i can start. could anybody suggest me from where should i start .
    Thanks in advance

    The Design Patterns Java Companion
    Head First Design Patterns
    Huston Design Patterns
    Overview of Design Patterns
    ~

  • The search for a perfect design pattern

    The search for a perfect design pattern
    I am searching tip to upgrade a labview program used. I am looking for the best approach to make
    my program more robust and scalable.Software and hardware. 
    Today the system consists of :
    GPS, weather station, ultrasound wind sensor, echosounder  and a  webcamera,  all connected to a computer.
    The computer OS is XP pro with Labview version 2009 installed. Except for the webcamera all peripherals have serial communication interface. 
    The webcamera  interface is ethernet.
    Device                           Data type                 Interval                    Interface
    GPS                                NMEA string                1 second                   Serial  rs232
    Ultrasound wind sensor   NMEA string                1 second                   Serial rs232
    Weather, temp,humid     NMEA string               35 seconds                 Serial rs232
    Echosounder                  NMEA string               500ms-5 seconds       Serial rs232
                                                                          (depending of depth)
    Webcamera                    Jpg                           Snapshot on demand  Ethernet
    The tasks to be solved
    All the data have to be stored.
    All the data have to be displayed in real time.
    Weather history data must be buffered to be plotted in a graph (pop-up windows).
    Absolute wind speed and direction have to be calculated.
    Option to send navigation data attached to email at desired time intervals.
    Image snapshot at desired time intervals.
    The data wich streams into the serial ports are not synchronized and vary in intervals . Would it be a good idea to put all the serial peripherals into a serial device server. Is it possible to let the server place a event in my software, to  trigger reading of the data, from the the server.  Or how could that be done in other ways?
    The perfect design pattern
    In version one of the software I use 4 parallel loops to read data at the serial ports, inside these loops the data was separated and outputted to a datasocket server.  I used datasocked read in other loops to present and store data. But it did not look good, and yes it was a mess, a really rat nest. I am looking for a better design pattern.
     Could some kind of producer/ consumer pattern be the way to go?
    Comments and tips are wanted.
    TIK

    Nice Project! Congratulations ;-)
    I am not an expert for large applications. But your project looks nice and manageable. Here my straightforward ideas:
    I would build a GUI, with menu bar, pop-up graph display thing.
    THen low level tasks with each one handling a RS232 device and feeding queues or fireing notifications.
    Maybe handle the snapshots in an event structure on the GUI blockdiagramm.
    When GUI and producer tasks are running, close the gap with a middle layer which captures the data and actualizes GUI by reference. For instance the graph-thing-dialogue triggers a "flush queue" and displays the last 200 entries of the array of data.
    I often run into issues when having defined too many userevent structures. I guess i am too stupid for that. Thats why i rather use queues (when i dont want to loose data) or notifiers (data is up-to-date). Nevertheless I like a "stop-all-tasks" user event...traditionally.
    My team is actually developing a large application. We are using LabVIEW classes and objects.
    So have fun!
    Yours
    RZM

Maybe you are looking for

  • Try to use CL_GUI_TEXTEDIT

    Hi all, i try to use CL_GUI_TEXTEDIT (thanks to Duraifaj) in this little report: REPORT Z065_TEST2. PARAMETERS: P_PERNR LIKE PA0000-PERNR. DATA: DOCKING TYPE REF TO CL_GUI_DOCKING_CONTAINER,       EDITOR  TYPE REF TO CL_GUI_TEXTEDIT. DATA: TEXTLINES

  • I can't enter my university website

    http://kk.mercubuana.ac.id/elearning/krs_online.php This link can be accessed through Internet Explorer 9 in Windows 7 mine. but I do not usually use them. I prefer to use firefox 3.6.15. please help me .. I do not always convenient to use internet e

  • Configuring Message archiving

    Hi, while configuration of XI 3.0 for the step <b> Configuring Message Archiving for the Adapter Engine and the PCK</b> on the URL http://<host>:<port>/DataArchivingService/DAS when we click on the link like "Configure Archive Store "under Administra

  • Javax.resource.ResourceException: Failed to start the connection

    I have created the JMS bridge in Weblogic10.0 to connect with MQ server, I am getting error when startingup the weblogic server. Below the error ####<28-Mar-2009 10:56:25 o'clock GMT> <Info> <MessagingBridge> <clx25ao02> <aauat100-02> <[STANDBY] Exec

  • Windows 7 Laptop and Iphone 4S:

    I have a laptop with Windows 7 with current version of ITunes 11.0.2.26 and have the IPhone 4S with the current iOS 6.1.3  Itunes is seeing my IPhone, but the laptop is not seeing it properly.  Once the IPhone is connected it will charge and connect